Skip to content

Commit

Permalink
Move jarjar to a checked in deploy jar.
Browse files Browse the repository at this point in the history
instead of embedding the deploy jar that is built when the bazel binary is built.

This comes in preparation for moving the Java tools to remote repositories (see #6316). This checked in jar will be moved to a remote repository and referenced from there.

Moving the Java tools happens in two phases:

Using checked-in deploy jars/binaries instead of those built when bazel was built
Moving the checked-in jars/binaries to a remote repository and make bazel reference them from there.
This PR addresses the first point for `JarJar`. Doing the move incrementally this way is safer and allows finding bugs earlier. It also allows moving the Java tools code base out of the bazel repository.

We are making this change gradually for each java tool defined in JAVA_TOOLS (found in src/BUILD).

Closes #7143.

PiperOrigin-RevId: 229548071
  • Loading branch information
iirina authored and Copybara-Service committed Jan 16, 2019
1 parent 81949cd commit 5bd5543
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ py_binary(
# The tools Bazel uses to compile Java.
# TODO(#6316): Gradually remove the targets here.
JAVA_TOOLS = [
"//third_party/jarjar:embedded_tools_srcs",
"//third_party/java/jdk/langtools:test-srcs",
"//third_party/java/proguard:embedded_tools",
"//src/java_tools/buildjar/java/com/google/devtools/build/buildjar/jarhelper:srcs",
Expand Down
2 changes: 2 additions & 0 deletions src/create_embedded_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
('*tools/cpp/runfiles/generated_*',
lambda x: 'tools/cpp/runfiles/' + os.path.basename(x)[len('generated_'):]),
('*JavaBuilder*_deploy.jar', lambda x: 'tools/jdk/' + os.path.basename(x)),
('*jarjar_command_deploy.jar',
lambda x: 'tools/jdk/jarjar_command_deploy.jar'),
('*JacocoCoverage*_deploy.jar',
lambda x: 'tools/jdk/JacocoCoverage_deploy.jar'),
('*turbine_deploy.jar', lambda x: 'tools/jdk/turbine_deploy.jar'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ genrule(
outs = ["JacocoCoverage_jarjar_deploy.jar"],
cmd = "\n".join([
"JARJAR=\"$$(mktemp -t bazel.XXXXXXXX)\"",
"\"$(JAVA)\" -jar \"$(location //third_party/jarjar:jarjar_bin_deploy.jar)\" process \"$(location :JacocoCoverage.jarjar)\" \"$(location :JacocoCoverage_deploy.jar)\" \"$${JARJAR}\"",
"\"$(JAVA)\" -jar \"$(location //third_party/jarjar:jarjar_command_deploy.jar)\" process \"$(location :JacocoCoverage.jarjar)\" \"$(location :JacocoCoverage_deploy.jar)\" \"$${JARJAR}\"",
"\"$(JAVA)\" -jar \"$(location //src/java_tools/singlejar:SingleJar_deploy.jar)\" --normalize --sources \"$${JARJAR}\" --output \"$@\"",
"rm -fr \"$${JARJAR}\"",
]),
tags = ["manual"],
toolchains = ["@bazel_tools//tools/jdk:current_host_java_runtime"],
tools = [
"//src/java_tools/singlejar:SingleJar_deploy.jar",
"//third_party/jarjar:jarjar_bin_deploy.jar",
"//third_party/jarjar:jarjar_command_deploy.jar",
"@bazel_tools//tools/jdk:current_host_java_runtime",
],
)
5 changes: 5 additions & 0 deletions tools/jdk/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ java_import(
jars = [":JacocoCoverage_deploy.jar"],
)

java_import(
name = "JarJar",
jars = [":jarjar_command_deploy.jar"],
)

test_suite(
name = "windows_tests",
tags = [
Expand Down

0 comments on commit 5bd5543

Please sign in to comment.