diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index dea209c55d3..ed4f1241a45 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -339,6 +339,84 @@ ] } }, + "@@rules_bazel_integration_test~//:extensions.bzl%bazel_binaries": { + "general": { + "bzlTransitiveDigest": "ruMfvWwZzwPPkk+exdpYAe94RD+4erzc4ePrZ08MuKc=", + "usagesDigest": "NOmZNyUfHK4TOR2tGFP4OfRYOHmgVVZiVibKj0w/wws=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "build_bazel_bazel_7_2_1": { + "bzlFile": "@@rules_bazel_integration_test~//bazel_integration_test/private:bazel_binaries.bzl", + "ruleClassName": "bazel_binary", + "attributes": { + "version": "7.2.1", + "bazelisk": "@bazel_binaries_bazelisk//:bazelisk" + } + }, + "build_bazel_bazel_5_4_1": { + "bzlFile": "@@rules_bazel_integration_test~//bazel_integration_test/private:bazel_binaries.bzl", + "ruleClassName": "bazel_binary", + "attributes": { + "version": "5.4.1", + "bazelisk": "@bazel_binaries_bazelisk//:bazelisk" + } + }, + "build_bazel_bazel_6_5_0": { + "bzlFile": "@@rules_bazel_integration_test~//bazel_integration_test/private:bazel_binaries.bzl", + "ruleClassName": "bazel_binary", + "attributes": { + "version": "6.5.0", + "bazelisk": "@bazel_binaries_bazelisk//:bazelisk" + } + }, + "bazel_binaries_bazelisk": { + "bzlFile": "@@rules_bazel_integration_test~//bazel_integration_test/private:bazel_binaries.bzl", + "ruleClassName": "bazelisk_binary", + "attributes": { + "version": "1.18.0" + } + }, + "bazel_binaries": { + "bzlFile": "@@rules_bazel_integration_test~//bazel_integration_test/bzlmod:bazel_binaries.bzl", + "ruleClassName": "_bazel_binaries_helper", + "attributes": { + "version_to_repo": { + "5.4.1": "build_bazel_bazel_5_4_1", + "6.5.0": "build_bazel_bazel_6_5_0", + "7.2.1": "build_bazel_bazel_7_2_1" + }, + "current_version": "7.2.1" + } + } + }, + "moduleExtensionMetadata": { + "explicitRootModuleDirectDeps": [], + "explicitRootModuleDirectDevDeps": [ + "bazel_binaries_bazelisk", + "build_bazel_bazel_5_4_1", + "build_bazel_bazel_6_5_0", + "build_bazel_bazel_7_2_1", + "bazel_binaries" + ], + "useAllRepos": "NO", + "reproducible": false + }, + "recordedRepoMappingEntries": [ + [ + "rules_bazel_integration_test~", + "bazel_skylib", + "bazel_skylib~" + ], + [ + "rules_bazel_integration_test~", + "cgrindel_bazel_starlib", + "cgrindel_bazel_starlib~" + ] + ] + } + }, "@@rules_go~//go:extensions.bzl%go_sdk": { "general": { "bzlTransitiveDigest": "EJ2jI5PPSo7sHmzcmLtJ0MyhdsySDOSbGoU59oYFq6g=", diff --git a/aspect/intellij_info_impl.bzl b/aspect/intellij_info_impl.bzl index 14e6200600e..dc1ff5243e8 100644 --- a/aspect/intellij_info_impl.bzl +++ b/aspect/intellij_info_impl.bzl @@ -204,20 +204,14 @@ def annotation_processing_jars(generated_class_jar, generated_source_jar): source_jars = [artifact_location(src_jar)] if src_jar else None, ) -def jars_from_output(output, should_optimize_building_jars): +def jars_from_output(output): """Collect jars for intellij-resolve-files from Java output.""" if output == None: return [] source_jars = get_source_jars(output) - if should_optimize_building_jars: - return [ - jar - for jar in ([output.ijar if len(source_jars) > 0 and output.ijar else output.class_jar] + source_jars) - if jar != None and not jar.is_source - ] return [ jar - for jar in ([output.class_jar, output.ijar] + source_jars) + for jar in ([output.ijar if len(source_jars) > 0 and output.ijar else output.class_jar] + source_jars) if jar != None and not jar.is_source ] @@ -617,11 +611,6 @@ def _collect_generated_files(java): return [(java.annotation_processing.class_jar, java.annotation_processing.source_jar)] return [] -def _should_optimize_building_jars(ctx): - if ctx.attr.optimize_building_jars == "enabled": - return True - return False - def collect_java_info(target, ctx, semantics, ide_info, ide_info_file, output_groups): """Updates Java-specific output groups, returns false if not a Java target.""" java = get_java_provider(target) @@ -642,7 +631,7 @@ def collect_java_info(target, ctx, semantics, ide_info, ide_info_file, output_gr sources = sources_from_target(ctx) jars = [library_artifact(output, ctx.rule.kind) for output in java_outputs] class_jars = [output.class_jar for output in java_outputs if output and output.class_jar] - output_jars = [jar for output in java_outputs for jar in jars_from_output(output, _should_optimize_building_jars(ctx))] + output_jars = [jar for output in java_outputs for jar in jars_from_output(output)] resolve_files = output_jars compile_files = class_jars @@ -785,20 +774,16 @@ def _build_filtered_gen_jar(ctx, target, java_outputs, gen_java_sources, srcjars """Filters the passed jar to contain only classes from the given manifest.""" jar_artifacts = [] source_jar_artifacts = [] - should_optimize_building_jars = _should_optimize_building_jars(ctx) for jar in java_outputs: if jar.ijar: jar_artifacts.append(jar.ijar) - elif jar.class_jar and not should_optimize_building_jars: - jar_artifacts.append(jar.class_jar) if hasattr(jar, "source_jars") and jar.source_jars: source_jar_artifacts.extend(_list_or_depset_to_list(jar.source_jars)) elif hasattr(jar, "source_jar") and jar.source_jar: source_jar_artifacts.append(jar.source_jar) - if should_optimize_building_jars: - if len(source_jar_artifacts) == 0 or len(jar_artifacts) == 0: - jar_artifacts.extend([jar.class_jar for jar in java_outputs if jar.class_jar]) + if len(source_jar_artifacts) == 0 or len(jar_artifacts) == 0: + jar_artifacts.extend([jar.class_jar for jar in java_outputs if jar.class_jar]) filtered_jar = ctx.actions.declare_file(target.label.name + "-filtered-gen.jar") filtered_source_jar = ctx.actions.declare_file(target.label.name + "-filtered-gen-src.jar") @@ -905,7 +890,7 @@ def _collect_android_ide_info(target, ctx, semantics, ide_info, ide_info_file, o resources = [] res_folders = [] - resolve_files = jars_from_output(output_jar, _should_optimize_building_jars(ctx)) + resolve_files = jars_from_output(output_jar) if hasattr(ctx.rule.attr, "resource_files"): for artifact_path_fragments, res_files in get_res_artifacts(ctx.rule.attr.resource_files).items(): # Generate unique ArtifactLocation for resource directories. @@ -977,7 +962,7 @@ def _collect_android_ide_info(target, ctx, semantics, ide_info, ide_info_file, o # b/176209293: expose resource jar to make sure empty library # knows they are remote output artifact if android.resource_jar: - resolve_files += [jar for jar in jars_from_output(android.resource_jar, _should_optimize_building_jars(ctx))] + resolve_files += [jar for jar in jars_from_output(android.resource_jar)] ide_info["android_ide_info"] = android_info update_sync_output_groups(output_groups, "intellij-resolve-android", depset(resolve_files)) @@ -1289,11 +1274,6 @@ def make_intellij_info_aspect(aspect_impl, semantics): executable = True, allow_files = True, ), - "optimize_building_jars": attr.string( - doc = "Reduce the number of jars built by the aspect and tracked by the ide", - default = "disabled", - values = ["enabled", "disabled"], - ), } # add attrs required by semantics diff --git a/aspect/testing/rules/intellij_aspect_test_fixture.bzl b/aspect/testing/rules/intellij_aspect_test_fixture.bzl index d7c28380681..cb0bccebb7f 100644 --- a/aspect/testing/rules/intellij_aspect_test_fixture.bzl +++ b/aspect/testing/rules/intellij_aspect_test_fixture.bzl @@ -62,22 +62,16 @@ _intellij_aspect_test_fixture = rule( executable = True, allow_files = True, ), - "optimize_building_jars": attr.string( - doc = "Reduce the number of jars built by the aspect and tracked by the ide", - default = "disabled", - values = ["enabled", "disabled"], - ), }, ) -def intellij_aspect_test_fixture(name, deps, transitive_configs = [], optimize_building_jars = "disabled"): +def intellij_aspect_test_fixture(name, deps, transitive_configs = []): _intellij_aspect_test_fixture( name = name, output = name + ".intellij-aspect-test-fixture", deps = deps, testonly = 1, transitive_configs = transitive_configs, - optimize_building_jars = optimize_building_jars, ) def test_sources(outs): diff --git a/aspect/testing/tests/src/com/google/idea/blaze/aspect/general/noide/BUILD b/aspect/testing/tests/src/com/google/idea/blaze/aspect/general/noide/BUILD index b97000b619f..70f8c98ff75 100644 --- a/aspect/testing/tests/src/com/google/idea/blaze/aspect/general/noide/BUILD +++ b/aspect/testing/tests/src/com/google/idea/blaze/aspect/general/noide/BUILD @@ -25,16 +25,6 @@ java_library( intellij_aspect_test_fixture( name = "noide_fixture", - optimize_building_jars = "disabled", - deps = [ - ":baz", - ":foo", - ], -) - -intellij_aspect_test_fixture( - name = "noide_fixture_optimize_building_jars", - optimize_building_jars = "enabled", deps = [ ":baz", ":foo", @@ -46,7 +36,6 @@ java_test( srcs = ["NoIdeTest.java"], data = [ ":noide_fixture", - ":noide_fixture_optimize_building_jars", ], deps = [ "//aspect/testing:BazelIntellijAspectTest", diff --git a/aspect/testing/tests/src/com/google/idea/blaze/aspect/general/noide/NoIdeTest.java b/aspect/testing/tests/src/com/google/idea/blaze/aspect/general/noide/NoIdeTest.java index a4eed8b7bd1..05d977d43b0 100644 --- a/aspect/testing/tests/src/com/google/idea/blaze/aspect/general/noide/NoIdeTest.java +++ b/aspect/testing/tests/src/com/google/idea/blaze/aspect/general/noide/NoIdeTest.java @@ -33,26 +33,6 @@ public void testNoIde() throws Exception { assertThat(findTarget(testFixture, ":bar")).isNull(); assertThat(findTarget(testFixture, ":baz")).isNull(); - assertThat(getOutputGroupFiles(testFixture, "intellij-info-java")) - .containsAtLeast( - testRelative("foo.java-manifest"), testRelative(intellijInfoFileName("foo"))); - assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")) - .containsExactly( - testRelative("libfoo.jar"), - testRelative("libfoo-hjar.jar"), - testRelative("libfoo-src.jar"), - testRelative("libfoo.jdeps")); - assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java")) - .containsExactly(testRelative("libfoo.jar")); - } - - @Test - public void testNoIdeOptimizedJars() throws Exception { - IntellijAspectTestFixture testFixture = loadTestFixture(":noide_fixture_optimize_building_jars"); - assertThat(findTarget(testFixture, ":foo")).isNotNull(); - assertThat(findTarget(testFixture, ":bar")).isNull(); - assertThat(findTarget(testFixture, ":baz")).isNull(); - assertThat(getOutputGroupFiles(testFixture, "intellij-info-java")) .containsAtLeast( testRelative("foo.java-manifest"), testRelative(intellijInfoFileName("foo"))); diff --git a/aspect/testing/tests/src/com/google/idea/blaze/aspect/java/dependencies/DependenciesTest.java b/aspect/testing/tests/src/com/google/idea/blaze/aspect/java/dependencies/DependenciesTest.java index 6beed2195f7..e28dbc2e9bf 100644 --- a/aspect/testing/tests/src/com/google/idea/blaze/aspect/java/dependencies/DependenciesTest.java +++ b/aspect/testing/tests/src/com/google/idea/blaze/aspect/java/dependencies/DependenciesTest.java @@ -52,7 +52,9 @@ public void testJavaLibraryWithTransitiveDependencies() throws Exception { testRelative(intellijInfoFileName("single_dep")), testRelative("transitive_dep.java-manifest"), testRelative(intellijInfoFileName("transitive_dep"))); - assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")) + + var intellijResolveJava = getOutputGroupFiles(testFixture, "intellij-resolve-java"); + assertThat(intellijResolveJava) .containsAtLeast( testRelative("libfoo-hjar.jar"), testRelative("libfoo-src.jar"), @@ -60,6 +62,13 @@ public void testJavaLibraryWithTransitiveDependencies() throws Exception { testRelative("libsingle_dep-src.jar"), testRelative("libtransitive_dep-hjar.jar"), testRelative("libtransitive_dep-src.jar")); + assertThat(intellijResolveJava) + .doesNotContain(testRelative("libfoo.jar")); + assertThat(intellijResolveJava) + .doesNotContain(testRelative("libsingle_dep.jar")); + assertThat(intellijResolveJava) + .doesNotContain(testRelative("libtransitive_dep.jar")); + assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java")) .containsAtLeast( testRelative("libfoo.jar"), @@ -98,7 +107,9 @@ public void testJavaLibraryWithExports() throws Exception { testRelative(intellijInfoFileName("foo_exporter")), testRelative("export_consumer.java-manifest"), testRelative(intellijInfoFileName("export_consumer"))); - assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")) + + var intellijResolveJava = getOutputGroupFiles(testFixture, "intellij-resolve-java"); + assertThat(intellijResolveJava) .containsAtLeast( testRelative("libfoo-hjar.jar"), testRelative("libfoo-src.jar"), @@ -106,6 +117,13 @@ public void testJavaLibraryWithExports() throws Exception { testRelative("libfoo_exporter-src.jar"), testRelative("libexport_consumer-hjar.jar"), testRelative("libexport_consumer-src.jar")); + assertThat(intellijResolveJava) + .doesNotContain(testRelative("libfoo.jar")); + assertThat(intellijResolveJava) + .doesNotContain(testRelative("libfoo_exporter.jar")); + assertThat(intellijResolveJava) + .doesNotContain(testRelative("libexport_consumer.jar")); + assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java")) .containsAtLeast( testRelative("libfoo.jar"), diff --git a/aspect/testing/tests/src/com/google/idea/blaze/aspect/java/javabinary/JavaBinaryTest.java b/aspect/testing/tests/src/com/google/idea/blaze/aspect/java/javabinary/JavaBinaryTest.java index 4a0592f65a1..538f822ba56 100644 --- a/aspect/testing/tests/src/com/google/idea/blaze/aspect/java/javabinary/JavaBinaryTest.java +++ b/aspect/testing/tests/src/com/google/idea/blaze/aspect/java/javabinary/JavaBinaryTest.java @@ -58,11 +58,12 @@ public void testJavaBinary() throws Exception { testRelative(intellijInfoFileName("foo"))); assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")) .containsAtLeast( - testRelative("libfoolib.jar"), testRelative("libfoolib-hjar.jar"), testRelative("libfoolib-src.jar"), testRelative("foo.jar"), testRelative("foo-src.jar")); + assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")) + .doesNotContain(testRelative("libfoolib.jar")); assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java")) .containsExactly(testRelative("libfoolib.jar"), testRelative("foo.jar")); diff --git a/aspect/testing/tests/src/com/google/idea/blaze/aspect/java/javalibrary/BUILD b/aspect/testing/tests/src/com/google/idea/blaze/aspect/java/javalibrary/BUILD index d844a1d2fce..1d94593d590 100644 --- a/aspect/testing/tests/src/com/google/idea/blaze/aspect/java/javalibrary/BUILD +++ b/aspect/testing/tests/src/com/google/idea/blaze/aspect/java/javalibrary/BUILD @@ -30,13 +30,6 @@ java_library( intellij_aspect_test_fixture( name = "foo_fixture", - optimize_building_jars = "disabled", - deps = [":foo"], -) - -intellij_aspect_test_fixture( - name = "foo_fixture_optimize_building_jars", - optimize_building_jars = "enabled", deps = [":foo"], ) @@ -63,7 +56,6 @@ java_library( intellij_aspect_test_fixture( name = "foo_exports_fixture", - optimize_building_jars = "disabled", deps = [":foo_exports"], ) @@ -73,7 +65,6 @@ java_test( data = [ ":foo_exports_fixture", ":foo_fixture", - ":foo_fixture_optimize_building_jars", ], deps = [ "//aspect/testing:BazelIntellijAspectTest", diff --git a/aspect/testing/tests/src/com/google/idea/blaze/aspect/java/javalibrary/JavaLibraryTest.java b/aspect/testing/tests/src/com/google/idea/blaze/aspect/java/javalibrary/JavaLibraryTest.java index 4b56b3a210b..97350cc5e6b 100644 --- a/aspect/testing/tests/src/com/google/idea/blaze/aspect/java/javalibrary/JavaLibraryTest.java +++ b/aspect/testing/tests/src/com/google/idea/blaze/aspect/java/javalibrary/JavaLibraryTest.java @@ -119,118 +119,6 @@ public void testJavaLibrary() throws Exception { testRelative("indirect.java-manifest"), testRelative(intellijInfoFileName("indirect")), testRelative("distant.java-manifest"), testRelative(intellijInfoFileName("distant"))); - // intellij-resolve groups - assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")) - .containsExactly( - // foo - testRelative("libfoo.jar"), - testRelative("libfoo-hjar.jar"), - testRelative("libfoo-src.jar"), - testRelative("libfoo.jdeps"), - // direct - testRelative("libdirect.jar"), - testRelative("libdirect-hjar.jar"), - testRelative("libdirect-src.jar"), - testRelative("libdirect.jdeps"), - // indirect - testRelative("libindirect.jar"), - testRelative("libindirect-hjar.jar"), - testRelative("libindirect-src.jar"), - testRelative("libindirect.jdeps"), - // distant - testRelative("libdistant.jar"), - testRelative("libdistant-hjar.jar"), - testRelative("libdistant-src.jar"), - testRelative("libdistant.jdeps")); - assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java-outputs")) - .containsExactly( - testRelative("libfoo.jar"), - testRelative("libfoo-hjar.jar"), - testRelative("libfoo-src.jar"), - testRelative("libfoo.jdeps")); - assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java-direct-deps")) - .containsExactly( - // foo - testRelative("libfoo.jar"), - testRelative("libfoo-hjar.jar"), - testRelative("libfoo-src.jar"), - testRelative("libfoo.jdeps"), - // direct - testRelative("libdirect.jar"), - testRelative("libdirect-hjar.jar"), - testRelative("libdirect-src.jar"), - testRelative("libdirect.jdeps"), - // indirect (only hjar and src-jar) - testRelative("libindirect-hjar.jar"), - testRelative("libindirect-src.jar"), - // distant (only hjar and src-jar) - testRelative("libdistant-hjar.jar"), - testRelative("libdistant-src.jar")); - - // intellij-compile groups - assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java")) - .containsExactly( - testRelative("libfoo.jar"), - testRelative("libdirect.jar"), - testRelative("libindirect.jar"), - testRelative("libdistant.jar")); - assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java-outputs")) - .containsExactly(testRelative("libfoo.jar")); - assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java-direct-deps")) - .containsExactly(testRelative("libfoo.jar"), testRelative("libdirect.jar")); - - assertThat(getOutputGroupFiles(testFixture, "intellij-info-generic")).isEmpty(); - - assertThat(target.getJavaIdeInfo().getJdeps().getRelativePath()) - .isEqualTo(testRelative("libfoo.jdeps")); - - assertThat(target.getJavaIdeInfo().getMainClass()).isEmpty(); - } - - @Test - public void testJavaLibraryOptimizedJars() throws Exception { - IntellijAspectTestFixture testFixture = loadTestFixture(":foo_fixture_optimize_building_jars"); - TargetIdeInfo target = findTarget(testFixture, ":foo"); - - assertThat(target.getKindString()).isEqualTo("java_library"); - assertThat(target.hasJavaIdeInfo()).isTrue(); - assertThat(target.hasCIdeInfo()).isFalse(); - assertThat(target.hasAndroidIdeInfo()).isFalse(); - assertThat(target.hasPyIdeInfo()).isFalse(); - - assertThat(relativePathsForArtifacts(target.getJavaIdeInfo().getSourcesList())) - .containsExactly(testRelative("Foo.java")); - assertThat( - target.getJavaIdeInfo().getJarsList().stream() - .map(IntellijAspectTest::libraryArtifactToString) - .collect(toList())) - .containsExactly( - jarString( - testRelative("libfoo.jar"), - testRelative("libfoo-hjar.jar"), - testRelative("libfoo-src.jar"))); - - // intellij-info groups - assertThat(getOutputGroupFiles(testFixture, "intellij-info-java")) - .containsAtLeast( - testRelative("foo.java-manifest"), testRelative(intellijInfoFileName("foo")), - testRelative("direct.java-manifest"), testRelative(intellijInfoFileName("direct")), - testRelative("indirect.java-manifest"), testRelative(intellijInfoFileName("indirect")), - testRelative("distant.java-manifest"), testRelative(intellijInfoFileName("distant"))); - - assertThat(getOutputGroupFiles(testFixture, "intellij-info-java-outputs")) - .containsExactly( - testRelative("foo.java-manifest"), testRelative(intellijInfoFileName("foo"))); - - assertThat(getOutputGroupFiles(testFixture, "intellij-info-java-direct-deps")) - .containsAtLeast( - testRelative("foo.java-manifest"), testRelative(intellijInfoFileName("foo")), - testRelative("direct.java-manifest"), testRelative(intellijInfoFileName("direct"))); - assertThat(getOutputGroupFiles(testFixture, "intellij-info-java-direct-deps")) - .containsNoneOf( - testRelative("indirect.java-manifest"), testRelative(intellijInfoFileName("indirect")), - testRelative("distant.java-manifest"), testRelative(intellijInfoFileName("distant"))); - // intellij-resolve groups assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")) .containsExactly( diff --git a/aspect/testing/tests/src/com/google/idea/blaze/aspect/proto/jpl/BUILD b/aspect/testing/tests/src/com/google/idea/blaze/aspect/proto/jpl/BUILD index 08a42a94531..8123e817c52 100644 --- a/aspect/testing/tests/src/com/google/idea/blaze/aspect/proto/jpl/BUILD +++ b/aspect/testing/tests/src/com/google/idea/blaze/aspect/proto/jpl/BUILD @@ -29,13 +29,6 @@ java_library( intellij_aspect_test_fixture( name = "lib_fixture", - optimize_building_jars = "disabled", - deps = [":lib"], -) - -intellij_aspect_test_fixture( - name = "lib_fixture_optimized_jars", - optimize_building_jars = "enabled", deps = [":lib"], ) @@ -44,7 +37,6 @@ java_test( srcs = ["JavaProtoLibraryTest.java"], data = [ ":lib_fixture", - ":lib_fixture_optimized_jars", ], deps = [ "//aspect/testing:BazelIntellijAspectTest", diff --git a/aspect/testing/tests/src/com/google/idea/blaze/aspect/proto/jpl/JavaProtoLibraryTest.java b/aspect/testing/tests/src/com/google/idea/blaze/aspect/proto/jpl/JavaProtoLibraryTest.java index 67f4d193352..1d45553a2c8 100644 --- a/aspect/testing/tests/src/com/google/idea/blaze/aspect/proto/jpl/JavaProtoLibraryTest.java +++ b/aspect/testing/tests/src/com/google/idea/blaze/aspect/proto/jpl/JavaProtoLibraryTest.java @@ -108,150 +108,35 @@ public void testJavaProtoLibrary() throws Exception { assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")) .containsExactly( // lib - testRelative("liblib.jar"), testRelative("liblib-hjar.jar"), testRelative("liblib-src.jar"), testRelative("liblib.jdeps"), // bar_proto - testRelative("libbar_proto-speed.jar"), testRelative("libbar_proto-speed-hjar.jar"), testRelative("bar_proto-speed-src.jar"), // foo_proto - testRelative("libfoo_proto-speed.jar"), testRelative("libfoo_proto-speed-hjar.jar"), testRelative("foo_proto-speed-src.jar")); assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java-outputs")) .containsExactly( - testRelative("liblib.jar"), testRelative("liblib-hjar.jar"), testRelative("liblib-src.jar"), testRelative("liblib.jdeps")); assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java-direct-deps")) .containsAtLeast( // lib - testRelative("liblib.jar"), testRelative("liblib-hjar.jar"), testRelative("liblib-src.jar"), testRelative("liblib.jdeps"), // bar_proto - testRelative("libbar_proto-speed.jar"), testRelative("libbar_proto-speed-hjar.jar"), testRelative("bar_proto-speed-src.jar"), // foo_proto (only hjar) testRelative("libfoo_proto-speed-hjar.jar")); - - // intellij-compile groups - assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java")) - .containsExactly( - testRelative("liblib.jar"), - testRelative("libbar_proto-speed.jar"), - testRelative("libfoo_proto-speed.jar")); - assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java-outputs")) - .containsExactly(testRelative("liblib.jar")); - assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java-direct-deps")) - .containsExactly(testRelative("liblib.jar"), testRelative("libbar_proto-speed.jar")); - } - - @Test - public void testJavaProtoLibraryOptimizedJars() throws Exception { - IntellijAspectTestFixture testFixture = loadTestFixture(":lib_fixture_optimized_jars"); - - TargetIdeInfo lib = findTarget(testFixture, ":lib"); - assertThat(lib).isNotNull(); - - TargetIdeInfo jpl = findTarget(testFixture, ":bar_java_proto"); - assertThat(jpl).isNotNull(); - - // We don't want java_proto_library to be rolling up any jars - assertThat(jpl.getJavaIdeInfo().getJarsList()).isEmpty(); - - // We shouldn't have reached the underlying base proto_library's - assertThat(findTarget(testFixture, ":bar_proto")).isNull(); - assertThat(findTarget(testFixture, ":foo_proto")).isNull(); - - TargetIdeInfo barProto = - findAspectTarget(testFixture, ":bar_proto", "JavaProtoAspect", "java_proto_aspect"); - TargetIdeInfo fooProto = - findAspectTarget(testFixture, ":foo_proto", "JavaProtoAspect", "java_proto_aspect"); - assertThat(barProto).isNotNull(); - assertThat(fooProto).isNotNull(); - - // jpl -> (proto + jpl aspect) - assertThat(jpl.getDepsList()) - .contains( - Dependency.newBuilder() - .setDependencyType(DependencyType.COMPILE_TIME) - .setTarget(barProto.getKey()) - .build()); - - // Make sure we suppress the proto_library legacy provider info - - assertThat(barProto.hasJavaIdeInfo()).isTrue(); - List jarStrings = - barProto - .getJavaIdeInfo() - .getJarsList() - .stream() - .map(IntellijAspectTest::libraryArtifactToString) - .collect(toList()); - assertThat(jarStrings) - .containsExactly( - jarString( - testRelative("libbar_proto-speed.jar"), - testRelative("libbar_proto-speed-hjar.jar"), - testRelative("bar_proto-speed-src.jar"))); - - // intellij-info groups - assertThat(getOutputGroupFiles(testFixture, "intellij-info-java")) - .containsAtLeast( - testRelative("lib.java-manifest"), - testRelative(intellijInfoFileName("lib")), - testRelative(intellijInfoFileName("bar_java_proto")), - testRelative(intellijInfoFileName(barProto.getKey())), - testRelative(intellijInfoFileName(fooProto.getKey()))); - - assertThat(getOutputGroupFiles(testFixture, "intellij-info-java-outputs")) - .containsExactly( - testRelative("lib.java-manifest"), testRelative(intellijInfoFileName("lib"))); - - assertThat(getOutputGroupFiles(testFixture, "intellij-info-java-direct-deps")) - .containsAtLeast( - testRelative("lib.java-manifest"), - testRelative(intellijInfoFileName("lib")), - testRelative(intellijInfoFileName("bar_java_proto")), - testRelative(intellijInfoFileName(barProto.getKey()))); - assertThat(getOutputGroupFiles(testFixture, "intellij-info-java-direct-deps")) - .doesNotContain(testRelative(intellijInfoFileName(fooProto.getKey()))); - - // intellij-resolve groups - assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")) - .containsExactly( - // lib - testRelative("liblib-hjar.jar"), - testRelative("liblib-src.jar"), - testRelative("liblib.jdeps"), - // bar_proto - testRelative("libbar_proto-speed-hjar.jar"), - testRelative("bar_proto-speed-src.jar"), - // foo_proto - testRelative("libfoo_proto-speed-hjar.jar"), - testRelative("foo_proto-speed-src.jar")); - assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java-outputs")) - .containsExactly( - testRelative("liblib-hjar.jar"), - testRelative("liblib-src.jar"), - testRelative("liblib.jdeps")); assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java-direct-deps")) - .containsAtLeast( - // lib - testRelative("liblib-hjar.jar"), - testRelative("liblib-src.jar"), - testRelative("liblib.jdeps"), - // bar_proto - testRelative("libbar_proto-speed-hjar.jar"), - testRelative("bar_proto-speed-src.jar"), - // foo_proto (only hjar) - testRelative("libfoo_proto-speed-hjar.jar")); + .doesNotContain(testRelative("liblib.jar")); + assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java-direct-deps")) + .doesNotContain(testRelative("libbar_proto-speed.jar")); // intellij-compile groups assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java")) diff --git a/aspect/testing/tests/src/com/google/idea/blaze/aspect/scala/scalabinary/ScalaBinaryTest.java b/aspect/testing/tests/src/com/google/idea/blaze/aspect/scala/scalabinary/ScalaBinaryTest.java index b9de97c531f..69149e8e986 100644 --- a/aspect/testing/tests/src/com/google/idea/blaze/aspect/scala/scalabinary/ScalaBinaryTest.java +++ b/aspect/testing/tests/src/com/google/idea/blaze/aspect/scala/scalabinary/ScalaBinaryTest.java @@ -48,7 +48,9 @@ public void testScalaBinary() throws Exception { testRelative(intellijInfoFileName("foolib")), testRelative(intellijInfoFileName("foo"))); assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")) - .containsAtLeast(testRelative("foolib.jar"), testRelative("foo.jar")); + .contains(testRelative("foo.jar")); + assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")) + .doesNotContain(testRelative("libfoo.jar")); assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java")) .containsAtLeast(testRelative("foolib.jar"), testRelative("foo.jar")); assertThat(getOutputGroupFiles(testFixture, "intellij-info-generic")).isEmpty(); diff --git a/aspect/testing/tests/src/com/google/idea/blaze/aspect/scala/scalalibrary/ScalaLibraryTest.java b/aspect/testing/tests/src/com/google/idea/blaze/aspect/scala/scalalibrary/ScalaLibraryTest.java index f9c12509e28..40f3d3ee10f 100644 --- a/aspect/testing/tests/src/com/google/idea/blaze/aspect/scala/scalalibrary/ScalaLibraryTest.java +++ b/aspect/testing/tests/src/com/google/idea/blaze/aspect/scala/scalalibrary/ScalaLibraryTest.java @@ -45,7 +45,7 @@ public void testScalaLibrary() throws Exception { // Also contains ijars for scala-library. // Also contains jars + srcjars for liblibrary. assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")) - .containsAnyOf(testRelative("simple.jar"), testRelative("simple-ijar.jar")); + .containsAnyOf(testRelative("simple-srcjar.jar"), testRelative("simple-ijar.jar")); assertThat(getOutputGroupFiles(testFixture, "intellij-info-java")) .contains(testRelative(intellijInfoFileName("simple"))); diff --git a/base/src/com/google/idea/blaze/base/sync/aspects/strategy/AspectStrategy.java b/base/src/com/google/idea/blaze/base/sync/aspects/strategy/AspectStrategy.java index a7f39a259a5..3983338c259 100644 --- a/base/src/com/google/idea/blaze/base/sync/aspects/strategy/AspectStrategy.java +++ b/base/src/com/google/idea/blaze/base/sync/aspects/strategy/AspectStrategy.java @@ -29,7 +29,6 @@ import com.google.idea.blaze.base.model.primitives.LanguageClass; import com.google.idea.blaze.common.artifact.BlazeArtifact; import com.google.idea.common.experiments.BoolExperiment; -import com.google.idea.common.experiments.FeatureRolloutExperiment; import com.google.protobuf.TextFormat; import java.io.IOException; import java.io.InputStream; @@ -49,9 +48,6 @@ public abstract class AspectStrategy { public static final Predicate ASPECT_OUTPUT_FILE_PREDICATE = str -> str.endsWith(".intellij-info.txt"); - static final FeatureRolloutExperiment optimize_building_jars = - new FeatureRolloutExperiment("optimize_building_jars"); - /** A Blaze output group created by the aspect. */ public enum OutputGroup { INFO("intellij-info-"), @@ -113,16 +109,9 @@ public final void addAspectAndOutputGroups( outputGroups.stream() .flatMap(g -> getOutputGroups(g, activeLanguages, directDepsOnly).stream()) .collect(toImmutableList()); - if (optimize_building_jars.isEnabled() && supportsAspectsParameters()){ - builder - .addBlazeFlags(getAspectFlag().map(List::of).orElse(List.of())) - .addBlazeFlags("--aspects_parameters=optimize_building_jars=enabled") - .addBlazeFlags("--output_groups=" + Joiner.on(',').join(groups)); - } else { - builder + builder .addBlazeFlags(getAspectFlag().map(List::of).orElse(List.of())) .addBlazeFlags("--output_groups=" + Joiner.on(',').join(groups)); - } } /** diff --git a/common/experiments/src/com/google/idea/common/experiments/experiment.properties b/common/experiments/src/com/google/idea/common/experiments/experiment.properties index 69045c4c05e..08ad1e99898 100644 --- a/common/experiments/src/com/google/idea/common/experiments/experiment.properties +++ b/common/experiments/src/com/google/idea/common/experiments/experiment.properties @@ -15,5 +15,3 @@ blaze.assistant.whatsnew.popup=1 # Disable until the feature is stabilized query.sync=disabled - -optimize_building_jars=100