Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion 6 test/check_remote_java_tools_configs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ function download_and_check_hash() {
TMP_FILE=$(mktemp -q /tmp/remotejavatools.XXXXXX)
echo "fetching $name from $url to ${TMP_FILE}"
curl --silent -o ${TMP_FILE} -L "$url"
actual_hash=`sha256sum ${TMP_FILE} | cut -d' ' -f1`
if command -v sha256sum &> /dev/null; then
actual_hash=`sha256sum ${TMP_FILE} | cut -d' ' -f1`
else
actual_hash=`shasum -a 256 ${TMP_FILE} | cut -d' ' -f1`
fi
if [ "${hash}" != "${actual_hash}" ]; then
echo "ERROR: wrong hash for ${name}! wanted: ${hash}, got: ${actual_hash}"
exit 1
Expand Down
64 changes: 38 additions & 26 deletions 64 toolchains/bootclasspath.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -129,29 +129,35 @@ def _bootclasspath_impl(ctx):
exec_javabase = ctx.attr.java_runtime_alias[java_common.JavaRuntimeInfo]
env = ctx.attr._utf8_environment[Utf8EnvironmentInfo].environment

class_dir = ctx.actions.declare_directory("%s_classes" % ctx.label.name)

args = ctx.actions.args()
args.add("-source")
args.add("8")
args.add("-target")
args.add("8")
args.add("-Xlint:-options")
args.add("-J-XX:-UsePerfData")
args.add("-d")
args.add_all([class_dir], expand_directories = False)
args.add(ctx.file.src)

ctx.actions.run(
executable = "%s/bin/javac" % exec_javabase.java_home,
mnemonic = "JavaToolchainCompileClasses",
inputs = [ctx.file.src] + ctx.files.java_runtime_alias,
outputs = [class_dir],
arguments = [args],
env = env,
execution_requirements = _SUPPORTS_PATH_MAPPING,
use_default_shell_env = True,
)
# If possible, use JDK 11+'s ability to run a single Java file to avoid a
# separate action to compile DumpPlatformClassPath.
use_source_launcher = exec_javabase.version >= 11

class_dir = None
if not use_source_launcher:
class_dir = ctx.actions.declare_directory("%s_classes" % ctx.label.name)

args = ctx.actions.args()
args.add("-source")
args.add("8")
args.add("-target")
args.add("8")
args.add("-Xlint:-options")
args.add("-J-XX:-UsePerfData")
args.add("-d")
args.add_all([class_dir], expand_directories = False)
args.add(ctx.file.src)

ctx.actions.run(
executable = "%s/bin/javac" % exec_javabase.java_home,
mnemonic = "JavaToolchainCompileClasses",
inputs = [ctx.file.src] + ctx.files.java_runtime_alias,
outputs = [class_dir],
arguments = [args],
env = env,
execution_requirements = _SUPPORTS_PATH_MAPPING,
use_default_shell_env = True,
)

unstripped_bootclasspath = ctx.actions.declare_file("%s_unstripped.jar" % ctx.label.name)

Expand All @@ -161,8 +167,13 @@ def _bootclasspath_impl(ctx):
args.add("--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED")
args.add("--add-exports=jdk.compiler/com.sun.tools.javac.platform=ALL-UNNAMED")
args.add("--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED")
args.add_all("-cp", [class_dir], expand_directories = False)
args.add("DumpPlatformClassPath")

if use_source_launcher:
args.add(ctx.file.src)
else:
args.add_all("-cp", [class_dir], expand_directories = False)
args.add("DumpPlatformClassPath")

args.add(unstripped_bootclasspath)

if ctx.attr.language_version_bootstrap_runtime:
Expand Down Expand Up @@ -211,7 +222,8 @@ Rerun with --toolchain_resolution_debug='@bazel_tools//tools/jdk:bootstrap_runti
if len(system) != len(system_files):
system = None

inputs = depset([class_dir] + ctx.files.java_runtime_alias, transitive = [any_javabase.files])
classpath_input = ctx.file.src if use_source_launcher else class_dir
inputs = depset([classpath_input] + ctx.files.java_runtime_alias, transitive = [any_javabase.files])
ctx.actions.run(
executable = str(exec_javabase.java_executable_exec_path),
mnemonic = "JavaToolchainCompileBootClasspath",
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.