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_all_java_tools.sh b/src/upload_all_java_tools.sh
index f40004b..e8ef359 100755
--- a/src/upload_all_java_tools.sh
+++ b/src/upload_all_java_tools.sh
@@ -30,14 +30,19 @@
case "$(uname -s | tr [:upper:] [:lower:])" in
msys*|mingw*|cygwin*)
- declare -r is_windows=true
+ declare -r platform=windows
+ ;;
+linux*)
+ declare -r platform=linux
;;
*)
- declare -r is_windows=false
+ declare -r platform=other
;;
esac
-if "$is_windows"; then
+echo Platform: $platform
+
+if [[ "$platform" == "windows" ]]; then
export MSYS_NO_PATHCONV=1
export MSYS2_ARG_CONV_EXCL="*"
fi
@@ -48,35 +53,47 @@
# Passing the same commit_hash and timestamp to all targets to mark all the artifacts
# uploaded on GCS with the same identifier.
-for java_version in 11; do
- bazel build //src:java_tools_java${java_version}_zip
- zip_path=${PWD}/bazel-bin/src/java_tools_java${java_version}.zip
+bazel build //src:java_tools_zip
+zip_path=${PWD}/bazel-bin/src/java_tools.zip
- if "$is_windows"; then
- # Windows needs "file:///c:/foo/bar".
- file_url="file:///$(cygpath -m ${zip_path})"
- else
- # Non-Windows needs "file:///foo/bar".
- file_url="file://${zip_path}"
- fi
+bazel build //src:java_tools_prebuilt_zip
+prebuilt_zip_path=${PWD}/bazel-bin/src/java_tools_prebuilt.zip
- # Skip for now, as the test is broken on Windows.
- # See https://github.com/bazelbuild/bazel/issues/12244 for details
- if not "$is_windows"; then
+if [[ "$platform" == "windows" ]]; then
+ # Windows needs "file:///c:/foo/bar".
+ file_url="file:///$(cygpath -m ${zip_path})"
+ prebuilt_file_url="file:///$(cygpath -m ${prebuilt_zip_path})"
+else
+ # Non-Windows needs "file:///foo/bar".
+ file_url="file://${zip_path}"
+ prebuilt_file_url="file://${prebuilt_zip_path}"
+fi
+
+# Skip for now, as the test is broken on Windows.
+# See https://github.com/bazelbuild/bazel/issues/12244 for details
+if [[ "$platform" != "windows" ]]; then
+ for java_version in 11 14 15; do
bazel test --verbose_failures --test_output=all --nocache_test_results \
//src/test/shell/bazel:bazel_java_test_local_java_tools_jdk${java_version} \
- --define=LOCAL_JAVA_TOOLS_ZIP_URL="${file_url}"
- fi
+ --define=LOCAL_JAVA_TOOLS_ZIP_URL="${file_url}" \
+ --define=LOCAL_JAVA_TOOLS_PREBUILT_ZIP_URL="${prebuilt_file_url}"
+ done
+fi
- bazel run //src:upload_java_tools_java${java_version} -- \
- --java_tools_zip src/java_tools_java${java_version}.zip \
+bazel run //src:upload_java_tools_prebuilt -- \
+ --commit_hash ${commit_hash} \
+ --timestamp ${timestamp} \
+ --bazel_version ${bazel_version}
+
+if [[ "$platform" == "linux" ]]; then
+ bazel run //src:upload_java_tools -- \
--commit_hash ${commit_hash} \
--timestamp ${timestamp} \
--bazel_version ${bazel_version}
- bazel run //src:upload_java_tools_dist_java${java_version} -- \
+ bazel run //src:upload_java_tools_dist -- \
--commit_hash ${commit_hash} \
--timestamp ${timestamp} \
--bazel_version ${bazel_version}
-done
+fi