Skip to content

Commit b1376dd

Browse files
hvadehrarules_java Copybara
authored andcommitted
Add support for an unstripped bootclasspath
Running the bootclasspath through ijar was added in #324 and was always enabled. This change lets us selectively disable it. This ensures we don't end up depending on the prebuilt ijar in the non-prebuilt toolchain case. This is also needed to bootstrap bazel where we don't have access to `@remote_java_tools` PiperOrigin-RevId: 828056087 Change-Id: I38402112139221cea606b64110fb1854795a8113
1 parent 8bf8a94 commit b1376dd

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

toolchains/BUILD

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,17 @@ bootclasspath(
351351
}),
352352
)
353353

354+
bootclasspath(
355+
name = "platformclasspath_unstripped",
356+
src = "DumpPlatformClassPath.java",
357+
java_runtime_alias = ":current_java_runtime",
358+
language_version_bootstrap_runtime = select({
359+
":incompatible_language_version_bootclasspath_enabled": ":language_version_bootstrap_runtime",
360+
"//conditions:default": None,
361+
}),
362+
strip = False,
363+
)
364+
354365
default_java_toolchain(
355366
name = "toolchain",
356367
configuration = DEFAULT_TOOLCHAIN_CONFIGURATION,

toolchains/bootclasspath.bzl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ Rerun with --toolchain_resolution_debug='@bazel_tools//tools/jdk:bootstrap_runti
231231
input = unstripped_bootclasspath,
232232
output = bootclasspath,
233233
)
234-
234+
bootclasspath = bootclasspath if ctx.attr.strip else unstripped_bootclasspath
235235
return [
236236
DefaultInfo(files = depset([bootclasspath])),
237237
java_common.BootClassPathInfo(
@@ -256,6 +256,7 @@ _bootclasspath = rule(
256256
cfg = "exec",
257257
allow_single_file = True,
258258
),
259+
"strip": attr.bool(default = True),
259260
"_allowlist_function_transition": attr.label(
260261
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
261262
),

toolchains/default_java_toolchain.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ NONPREBUILT_TOOLCHAIN_CONFIGURATION = dict(
143143
singlejar = [Label("@remote_java_tools//:singlejar_cc_bin")],
144144
header_compiler_direct = [Label("@remote_java_tools//:TurbineDirect")],
145145
oneversion = Label("@remote_java_tools//:one_version_cc_bin"),
146+
bootclasspath = [Label("//toolchains:platformclasspath_unstripped")],
146147
)
147148

148149
def default_java_toolchain(name, configuration = DEFAULT_TOOLCHAIN_CONFIGURATION, toolchain_definition = True, exec_compatible_with = [], target_compatible_with = [], **kwargs):

0 commit comments

Comments
 (0)