From 693c88a8f897b6764b98c7d9da922ffc96c6d890 Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Fri, 31 Jul 2020 22:55:47 -0700 Subject: [PATCH] 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 --- WORKSPACE | 33 +++++++++++++++++++ src/BUILD | 3 ++ src/test/shell/bazel/BUILD | 5 +-- .../shell/bazel/testdata/jdk_http_archives | 26 +++++++++++++++ src/test/shell/testenv.sh | 3 ++ 5 files changed, 66 insertions(+), 4 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 41c2c72540a235..776efeaf7b325f 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -882,6 +882,39 @@ http_archive( ], ) +# 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", diff --git a/src/BUILD b/src/BUILD index b9351dcab4d731..22e747269a0a83 100644 --- a/src/BUILD +++ b/src/BUILD @@ -760,6 +760,9 @@ filegroup( "@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 e81f8bac5c9b92..9eae0eda3ef48c 100644 --- a/src/test/shell/bazel/BUILD +++ b/src/test/shell/bazel/BUILD @@ -222,9 +222,6 @@ sh_test( 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 @@ sh_test( "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 1618193264770a..fe2671a3e0ba5e 100644 --- a/src/test/shell/bazel/testdata/jdk_http_archives +++ b/src/test/shell/bazel/testdata/jdk_http_archives @@ -50,6 +50,32 @@ http_archive( 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 a1cbb9d4a24afa..a48de5e852324a 100755 --- a/src/test/shell/testenv.sh +++ b/src/test/shell/testenv.sh @@ -292,6 +292,9 @@ EOF "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"