Separate java_tools into platform independent and prebuilt part.
java_tools is repository package containing tools needed during Java compilation: JavaBuilder, patches for Java compiler, ijar, singlejar, ...
Most of the files are jars with Java classes. java_tools are released for three platforms: linux, windows and darwin, however the only difference is in two binaries: ijar and singlejar.
This is part one of splitting java_tools and releasing split version (following PR makes use of released split version in Bazel)
Java_tools used to be released for multiple Java versions, but all the releases were the same except a some string substitutions in BUILD file. I changed to build only a single version, since it already supports Java from 8 to 14.
Changes:
- BUILD.java_tools is split into BUILD.java_tools_prebuilt (where the second contains prebuilt binaries)
- toolchain definitions are removed from BUILD.java_tools and will be added to tools/jdk/BUILD in the second part
- java_toolchain_default.bzl.java_tools is removed (default_java_toolchain.bzl will be updated with its features in the second part).
- src/BUILD: JAVA_VERSION is removed, targets used to build java_tools.zip are duplicated to build java_tools_prebuilt.zip (done some cleanup as well)
- upload_all_java_tools.sh and upload_java_tools.sh: used by Build kite, I removed java_version over the release, but kept it over tests (for different JDKs)
- create_java_tools_release.sh: used by the user in the release process - added platform independent part
- tests are updated to use platform independent and platform files, some tests had to be disabled and will be reenabled after the release
Closes #12546.
PiperOrigin-RevId: 344319092
diff --git a/src/upload_java_tools.sh b/src/upload_java_tools.sh
index 4e21358..2dee86c 100755
--- a/src/upload_java_tools.sh
+++ b/src/upload_java_tools.sh
@@ -20,8 +20,7 @@
# Mandatory flags:
# --java_tools_zip The workspace-relative path of a java_tools zip.
# --gcs_java_tools_dir The directory under bazel_java_tools on GCS where the zip is uploaded.
-# --java_version The version of the javac the given zip embeds.
-# --platform The name of the platform where the zip was built.
+# --platform Optional: The name of the platform where the zip was built. (If empty the zip should be platform independent).
set -euo pipefail
@@ -67,7 +66,6 @@
case "$arg" in
"--java_tools_zip") java_tools_zip_name="$val" ;;
"--gcs_java_tools_dir") gcs_java_tools_dir="$val" ;;
- "--java_version") java_version="$val" ;;
"--platform") platform="$val" ;;
"--commit_hash") commit_hash="$val" ;;
"--timestamp") timestamp="$val" ;;
@@ -77,6 +75,7 @@
done
java_tools_zip=$(rlocation io_bazel/${java_tools_zip_name})
+platform=${platform:+"_"}${platform:-}
# Create a temp directory and a writable temp zip file to add a README.md file to
# the initial zip.
@@ -98,14 +97,14 @@
$ git clone https://github.com/bazelbuild/bazel.git
$ git checkout ${commit_hash}
-$ bazel build //src:java_tools_java${java_version}.zip
+$ bazel build //src:java_tools_prebuilt.zip
EOF
# Add the README.md file to the temp zip.
zip -rv "${tmp_zip}" "${readme_file}"
gsutil_cmd="gsutil"
-if [[ "$platform" == "windows" ]]; then
+if "$is_windows"; then
gsutil_cmd="gsutil.cmd"
fi
@@ -119,4 +118,4 @@
# Upload the zip that contains the README.md to GCS.
"$gsutil_cmd" cp "$zip_url" \
- "gs://bazel-mirror/bazel_java_tools/${gcs_java_tools_dir}/${commit_hash}/java${java_version}/java_tools_javac${java_version}_${platform}-${timestamp}.zip"
+ "gs://bazel-mirror/bazel_java_tools/${gcs_java_tools_dir}/${commit_hash}/java/java_tools${platform}-${timestamp}.zip"