@@ -38,6 +38,9 @@ BASE_JDK9_JVM_OPTS = [
3838 # TODO(b/64485048): Disable this option in persistent worker mode only.
3939 # Disable symlinks resolution cache since symlinks in exec root change
4040 "-Dsun.io.useCanonCaches=false" ,
41+
42+ # Compact strings make JavaBuilder slightly slower.
43+ "-XX:-CompactStrings" ,
4144]
4245
4346JDK9_JVM_OPTS = BASE_JDK9_JVM_OPTS
@@ -51,8 +54,7 @@ DEFAULT_JAVACOPTS = [
5154 "-Xep:ReturnValueIgnored:OFF" ,
5255]
5356
54- # java_toolchain parameters without specifying javac, java.compiler,
55- # jdk.compiler module, and jvm_opts
57+ # Default java_toolchain parameters
5658_BASE_TOOLCHAIN_CONFIGURATION = dict (
5759 forcibly_disable_header_compilation = False ,
5860 genclass = ["@remote_java_tools//:GenClass" ],
@@ -63,6 +65,10 @@ _BASE_TOOLCHAIN_CONFIGURATION = dict(
6365 javac_supports_workers = True ,
6466 jacocorunner = "@remote_java_tools//:jacoco_coverage_runner_filegroup" ,
6567 jvm_opts = BASE_JDK9_JVM_OPTS ,
68+ turbine_jvm_opts = [
69+ # Turbine is not a worker and parallel GC is faster for short-lived programs.
70+ "-XX:+UseParallelGC" ,
71+ ],
6672 misc = DEFAULT_JAVACOPTS ,
6773 singlejar = ["@bazel_tools//tools/jdk:singlejar" ],
6874 # Code to enumerate target JVM boot classpath uses host JVM. Because
@@ -73,19 +79,10 @@ _BASE_TOOLCHAIN_CONFIGURATION = dict(
7379 reduced_classpath_incompatible_processors = [
7480 "dagger.hilt.processor.internal.root.RootProcessor" , # see b/21307381
7581 ],
82+ java_runtime = "@bazel_tools//tools/jdk:remotejdk_17" ,
7683)
7784
78- DEFAULT_TOOLCHAIN_CONFIGURATION = dict (
79- jvm_opts = [
80- # Compact strings make JavaBuilder slightly slower.
81- "-XX:-CompactStrings" ,
82- ] + JDK9_JVM_OPTS ,
83- turbine_jvm_opts = [
84- # Turbine is not a worker and parallel GC is faster for short-lived programs.
85- "-XX:+UseParallelGC" ,
86- ],
87- java_runtime = "@bazel_tools//tools/jdk:remote_jdk11" ,
88- )
85+ DEFAULT_TOOLCHAIN_CONFIGURATION = _BASE_TOOLCHAIN_CONFIGURATION
8986
9087# The 'vanilla' toolchain is an unsupported alternative to the default.
9188#
@@ -103,6 +100,7 @@ DEFAULT_TOOLCHAIN_CONFIGURATION = dict(
103100VANILLA_TOOLCHAIN_CONFIGURATION = dict (
104101 javabuilder = ["@remote_java_tools//:VanillaJavaBuilder" ],
105102 jvm_opts = [],
103+ java_runtime = None ,
106104)
107105
108106# The new toolchain is using all the pre-built tools, including
@@ -111,32 +109,14 @@ VANILLA_TOOLCHAIN_CONFIGURATION = dict(
111109# same, otherwise the binaries will not work on the execution
112110# platform.
113111PREBUILT_TOOLCHAIN_CONFIGURATION = dict (
114- jvm_opts = [
115- # Compact strings make JavaBuilder slightly slower.
116- "-XX:-CompactStrings" ,
117- ] + JDK9_JVM_OPTS ,
118- turbine_jvm_opts = [
119- # Turbine is not a worker and parallel GC is faster for short-lived programs.
120- "-XX:+UseParallelGC" ,
121- ],
122112 ijar = ["@bazel_tools//tools/jdk:ijar_prebuilt_binary" ],
123113 singlejar = ["@bazel_tools//tools/jdk:prebuilt_singlejar" ],
124- java_runtime = "@bazel_tools//tools/jdk:remote_jdk11" ,
125114)
126115
127116# The new toolchain is using all the tools from sources.
128117NONPREBUILT_TOOLCHAIN_CONFIGURATION = dict (
129- jvm_opts = [
130- # Compact strings make JavaBuilder slightly slower.
131- "-XX:-CompactStrings" ,
132- ] + JDK9_JVM_OPTS ,
133- turbine_jvm_opts = [
134- # Turbine is not a worker and parallel GC is faster for short-lived programs.
135- "-XX:+UseParallelGC" ,
136- ],
137118 ijar = ["@remote_java_tools//:ijar_cc_binary" ],
138119 singlejar = ["@remote_java_tools//:singlejar_cc_bin" ],
139- java_runtime = "@bazel_tools//tools/jdk:remote_jdk11" ,
140120)
141121
142122def default_java_toolchain (name , configuration = DEFAULT_TOOLCHAIN_CONFIGURATION , toolchain_definition = True , exec_compatible_with = [], target_compatible_with = [], ** kwargs ):
@@ -191,8 +171,6 @@ def _bootclasspath_impl(ctx):
191171 args .add ("-target" )
192172 args .add ("8" )
193173 args .add ("-Xlint:-options" )
194- args .add ("-cp" )
195- args .add ("%s/lib/tools.jar" % host_javabase .java_home )
196174 args .add ("-d" )
197175 args .add_all ([class_dir ], expand_directories = False )
198176 args .add (ctx .file .src )
@@ -214,12 +192,7 @@ def _bootclasspath_impl(ctx):
214192 args .add ("--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" )
215193 args .add ("--add-exports=jdk.compiler/com.sun.tools.javac.platform=ALL-UNNAMED" )
216194 args .add ("--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED" )
217- args .add_joined (
218- "-cp" ,
219- [class_dir , "%s/lib/tools.jar" % host_javabase .java_home ],
220- join_with = ctx .configuration .host_path_separator ,
221- expand_directories = False ,
222- )
195+ args .add ("-cp" , class_dir .path )
223196 args .add ("DumpPlatformClassPath" )
224197 args .add (bootclasspath )
225198
0 commit comments