Add unit test against released java_tools_javac14
Closes #11017.
This is the follow-up for PR: [1]. Because of the chicken and the egg
problem, it has to be done in three steps:
1. add support for java toolchange JDK 14, done in: [1]
2. publish new java_tools_javac14, kicked off by the pipeline in
java_tools repository, in context of: [2]
3. add unit test against released java_tools_javac14 published in step 2,
this change
Test Plan:
$ bazel test //src/test/shell/bazel:bazel_coverage_java_jdk14toolchain_released_test
[1] https://github.com/bazelbuild/bazel/pull/11514
[2] https://github.com/bazelbuild/java_tools/issues/28
Closes #11828.
PiperOrigin-RevId: 324358602
diff --git a/WORKSPACE b/WORKSPACE
index 41c2c72..776efea 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -884,6 +884,39 @@
# This must be kept in sync with src/test/shell/bazel/testdata/jdk_http_archives.
http_archive(
+ name = "remote_java_tools_javac14_test_linux",
+ patch_cmds = EXPORT_WORKSPACE_IN_BUILD_FILE,
+ patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_FILE_WIN,
+ sha256 = "196128eadc68a55fb42a1f990c84ee816f5b29320a72fe542fcfc4206ac3978a",
+ urls = [
+ "https://mirror.bazel.build/bazel_java_tools/releases/javac14/v1.0/java_tools_javac14_linux-v1.0.zip",
+ ],
+)
+
+# This must be kept in sync with src/test/shell/bazel/testdata/jdk_http_archives.
+http_archive(
+ name = "remote_java_tools_javac14_test_windows",
+ patch_cmds = EXPORT_WORKSPACE_IN_BUILD_FILE,
+ patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_FILE_WIN,
+ sha256 = "a6c69fd89b87fccc4c75203be6b407a1ca22cbdb54cffbd445f874281a933149",
+ urls = [
+ "https://mirror.bazel.build/bazel_java_tools/releases/javac14/v1.0/java_tools_javac14_windows-v1.0.zip",
+ ],
+)
+
+# This must be kept in sync with src/test/shell/bazel/testdata/jdk_http_archives.
+http_archive(
+ name = "remote_java_tools_javac14_test_darwin",
+ patch_cmds = EXPORT_WORKSPACE_IN_BUILD_FILE,
+ patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_FILE_WIN,
+ sha256 = "e20f002ceb3f3353d64c022e1f3400d8539ee56ffcfd4a6680d73d6a2cac938b",
+ urls = [
+ "https://mirror.bazel.build/bazel_java_tools/releases/javac14/v1.0/java_tools_javac14_darwin-v1.0.zip",
+ ],
+)
+
+# This must be kept in sync with src/test/shell/bazel/testdata/jdk_http_archives.
+http_archive(
name = "openjdk11_linux_archive",
build_file_content = """
java_runtime(name = 'runtime', srcs = glob(['**']), visibility = ['//visibility:public'])
diff --git a/src/BUILD b/src/BUILD
index b9351dc..22e7472 100644
--- a/src/BUILD
+++ b/src/BUILD
@@ -760,6 +760,9 @@
"@remote_java_tools_javac11_test_darwin//:WORKSPACE",
"@remote_java_tools_javac11_test_linux//:WORKSPACE",
"@remote_java_tools_javac11_test_windows//:WORKSPACE",
+ "@remote_java_tools_javac14_test_darwin//:WORKSPACE",
+ "@remote_java_tools_javac14_test_linux//:WORKSPACE",
+ "@remote_java_tools_javac14_test_windows//:WORKSPACE",
"@remote_java_tools_linux_for_testing//:WORKSPACE",
"@remote_java_tools_windows_for_testing//:WORKSPACE",
"@remotejdk11_linux_aarch64_for_testing//:WORKSPACE",
diff --git a/src/test/shell/bazel/BUILD b/src/test/shell/bazel/BUILD
index e81f8ba..9eae0ed 100644
--- a/src/test/shell/bazel/BUILD
+++ b/src/test/shell/bazel/BUILD
@@ -222,9 +222,6 @@
JAVA_VERSIONS = ("11", "14")
-# TODO(davido): Remove this once remote_java_tools_javac14 is released
-JAVA_TOOLS_VERSIONS = ("11",)
-
[
sh_test(
name = "bazel_java_test_jdk" + java_version + "_toolchain_head",
@@ -494,7 +491,7 @@
"no_windows",
],
)
- for java_version in JAVA_TOOLS_VERSIONS
+ for java_version in JAVA_VERSIONS
]
# Test java coverage with the java_toolchain in the java_tools zip built at head.
diff --git a/src/test/shell/bazel/testdata/jdk_http_archives b/src/test/shell/bazel/testdata/jdk_http_archives
index 1618193..fe2671a 100644
--- a/src/test/shell/bazel/testdata/jdk_http_archives
+++ b/src/test/shell/bazel/testdata/jdk_http_archives
@@ -50,6 +50,32 @@
urls = ["https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-win_x64.zip"],
)
+################### Remote java_tools with embedded javac 14 ###################
+# This must be kept in sync with the top-level WORKSPACE file.
+http_archive(
+ name = "remote_java_tools_javac14_test_linux",
+ sha256 = "196128eadc68a55fb42a1f990c84ee816f5b29320a72fe542fcfc4206ac3978a",
+ urls = [
+ "https://mirror.bazel.build/bazel_java_tools/releases/javac14/v1.0/java_tools_javac14_linux-v1.0.zip",
+ ],
+)
+# This must be kept in sync with the top-level WORKSPACE file.
+http_archive(
+ name = "remote_java_tools_javac14_test_windows",
+ sha256 = "a6c69fd89b87fccc4c75203be6b407a1ca22cbdb54cffbd445f874281a933149",
+ urls = [
+ "https://mirror.bazel.build/bazel_java_tools/releases/javac14/v1.0/java_tools_javac14_windows-v1.0.zip",
+ ],
+)
+# This must be kept in sync with the top-level WORKSPACE file.
+http_archive(
+ name = "remote_java_tools_javac14_test_darwin",
+ sha256 = "e20f002ceb3f3353d64c022e1f3400d8539ee56ffcfd4a6680d73d6a2cac938b",
+ urls = [
+ "https://mirror.bazel.build/bazel_java_tools/releases/javac14/v1.0/java_tools_javac14_darwin-v1.0.zip",
+ ],
+)
+
#################################### JDK 14 ####################################
# This must be kept in sync with the top-level WORKSPACE file.
http_archive(
diff --git a/src/test/shell/testenv.sh b/src/test/shell/testenv.sh
index a1cbb9d..a48de5e 100755
--- a/src/test/shell/testenv.sh
+++ b/src/test/shell/testenv.sh
@@ -292,6 +292,9 @@
"remote_java_tools_javac11_test_darwin"
"remote_java_tools_javac11_test_linux"
"remote_java_tools_javac11_test_windows"
+ "remote_java_tools_javac14_test_darwin"
+ "remote_java_tools_javac14_test_linux"
+ "remote_java_tools_javac14_test_windows"
"remote_java_tools_linux_for_testing"
"remote_java_tools_windows_for_testing"
"remotejdk11_linux_for_testing"