From 18c17dab8fece0a02b53911711ebba497e7fea2a Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Fri, 22 Apr 2022 10:22:54 -0700 Subject: [PATCH] Remove custom jdk_compiler and java_compiler jars The javac changes that Bazel depends on are now available in the latest JDK 11 update release. https://github.com/bazelbuild/bazel/issues/14533 Closes #15303. PiperOrigin-RevId: 443698942 --- src/BUILD | 2 -- .../shell/bazel/bazel_java_test_defaults.sh | 16 ++++------------ .../shell/bazel/bazel_java_tools_dist_test.sh | 8 -------- src/test/shell/bazel/bazel_java_tools_test.sh | 8 -------- tools/jdk/BUILD.java_langtools | 10 ---------- tools/jdk/BUILD.java_tools | 10 ---------- tools/jdk/BUILD.tools | 10 ---------- tools/jdk/default_java_toolchain.bzl | 18 +----------------- 8 files changed, 5 insertions(+), 77 deletions(-) diff --git a/src/BUILD b/src/BUILD index 2fa0cc5f7f7d76..18df981315f2ff 100644 --- a/src/BUILD +++ b/src/BUILD @@ -549,8 +549,6 @@ JAVA_TOOLS_DEPLOY_JARS = [ release_archive( name = "jars_java_tools_zip", srcs = JAVA_TOOLS_DEPLOY_JARS + [ - "@java_tools_langtools_javac11//:jdk_compiler_jar", - "@java_tools_langtools_javac11//:java_compiler_jar", "@java_tools_langtools_javac11//:javac_jar", ], package_dir = "java_tools", diff --git a/src/test/shell/bazel/bazel_java_test_defaults.sh b/src/test/shell/bazel/bazel_java_test_defaults.sh index c809e85049893f..f46e161dd735c4 100755 --- a/src/test/shell/bazel/bazel_java_test_defaults.sh +++ b/src/test/shell/bazel/bazel_java_test_defaults.sh @@ -198,12 +198,10 @@ default_java_toolchain( "-XX:+UseParallelOldGC", "-XX:-CompactStrings", # override the javac in the JDK. - "--patch-module=java.compiler=\$(location @remote_java_tools//:java_compiler_jar)", - "--patch-module=jdk.compiler=\$(location @remote_java_tools//:jdk_compiler_jar)", + "-Xbootclasspath/p:\$(location @remote_java_tools//:javac_jar)", ] + JDK9_JVM_OPTS, tools = [ - "@remote_java_tools//:java_compiler_jar", - "@remote_java_tools//:jdk_compiler_jar", + "@remote_java_tools//:javac_jar", ], ) EOF @@ -211,8 +209,8 @@ EOF bazel build //:toolchain || fail "default_java_toolchain target failed to build" bazel cquery --output=build //:toolchain >& $TEST_log || fail "failed to query //:toolchain" - expect_log 'jvm_opts = \["-XX:+UseParallelOldGC", "-XX:-CompactStrings", "--patch-module=java.compiler=$(location @remote_java_tools//:java_compiler_jar)", "--patch-module=jdk.compiler=$(location @remote_java_tools//:jdk_compiler_jar)",' - expect_log 'tools = \["@remote_java_tools//:java_compiler_jar", "@remote_java_tools//:jdk_compiler_jar"\]' + expect_log 'jvm_opts = \["-XX:+UseParallelOldGC", "-XX:-CompactStrings", "-Xbootclasspath/p:$(location @remote_java_tools//:javac_jar)",' + expect_log 'tools = \["@remote_java_tools//:javac_jar"\]' } # JVM8_TOOLCHAIN_CONFIGURATION shall override Java 8 internal compiler classes. @@ -230,8 +228,6 @@ EOF expect_log ":JavaBuilder" expect_log ":javac_jar" - expect_not_log ":java_compiler_jar" - expect_not_log ":jdk_compiler_jar" expect_not_log ":VanillaJavaBuilder" } @@ -249,8 +245,6 @@ EOF bazel cquery 'deps(//:javabuilder_toolchain)' >& $TEST_log || fail "failed to query //:javabuilder_toolchain" expect_log ":JavaBuilder" - expect_log ":java_compiler_jar" - expect_log ":jdk_compiler_jar" expect_not_log ":VanillaJavaBuilder" expect_not_log ":javac_jar" } @@ -271,8 +265,6 @@ EOF expect_log ":VanillaJavaBuilder" expect_not_log ":JavaBuilder" - expect_not_log ":java_compiler_jar" - expect_not_log ":jdk_compiler_jar" expect_not_log ":javac_jar" } diff --git a/src/test/shell/bazel/bazel_java_tools_dist_test.sh b/src/test/shell/bazel/bazel_java_tools_dist_test.sh index 163758dc3c0e57..ef6c2b32cb8619 100755 --- a/src/test/shell/bazel/bazel_java_tools_dist_test.sh +++ b/src/test/shell/bazel/bazel_java_tools_dist_test.sh @@ -126,14 +126,6 @@ function test_java_tools_has_junitrunner() { expect_path_in_java_tools "src/java_tools/junitrunner/java/com/google/testing/junit/runner/util" } -function test_java_tools_has_jdk_compiler() { - expect_path_in_java_tools "jdk_compiler-src.jar" -} - -function test_java_tools_has_java_compiler() { - expect_path_in_java_tools "java_compiler-src.jar" -} - function test_java_tools_has_javac() { expect_path_in_java_tools "javac-9+181-r4173-1.srcjar" } diff --git a/src/test/shell/bazel/bazel_java_tools_test.sh b/src/test/shell/bazel/bazel_java_tools_test.sh index 1c43de6bf11ae7..bb2f8bf056765f 100755 --- a/src/test/shell/bazel/bazel_java_tools_test.sh +++ b/src/test/shell/bazel/bazel_java_tools_test.sh @@ -152,14 +152,6 @@ function test_java_tools_has_Runner() { expect_path_in_java_tools "java_tools/Runner_deploy.jar" } -function test_java_tools_has_jdk_compiler() { - expect_path_in_java_tools "java_tools/jdk_compiler.jar" -} - -function test_java_tools_has_java_compiler() { - expect_path_in_java_tools "java_tools/java_compiler.jar" -} - function test_java_tools_has_javac() { expect_path_in_java_tools "java_tools/javac-9+181-r4173-1.jar" } diff --git a/tools/jdk/BUILD.java_langtools b/tools/jdk/BUILD.java_langtools index eb8a3b0687b895..799613c0c89807 100644 --- a/tools/jdk/BUILD.java_langtools +++ b/tools/jdk/BUILD.java_langtools @@ -6,13 +6,3 @@ alias( name = "javac_jar", actual = "@remote_java_tools//:javac_jar", ) - -alias( - name = "jdk_compiler_jar", - actual = "@remote_java_tools//:jdk_compiler_jar", -) - -alias( - name = "java_compiler_jar", - actual = "@remote_java_tools//:java_compiler_jar", -) diff --git a/tools/jdk/BUILD.java_tools b/tools/jdk/BUILD.java_tools index f0af91785d169a..7bab8164ec192a 100644 --- a/tools/jdk/BUILD.java_tools +++ b/tools/jdk/BUILD.java_tools @@ -65,16 +65,6 @@ filegroup( srcs = ["java_tools/javac-9+181-r4173-1.jar"], ) -filegroup( - name = "jdk_compiler_jar", - srcs = ["java_tools/jdk_compiler.jar"], -) - -filegroup( - name = "java_compiler_jar", - srcs = ["java_tools/java_compiler.jar"], -) - java_import( name = "jacoco-agent", jars = ["java_tools/third_party/java/jacoco/org.jacoco.agent-0.8.7.jar"], diff --git a/tools/jdk/BUILD.tools b/tools/jdk/BUILD.tools index d9f81ededb241e..205bf456c65c3a 100644 --- a/tools/jdk/BUILD.tools +++ b/tools/jdk/BUILD.tools @@ -269,16 +269,6 @@ alias( actual = "@remote_java_tools//:javac_jar", ) -alias( - name = "jdk_compiler_jar", - actual = "@remote_java_tools//:jdk_compiler_jar", -) - -alias( - name = "java_compiler_jar", - actual = "@remote_java_tools//:java_compiler_jar", -) - alias( name = "JacocoCoverageRunner", actual = "@remote_java_tools//:jacoco_coverage_runner", diff --git a/tools/jdk/default_java_toolchain.bzl b/tools/jdk/default_java_toolchain.bzl index 998531481eb50d..6b74b117897d76 100644 --- a/tools/jdk/default_java_toolchain.bzl +++ b/tools/jdk/default_java_toolchain.bzl @@ -40,11 +40,7 @@ BASE_JDK9_JVM_OPTS = [ "--add-opens=java.base/java.lang=ALL-UNNAMED", ] -JDK9_JVM_OPTS = BASE_JDK9_JVM_OPTS + [ - # override the javac in the JDK. - "--patch-module=java.compiler=$(location @remote_java_tools//:java_compiler_jar)", - "--patch-module=jdk.compiler=$(location @remote_java_tools//:jdk_compiler_jar)", -] +JDK9_JVM_OPTS = BASE_JDK9_JVM_OPTS DEFAULT_JAVACOPTS = [ "-XDskipDuplicateBridges=true", @@ -94,10 +90,6 @@ DEFAULT_TOOLCHAIN_CONFIGURATION = dict( # Turbine is not a worker and parallel GC is faster for short-lived programs. "-XX:+UseParallelOldGC", ], - tools = [ - "@remote_java_tools//:java_compiler_jar", - "@remote_java_tools//:jdk_compiler_jar", - ], java_runtime = "@bazel_tools//tools/jdk:remote_jdk11", ) @@ -133,10 +125,6 @@ PREBUILT_TOOLCHAIN_CONFIGURATION = dict( # Turbine is not a worker and parallel GC is faster for short-lived programs. "-XX:+UseParallelOldGC", ], - tools = [ - "@remote_java_tools//:java_compiler_jar", - "@remote_java_tools//:jdk_compiler_jar", - ], ijar = ["@bazel_tools//tools/jdk:ijar_prebuilt_binary"], singlejar = ["@bazel_tools//tools/jdk:prebuilt_singlejar"], java_runtime = "@bazel_tools//tools/jdk:remote_jdk11", @@ -152,10 +140,6 @@ NONPREBUILT_TOOLCHAIN_CONFIGURATION = dict( # Turbine is not a worker and parallel GC is faster for short-lived programs. "-XX:+UseParallelOldGC", ], - tools = [ - "@remote_java_tools//:java_compiler_jar", - "@remote_java_tools//:jdk_compiler_jar", - ], ijar = ["@remote_java_tools//:ijar_cc_binary"], singlejar = ["@remote_java_tools//:singlejar_cc_bin"], java_runtime = "@bazel_tools//tools/jdk:remote_jdk11",