Add java tools sources archive.
diff --git a/third_party/BUILD b/third_party/BUILD
index c0a57bb..8718919 100644
--- a/third_party/BUILD
+++ b/third_party/BUILD
@@ -1,5 +1,7 @@
package(default_visibility = ["//visibility:public"])
+load("//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
+
filegroup(
name = "srcs",
srcs = glob(["**"]) + [
@@ -603,6 +605,28 @@
],
)
+pkg_tar(
+ name = "java_tools_pkg",
+ srcs = [
+ "//third_party/java/java_tools:java_tools",
+ "//third_party/java/jdk/langtools:javac_jar",
+ "//third_party/java/jdk/langtools:jdk_compiler_jar",
+ "//third_party/java/jdk/langtools:java_compiler_jar"
+ ],
+)
+
+pkg_tar(
+ name = "java_tools_pkg-gz",
+ srcs = [
+ "//third_party/java/java_tools:java_tools",
+ "//third_party/java/jdk/langtools:javac_jar",
+ "//third_party/java/jdk/langtools:jdk_compiler_jar",
+ "//third_party/java/jdk/langtools:java_compiler_jar"
+ ],
+ extension = "tar.gz"
+)
+
+
load(":compiler_config_setting.bzl", "create_compiler_config_setting")
create_compiler_config_setting(
diff --git a/third_party/java/java_tools/BUILD.pkg b/third_party/java/java_tools/BUILD.pkg
index b5d71e8..5d7bbc0 100644
--- a/third_party/java/java_tools/BUILD.pkg
+++ b/third_party/java/java_tools/BUILD.pkg
@@ -66,3 +66,4 @@
name = "java_compiler_jar",
srcs = ["java_compiler.jar"],
)
+
diff --git a/third_party/java/java_tools/README.md b/third_party/java/java_tools/README.md
deleted file mode 100644
index fd029df..0000000
--- a/third_party/java/java_tools/README.md
+++ /dev/null
@@ -1,40 +0,0 @@
-# Tools required by the Bazel rules for Java.
-
-To see how to update the tools run:
-
-```
-./third_party/java/java_tools/update_java_tools.sh help
-```
-
-The following tools were built with bazel 0.21.0 at commit 252c82cd135f1bcdadfc961c127895e9b2347b77
-
-third_party/java/java_tools/JavaBuilder_deploy.jar
-third_party/java/java_tools/VanillaJavaBuilder_deploy.jar
-third_party/java/java_tools/GenClass_deploy.jar
-third_party/java/java_tools/Runner_deploy.jar
-third_party/java/java_tools/ExperimentalRunner_deploy.jar
-third_party/java/java_tools/JacocoCoverage_jarjar_deploy.jar
-third_party/java/java_tools/turbine_deploy.jar
-third_party/java/java_tools/turbine_direct_binary_deploy.jar
-third_party/java/java_tools/SingleJar_deploy.jar
-
-The following tools were built with bazel 0.21.0 at commit 019f13b64630ea7e7837a2ed8b664c4262322b1c by running:
-$ third_party/java/java_tools/update_java_tools.sh
-
-third_party/java/java_tools/jarjar_command_deploy.jar
-
-The following tools were built with bazel 0.22.0 at commit ee1107a6ada146666f50aa7e834e9f954153de32
-by running:
-$ third_party/java/java_tools/update_java_tools.sh
-
-third_party/java/java_tools/turbine_deploy.jar
-third_party/java/java_tools/ExperimentalRunner_deploy.jar
-third_party/java/java_tools/bazel-singlejar_deploy.jar
-third_party/java/java_tools/GenClass_deploy.jar
-third_party/java/java_tools/VanillaJavaBuilder_deploy.jar
-third_party/java/java_tools/JacocoCoverage_jarjar_deploy.jar
-third_party/java/java_tools/turbine_direct_binary_deploy.jar
-third_party/java/java_tools/JavaBuilder_deploy.jar
-third_party/java/java_tools/jarjar_command_deploy.jar
-third_party/java/java_tools/Runner_deploy.jar
-
diff --git a/third_party/java/java_tools/java_tools-srcs.zip b/third_party/java/java_tools/java_tools-srcs.zip
new file mode 100644
index 0000000..2de937d
--- /dev/null
+++ b/third_party/java/java_tools/java_tools-srcs.zip
Binary files differ
diff --git a/third_party/java/java_tools/update_java_tools.sh b/third_party/java/java_tools/update_java_tools.sh
index 50be12f..7665ab5 100755
--- a/third_party/java/java_tools/update_java_tools.sh
+++ b/third_party/java/java_tools/update_java_tools.sh
@@ -4,7 +4,7 @@
# by the Java rules in Bazel.
#
# For usage please run
-# ~/third_party/java/java_tools/update_java_tools.sh help
+# third_party/java/java_tools/update_java_tools.sh help
# Maps the java tool names to their associated bazel target.
declare -A tool_name_to_target=(["JavaBuilder"]="src/java_tools/buildjar:JavaBuilder_deploy.jar" \
@@ -22,7 +22,12 @@
"used by the Java rules in Bazel.
To update all the tools simultaneously run from your bazel workspace root:
-~/third_party/java/java_tools/update_java_tools.sh
+third_party/java/java_tools/update_java_tools.sh
+
+WARNING: This script also allows updating individual tools, but it is not recommended
+to do so, because it involves creating the sources archive manually from
+different commits in bazel. Prefer to update all the tools, even though you
+only target one of them.
To update only one or one subset of the tools run
third_party/java/java_tools/update_java_tools.sh tool_1 tool_2 ... tool_n
@@ -43,19 +48,33 @@
# Stores the names of the tools required for update.
tools_to_update=()
-if [[ ! -z "$@" ]]
-then
- # Update only the tools specified on the command line.
- tools_to_update=("$@")
-else
- # If no tools were specified update all of them.
- tools_to_update=(${!tool_name_to_target[*]})
-fi
# Stores the workspace relative path of all the tools that were updated
# (e.g. third_party/java/java_tools/JavaBuilder_deploy.jar)
updated_tools=()
+if [[ ! -z "$@" ]]
+then
+ # Update only the tools specified on the command line.
+ tools_to_update=("$@")
+ echo "The sources archive was NOT created. Please create it manually!"
+else
+ # If no tools were specified update all of them.
+ tools_to_update=(${!tool_name_to_target[*]})
+ # Create the sources archive only when all the tools were updated.
+ # TODO(iirina): Find another archiving method that is reproducible
+ # (e.g. doesn't include timestamps).
+ zip -Xr third_party/java/java_tools/java_tools-srcs.zip src/java_tools/buildjar/* \
+ src/java_tools/junitrunner/* src/java_tools/singlejar/* third_party/jarjar/* \
+ third_party/java/jdk/langtools/LICENSE \
+ third_party/java/jdk/langtools/java_compiler-src.jar \
+ third_party/java/jdk/langtools/javac-9+181-r4173-1.srcjar \
+ third_party/java/jdk/langtools/jdk_compiler-src.jar \
+ echo "Created sources archive third_party/java/java_tools/java_tools-srcs.zip"
+ updated_tools+=("third_party/java/java_tools/java_tools-srcs.zip")
+fi
+
+
# Updates the tool with the given bazel target.
#
# Builds the given bazel target and copies the generated binary
@@ -106,6 +125,8 @@
$ third_party/java/java_tools/update_java_tools.sh $@
$( IFS=$'\n'; echo "${updated_tools[*]}" )
-
EOL
+
+echo "IMPORTANT: Make sure that third_party/java/java_tools/java_tools-srcs.zip was created \
+or create it manually!"
fi