From 28dabbba0bc16aa0da38c9620e129cc163738984 Mon Sep 17 00:00:00 2001 From: Googler Date: Mon, 25 Jul 2022 07:59:34 -0700 Subject: [PATCH] Singlejar Created-By field does not include Bazel version Including the Bazel version in the tag reduces the effectiveness of remote caching if multiple developers use different versions of Bazel. RELNOTES: None PiperOrigin-RevId: 463085774 Change-Id: If606a33299e852f0d554fc9716c8a15fff37d3f5 --- .../build/lib/rules/android/ApkActionsBuilder.java | 3 +-- .../java/com/google/devtools/build/lib/rules/android/BUILD | 1 - src/test/shell/bazel/android/android_integration_test.sh | 7 ++----- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/ApkActionsBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/android/ApkActionsBuilder.java index ce3090047f1dda..44cc3659b8b75a 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/ApkActionsBuilder.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/ApkActionsBuilder.java @@ -17,7 +17,6 @@ import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; import com.google.devtools.build.lib.actions.Artifact; -import com.google.devtools.build.lib.analysis.BlazeVersionInfo; import com.google.devtools.build.lib.analysis.FilesToRunProvider; import com.google.devtools.build.lib.analysis.RuleContext; import com.google.devtools.build.lib.analysis.actions.CustomCommandLine; @@ -208,7 +207,7 @@ private void setSingleJarCreatedBy(RuleContext ruleContext, CustomCommandLine.Bu if (ruleContext.getConfiguration().getFragment(BazelAndroidConfiguration.class) != null) { // Only enabled for Bazel, not Blaze. builder.add("--output_jar_creator"); - builder.addDynamicString("Bazel " + BlazeVersionInfo.instance().getReleaseName()); + builder.add("Bazel"); } } diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/BUILD b/src/main/java/com/google/devtools/build/lib/rules/android/BUILD index a57a1a79dc2981..e413de358c911e 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/BUILD +++ b/src/main/java/com/google/devtools/build/lib/rules/android/BUILD @@ -44,7 +44,6 @@ java_library( "//src/main/java/com/google/devtools/build/lib/analysis:actions/template", "//src/main/java/com/google/devtools/build/lib/analysis:actions/template_expansion_action", "//src/main/java/com/google/devtools/build/lib/analysis:analysis_cluster", - "//src/main/java/com/google/devtools/build/lib/analysis:blaze_version_info", "//src/main/java/com/google/devtools/build/lib/analysis:config/build_configuration", "//src/main/java/com/google/devtools/build/lib/analysis:config/build_options", "//src/main/java/com/google/devtools/build/lib/analysis:config/compilation_mode", diff --git a/src/test/shell/bazel/android/android_integration_test.sh b/src/test/shell/bazel/android/android_integration_test.sh index 829aa4ba0451e3..6b01f58180365f 100755 --- a/src/test/shell/bazel/android/android_integration_test.sh +++ b/src/test/shell/bazel/android/android_integration_test.sh @@ -143,13 +143,10 @@ EOF bazel clean bazel build //java/com/example/hello:hello || fail "build failed" jar xf bazel-bin/java/com/example/hello/hello.apk - # Check that the apk manifest contains Created-By: Bazel. Note that for - # custom-built bazel binaries, the field will say "Bazel development version". - # For official releases, the field will reflect the build label specified, for - # example "Bazel 5.2.0.". + # Check that the apk manifest contains Created-By: Bazel. assert_contains "Created\-By: Bazel" META-INF/MANIFEST.MF # Clean up the extracted manifest. - rm -rf META-INF/MANIFEST.MF + rm META-INF/MANIFEST.MF } function test_d8_dexes_hello_android() {