Prepare tests for flipping --incompatible_disallow_legacy_java_provider.
Progress on
RELNOTES: None.
@@ -994,60 +994,6 @@ public class JavaSkylarkApiTest extends BuildViewTestCase {
assertThat(artifactFilesNames(javaAction.getOutputs())).contains("custom_additional_output");
}
- @Test
- public void testExposesJavaSkylarkApiProvider() throws Exception {
- scratch.file(
- "java/test/BUILD",
- "load(':extension.bzl', 'my_rule')",
- "java_library(",
- " name = 'dep',",
- " srcs = [ 'Dep.java'],",
- ")",
- "my_rule(",
- " name = 'my',",
- " dep = ':dep',",
- ")");
- scratch.file(
- "java/test/extension.bzl",
- "result = provider()",
- "def impl(ctx):",
- " depj = ctx.attr.dep.java",
- " return [result(",
- " source_jars = depj.source_jars,",
- " transitive_deps = depj.transitive_deps,",
- " transitive_runtime_deps = depj.transitive_runtime_deps,",
- " transitive_source_jars = depj.transitive_source_jars,",
- " outputs = depj.outputs.jars,",
- " )]",
- "my_rule = rule(impl, attrs = { 'dep' : attr.label() })");
-
- ConfiguredTarget configuredTarget = getConfiguredTarget("//java/test:my");
- StructImpl info =
- (StructImpl)
- configuredTarget.get(
- new SkylarkKey(
- Label.parseAbsolute("//java/test:extension.bzl", ImmutableMap.of()), "result"));
-
- SkylarkNestedSet sourceJars = ((SkylarkNestedSet) info.getValue("source_jars"));
- SkylarkNestedSet transitiveDeps = ((SkylarkNestedSet) info.getValue("transitive_deps"));
- SkylarkNestedSet transitiveRuntimeDeps =
- ((SkylarkNestedSet) info.getValue("transitive_runtime_deps"));
- SkylarkNestedSet transitiveSourceJars =
- ((SkylarkNestedSet) info.getValue("transitive_source_jars"));
- SkylarkList<OutputJar> outputJars = ((SkylarkList<OutputJar>) info.getValue("outputs"));
-
- assertThat(artifactFilesNames(sourceJars.toCollection(Artifact.class)))
- .containsExactly("libdep-src.jar");
- assertThat(artifactFilesNames(transitiveDeps.toCollection(Artifact.class)))
- .containsExactly("libdep-hjar.jar");
- assertThat(artifactFilesNames(transitiveRuntimeDeps.toCollection(Artifact.class)))
- .containsExactly("libdep.jar");
- assertThat(artifactFilesNames(transitiveSourceJars.toCollection(Artifact.class)))
- .containsExactly("libdep-src.jar");
- assertThat(outputJars).hasSize(1);
- assertThat(outputJars.get(0).getClassJar().getFilename()).isEqualTo("libdep.jar");
- }
-
private static Collection<String> artifactFilesNames(Iterable<Artifact> artifacts) {
List<String> result = new ArrayList<>();
for (Artifact artifact : artifacts) {
