diff --git a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/android/AarImport.java b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/android/AarImport.java index 8d2ff788b91..624286b9727 100644 --- a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/android/AarImport.java +++ b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/android/AarImport.java @@ -44,8 +44,6 @@ import com.google.devtools.build.lib.rules.java.JavaRuntimeInfo; import com.google.devtools.build.lib.rules.java.JavaSemantics; import com.google.devtools.build.lib.rules.java.JavaSkylarkApiProvider; -import com.google.devtools.build.lib.rules.java.JavaSourceInfoProvider; -import com.google.devtools.build.lib.rules.java.JavaSourceJarsProvider; import com.google.devtools.build.lib.rules.java.JavaToolchainProvider; import com.google.devtools.build.lib.vfs.PathFragment; import javax.annotation.Nullable; @@ -194,36 +192,12 @@ public ConfiguredTarget create(RuleContext ruleContext) /* isNeverLink = */ JavaCommon.isNeverLink(ruleContext), /* srcLessDepsExport = */ false); - // Wire up the source jar for the current target and transitive source jars from dependencies. - ImmutableList srcJars = ImmutableList.of(); - Artifact srcJar = ruleContext.getPrerequisiteArtifact("srcjar", Mode.TARGET); - NestedSetBuilder transitiveJavaSourceJarBuilder = NestedSetBuilder.stableOrder(); - if (srcJar != null) { - srcJars = ImmutableList.of(srcJar); - transitiveJavaSourceJarBuilder.add(srcJar); - } - for (JavaSourceJarsProvider other : - JavaInfo.getProvidersFromListOfTargets( - JavaSourceJarsProvider.class, ruleContext.getPrerequisites("exports", Mode.TARGET))) { - transitiveJavaSourceJarBuilder.addTransitive(other.getTransitiveSourceJars()); - } - NestedSet transitiveJavaSourceJars = transitiveJavaSourceJarBuilder.build(); - JavaSourceJarsProvider javaSourceJarsProvider = - JavaSourceJarsProvider.create(transitiveJavaSourceJars, srcJars); - JavaSourceInfoProvider javaSourceInfoProvider = - new JavaSourceInfoProvider.Builder() - .setJarFiles(ImmutableList.of(mergedJar)) - .setSourceJarsForJarFiles(srcJars) - .build(); - JavaInfo.Builder javaInfoBuilder = JavaInfo.Builder.create() .setRuntimeJars(ImmutableList.of(mergedJar)) .setJavaConstraints(ImmutableList.of("android")) .setNeverlink(JavaCommon.isNeverLink(ruleContext)) .addProvider(JavaCompilationArgsProvider.class, javaCompilationArgsProvider) - .addProvider(JavaSourceJarsProvider.class, javaSourceJarsProvider) - .addProvider(JavaSourceInfoProvider.class, javaSourceInfoProvider) .addProvider(JavaRuleOutputJarsProvider.class, jarProviderBuilder.build()); common.addTransitiveInfoProviders( diff --git a/dataset/GitHub_Java/bazelbuild.bazel/src/test/java/com/google/devtools/build/lib/rules/android/AarImportTest.java b/dataset/GitHub_Java/bazelbuild.bazel/src/test/java/com/google/devtools/build/lib/rules/android/AarImportTest.java index a8a9191df65..6b2b459662f 100644 --- a/dataset/GitHub_Java/bazelbuild.bazel/src/test/java/com/google/devtools/build/lib/rules/android/AarImportTest.java +++ b/dataset/GitHub_Java/bazelbuild.bazel/src/test/java/com/google/devtools/build/lib/rules/android/AarImportTest.java @@ -37,8 +37,6 @@ import com.google.devtools.build.lib.rules.java.JavaInfo; import com.google.devtools.build.lib.rules.java.JavaRuleOutputJarsProvider; import com.google.devtools.build.lib.rules.java.JavaRuleOutputJarsProvider.OutputJar; -import com.google.devtools.build.lib.rules.java.JavaSourceInfoProvider; -import com.google.devtools.build.lib.rules.java.JavaSourceJarsProvider; import java.util.Iterator; import java.util.List; import java.util.Set; @@ -76,27 +74,17 @@ public void setup() throws Exception { ")"); scratch.file( "a/BUILD", - "java_import(", - " name = 'foo_src',", - " jars = ['foo-src.jar'],", - ")", "aar_import(", " name = 'foo',", " aar = 'foo.aar',", - " srcjar = ':foo_src',", ")", "aar_import(", " name = 'baz',", " aar = 'baz.aar',", ")", - "java_import(", - " name = 'bar_src',", - " jars = ['bar-src.jar'],", - ")", "aar_import(", " name = 'bar',", " aar = 'bar.aar',", - " srcjar = ':bar_src',", " deps = [':baz'],", " exports = [':foo', '//java:baz'],", ")", @@ -196,43 +184,6 @@ public void testResourcesProvided() throws Exception { assertThat(assetsTreeArtifact.getExecPathString()).endsWith("_aar/unzipped/assets/foo"); } - @Test - public void testSourceJarsProvided() throws Exception { - ConfiguredTarget aarImportTarget = getConfiguredTarget("//a:foo"); - - Iterable srcJars = - JavaInfo.getProvider(JavaSourceJarsProvider.class, aarImportTarget).getSourceJars(); - assertThat(srcJars).hasSize(1); - Artifact srcJar = Iterables.getOnlyElement(srcJars); - assertThat(srcJar.getExecPathString()).endsWith("foo-src.jar"); - - Iterable srcInfoJars = - JavaInfo.getProvider(JavaSourceInfoProvider.class, aarImportTarget) - .getSourceJarsForJarFiles(); - assertThat(srcInfoJars).hasSize(1); - Artifact srcInfoJar = Iterables.getOnlyElement(srcInfoJars); - assertThat(srcInfoJar.getExecPathString()).endsWith("foo-src.jar"); - } - - @Test - public void testSourceJarsCollectedTransitively() throws Exception { - ConfiguredTarget aarImportTarget = getConfiguredTarget("//a:bar"); - - Iterable srcJars = - JavaInfo.getProvider(JavaSourceJarsProvider.class, aarImportTarget) - .getTransitiveSourceJars(); - assertThat(srcJars).hasSize(2); - assertThat(ActionsTestUtil.baseArtifactNames(srcJars)) - .containsExactly("foo-src.jar", "bar-src.jar"); - - Iterable srcInfoJars = - JavaInfo.getProvider(JavaSourceInfoProvider.class, aarImportTarget) - .getSourceJarsForJarFiles(); - assertThat(srcInfoJars).hasSize(1); - Artifact srcInfoJar = Iterables.getOnlyElement(srcInfoJars); - assertThat(srcInfoJar.getExecPathString()).endsWith("bar-src.jar"); - } - @Test public void testResourcesExtractor() throws Exception { ValidatedAndroidResources resourceContainer =