Skip to content

Commit

Permalink
Remove custom jdk_compiler and java_compiler jars
Browse files Browse the repository at this point in the history
The javac changes that Bazel depends on are now available in the latest
JDK 11 update release.

bazelbuild#14533
  • Loading branch information
cushon committed Apr 22, 2022
1 parent 128e4b3 commit bbe01ce
Show file tree
Hide file tree
Showing 13 changed files with 5 additions and 93 deletions.
2 changes: 0 additions & 2 deletions src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 4 additions & 12 deletions src/test/shell/bazel/bazel_java_test_defaults.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,21 +198,19 @@ 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

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.
Expand All @@ -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"
}

Expand All @@ -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"
}
Expand All @@ -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"
}

Expand Down
8 changes: 0 additions & 8 deletions src/test/shell/bazel/bazel_java_tools_dist_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
8 changes: 0 additions & 8 deletions src/test/shell/bazel/bazel_java_tools_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
16 changes: 0 additions & 16 deletions third_party/java/jdk/langtools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,16 @@ filegroup(
srcs = [
"BUILD",
"LICENSE",
"java_compiler.jar",
"java_compiler-src.jar",
"javac-9+181-r4173-1.jar",
"javac-9+181-r4173-1.srcjar",
"jdk_compiler.jar",
"jdk_compiler-src.jar",
],
)

filegroup(
name = "license-and-srcs",
srcs = [
"LICENSE",
"java_compiler-src.jar",
"javac-9+181-r4173-1.srcjar",
"jdk_compiler-src.jar",
],
)

Expand All @@ -42,13 +36,3 @@ filegroup(
name = "javac_jar",
srcs = ["javac-9+181-r4173-1.jar"],
)

filegroup(
name = "jdk_compiler_jar",
srcs = ["jdk_compiler.jar"],
)

filegroup(
name = "java_compiler_jar",
srcs = ["java_compiler.jar"],
)
Binary file not shown.
Binary file removed third_party/java/jdk/langtools/java_compiler.jar
Binary file not shown.
Binary file removed third_party/java/jdk/langtools/jdk_compiler-src.jar
Binary file not shown.
Binary file removed third_party/java/jdk/langtools/jdk_compiler.jar
Binary file not shown.
10 changes: 0 additions & 10 deletions tools/jdk/BUILD.java_langtools
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)
10 changes: 0 additions & 10 deletions tools/jdk/BUILD.java_tools
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
10 changes: 0 additions & 10 deletions tools/jdk/BUILD.tools
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 1 addition & 17 deletions tools/jdk/default_java_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
)

Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit bbe01ce

Please sign in to comment.