@@ -9,6 +9,7 @@ load("//java/common:java_plugin_info.bzl", "JavaPluginInfo")
99load ("//java/test/testutil:java_info_subject.bzl" , "java_info_subject" )
1010load ("//java/test/testutil:rules/custom_library.bzl" , "custom_library" )
1111load ("//java/test/testutil:rules/custom_library_extended_compile_jdeps.bzl" , "CompileJdepsInfo" , "custom_library_extended_jdeps" )
12+ load ("//java/test/testutil:rules/custom_library_with_bootclasspath.bzl" , "custom_bootclasspath" , "custom_library_with_bootclasspath" )
1213load ("//java/test/testutil:rules/custom_library_with_exports.bzl" , "custom_library_with_exports" )
1314load ("//java/test/testutil:rules/custom_library_with_sourcepaths.bzl" , "custom_library_with_sourcepaths" )
1415
@@ -161,6 +162,41 @@ def _test_compile_extend_compile_time_jdeps_rule_outputs_impl(env, targets):
161162 "{}/Baz.jdeps" .format (baz .label .package ),
162163 ])
163164
165+ def _test_compile_bootclasspath (name ):
166+ util .helper_target (
167+ custom_bootclasspath ,
168+ name = name + "/bootclasspath" ,
169+ srcs = [
170+ "custom-system/lib/jrt-fs.jar" ,
171+ "custom-system/lib/modules" ,
172+ "custom-system/release" ,
173+ ],
174+ )
175+ util .helper_target (
176+ custom_library_with_bootclasspath ,
177+ name = name + "/custom" ,
178+ srcs = ["Main.java" ],
179+ bootclasspath = name + "/bootclasspath" ,
180+ sourcepath = [":B.jar" ],
181+ )
182+
183+ analysis_test (
184+ name = name ,
185+ impl = _test_compile_bootclasspath_impl ,
186+ target = name + "/custom" ,
187+ attr_values = {"tags" : ["min_bazel_7" ]},
188+ )
189+
190+ def _test_compile_bootclasspath_impl (env , target ):
191+ assert_that_javac = env .expect .that_target (target ).action_generating (
192+ target [JavaInfo ].java_outputs [0 ].class_jar .short_path ,
193+ )
194+
195+ assert_that_javac .contains_flag_values ([(
196+ "--system" ,
197+ "{}/custom-system" .format (target .label .package ),
198+ )])
199+
164200def java_common_tests (name ):
165201 test_suite (
166202 name = name ,
@@ -171,5 +207,6 @@ def java_common_tests(name):
171207 _test_java_plugin_info ,
172208 _test_compile_extend_compile_time_jdeps ,
173209 _test_compile_extend_compile_time_jdeps_rule_outputs ,
210+ _test_compile_bootclasspath ,
174211 ],
175212 )
0 commit comments