Skip to content

Commit

Permalink
Add supplemental support for JDK 11, 17 and 19 on cpu s390x
Browse files Browse the repository at this point in the history
Recent releases of Bazel have already supported JDK 11 and 17 on cpu s390x. This PR aims to add support for JDK 18 and supplement the support for JDK 11 and 17 on cpu s390x.

The code changes have been verified on s390x and won't cause any regressions on other archs.

Fixes #17381 .

commit 19b2e2f has replaced JDK 18 with JDK 19, so this PR was updated as well to add support for JDK 19 on s390x.

Signed-off-by: Kun-Lu <[email protected]>

Closes #17382.

PiperOrigin-RevId: 513741650
Change-Id: I0c5d8406900b0568e95f4f471d66fe9ad1dab57c
  • Loading branch information
kun-lu20 authored and copybara-github committed Mar 3, 2023
1 parent 055eb8f commit 66f571e
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 7 deletions.
13 changes: 11 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ dist_http_archive(
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_BAZEL_FILE_WIN,
)
for version in ("17", "19")
for os in ("linux", "macos", "macos_aarch64", "win") + (("win_arm64",) if version != "19" else ())
for os in ("linux", "linux_s390x", "macos", "macos_aarch64", "win") + (("win_arm64",) if version != "19" else ())
]

# Used in src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.
Expand Down Expand Up @@ -471,6 +471,15 @@ exports_files(["WORKSPACE"], visibility = ["//visibility:public"])
""",
)

# This must be kept in sync with src/test/shell/bazel/testdata/jdk_http_archives.
dist_http_archive(
name = "openjdk11_linux_s390x_archive",
build_file_content = """
java_runtime(name = 'runtime', srcs = glob(['**']), visibility = ['//visibility:public'])
exports_files(["WORKSPACE"], visibility = ["//visibility:public"])
""",
)

# This must be kept in sync with src/test/shell/bazel/testdata/jdk_http_archives.
dist_http_archive(
name = "openjdk11_darwin_archive",
Expand Down Expand Up @@ -517,7 +526,7 @@ exports_files(["WORKSPACE"], visibility = ["//visibility:public"])
""",
)
for version in ("17", "19")
for os in ("linux", "darwin", "darwin_aarch64", "windows") + (("windows_arm64",) if version != "19" else ())
for os in ("linux", "linux_s390x", "darwin", "darwin_aarch64", "windows") + (("windows_arm64",) if version != "19" else ())
]

load("@io_bazel_skydoc//:setup.bzl", "stardoc_repositories")
Expand Down
15 changes: 15 additions & 0 deletions distdir_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ DIST_DEPS = {
"remotejdk11_linux_s390x": {
"aliases": [
"remotejdk11_linux_s390x_for_testing",
"openjdk11_linux_s390x_archive",
],
"sha256": "a58fc0361966af0a5d5a31a2d8a208e3c9bb0f54f345596fd80b99ea9a39788b",
"strip_prefix": "jdk-11.0.15+10",
Expand Down Expand Up @@ -606,6 +607,7 @@ DIST_DEPS = {
"remotejdk17_linux_s390x": {
"aliases": [
"remotejdk17_linux_s390x_for_testing",
"openjdk17_linux_s390x_archive",
"openjdk_linux_s390x_vanilla",
],
"archive": "OpenJDK17U-jdk_s390x_linux_hotspot_17.0.4.1_1.tar.gz",
Expand Down Expand Up @@ -701,6 +703,19 @@ DIST_DEPS = {
],
"used_in": ["test_WORKSPACE_files"],
},
"remotejdk19_linux_s390x": {
"aliases": [
"remotejdk19_linux_s390x_for_testing",
"openjdk19_linux_s390x_archive",
],
"archive": "OpenJDK19U-jdk_s390x_linux_hotspot_19.0.2_7.tar.gz",
"sha256": "f2512f9a8e9847dd5d3557c39b485a8e7a1ef37b601dcbcb748d22e49f44815c",
"strip_prefix": "jdk-19.0.2+7",
"urls": [
"https://github.com/adoptium/temurin19-binaries/releases/download/jdk-19.0.2%2B7/OpenJDK19U-jdk_s390x_linux_hotspot_19.0.2_7.tar.gz",
],
"used_in": ["test_WORKSPACE_files"],
},
"remotejdk19_linux": {
"aliases": [
"remotejdk19_linux_for_testing",
Expand Down
4 changes: 2 additions & 2 deletions src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -589,10 +589,10 @@ filegroup(
] + [
"@openjdk%s_%s_archive//:WORKSPACE" % (version, os)
for version in ("17", "19")
for os in ("darwin", "darwin_aarch64", "linux", "windows") + (("windows_arm64",) if version != "19" else ())
for os in ("darwin", "darwin_aarch64", "linux", "linux_s390x", "windows") + (("windows_arm64",) if version != "19" else ())
] + [
"@remotejdk%s_%s_for_testing//:WORKSPACE" % (version, os)
for version in ("17", "19")
for os in ("macos", "macos_aarch64", "linux", "win") + (("win_arm64",) if version != "19" else ())
for os in ("macos", "macos_aarch64", "linux", "linux_s390x", "win") + (("win_arm64",) if version != "19" else ())
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ gen_workspace_stanza(
] + [
"remotejdk%s_%s" % (version, os)
for version in ("17", "19")
for os in ("macos", "macos_aarch64", "linux", "linux_aarch64", "win") + (("win_arm64",) if version != "19" else ())
for os in ("macos", "macos_aarch64", "linux", "linux_aarch64", "linux_s390x", "win") + (("win_arm64",) if version != "19" else ())
],
template = "jdk.WORKSPACE.tmpl",
visibility = ["//:__pkg__"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,17 @@ maybe(
version = "17",
)

# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
{remotejdk17_linux_s390x}
target_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:s390x",
],
version = "17",
)

# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
Expand Down Expand Up @@ -192,6 +203,17 @@ maybe(
version = "19",
)

# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
{remotejdk19_linux_s390x}
target_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:s390x",
],
version = "19",
)

# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
Expand Down
2 changes: 2 additions & 0 deletions src/test/py/bazel/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@ class TestBase(unittest.TestCase):
'remotejdk11_win_for_testing',
'remotejdk11_win_arm64_for_testing',
'remotejdk17_linux_for_testing',
'remotejdk17_linux_s390x_for_testing',
'remotejdk17_macos_for_testing',
'remotejdk17_macos_aarch64_for_testing',
'remotejdk17_win_for_testing',
'remotejdk17_win_arm64_for_testing',
'remotejdk19_linux_for_testing',
'remotejdk19_linux_s390x_for_testing',
'remotejdk19_macos_for_testing',
'remotejdk19_macos_aarch64_for_testing',
'remotejdk19_win_for_testing',
Expand Down
3 changes: 2 additions & 1 deletion src/test/shell/bazel/testdata/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,15 @@ gen_workspace_stanza(
"remote_java_tools_test_windows",
"remote_java_tools_test_darwin",
"openjdk11_linux_archive",
"openjdk11_linux_s390x_archive",
"openjdk11_darwin_archive",
"openjdk11_darwin_aarch64_archive",
"openjdk11_windows_archive",
"openjdk11_windows_arm64_archive",
] + [
"openjdk%s_%s_archive" % (version, os)
for version in ("17", "19")
for os in ("linux", "darwin", "darwin_aarch64", "windows") + (("windows_arm64",) if version != "19" else ())
for os in ("linux", "linux_s390x", "darwin", "darwin_aarch64", "windows") + (("windows_arm64",) if version != "19" else ())
],
template = "jdk_http_archives.tmpl",
visibility = ["//:__pkg__"],
Expand Down
24 changes: 24 additions & 0 deletions src/test/shell/bazel/testdata/jdk_http_archives.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ http_archive(
build_file_content = "java_runtime(name = 'runtime', srcs = glob(['**']), visibility = ['//visibility:public'])",
)

# This must be kept in sync with the top-level WORKSPACE file.
http_archive(
{openjdk11_linux_s390x_archive}
build_file_content = "java_runtime(name = 'runtime', srcs = glob(['**']), visibility = ['//visibility:public'])",
)

# This must be kept in sync with the top-level WORKSPACE file.
http_archive(
{openjdk11_darwin_archive}
Expand Down Expand Up @@ -56,6 +62,15 @@ exports_files(["WORKSPACE"], visibility = ["//visibility:public"])
""",
)

# This must be kept in sync with the top-level WORKSPACE file.
http_archive(
{openjdk17_linux_s390x_archive}
build_file_content = """
java_runtime(name = 'runtime', srcs = glob(['**']), visibility = ['//visibility:public'])
exports_files(["WORKSPACE"], visibility = ["//visibility:public"])
""",
)

# This must be kept in sync with src/test/shell/bazel/testdata/jdk_http_archives.
http_archive(
{openjdk17_darwin_archive}
Expand Down Expand Up @@ -101,6 +116,15 @@ exports_files(["WORKSPACE"], visibility = ["//visibility:public"])
""",
)

# This must be kept in sync with the top-level WORKSPACE file.
http_archive(
{openjdk19_linux_s390x_archive}
build_file_content = """
java_runtime(name = 'runtime', srcs = glob(['**']), visibility = ['//visibility:public'])
exports_files(["WORKSPACE"], visibility = ["//visibility:public"])
""",
)

http_archive(
{openjdk19_darwin_archive}
build_file_content = """
Expand Down
5 changes: 5 additions & 0 deletions src/test/shell/testenv.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -279,16 +279,19 @@ EOF
"openjdk11_darwin_archive"
"openjdk11_darwin_aarch64_archive"
"openjdk11_linux_archive"
"openjdk11_linux_s390x_archive"
"openjdk11_windows_archive"
"openjdk11_windows_arm64_archive"
"openjdk17_darwin_archive"
"openjdk17_darwin_aarch64_archive"
"openjdk17_linux_archive"
"openjdk17_linux_s390x_archive"
"openjdk17_windows_archive"
"openjdk17_windows_arm64_archive"
"openjdk19_darwin_archive"
"openjdk19_darwin_aarch64_archive"
"openjdk19_linux_archive"
"openjdk19_linux_s390x_archive"
"openjdk19_windows_archive"
"remote_coverage_tools"
"remote_java_tools_for_testing"
Expand All @@ -308,11 +311,13 @@ EOF
"remotejdk11_win_for_testing"
"remotejdk11_win_arm64_for_testing"
"remotejdk17_linux_for_testing"
"remotejdk17_linux_s390x_for_testing"
"remotejdk17_macos_for_testing"
"remotejdk17_macos_aarch64_for_testing"
"remotejdk17_win_for_testing"
"remotejdk17_win_arm64_for_testing"
"remotejdk19_linux_for_testing"
"remotejdk19_linux_s390x_for_testing"
"remotejdk19_macos_for_testing"
"remotejdk19_macos_aarch64_for_testing"
"remotejdk19_win_for_testing"
Expand Down
2 changes: 1 addition & 1 deletion tools/jdk/BUILD.tools
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ _JDKS = [
] + [
"remotejdk%s_%s" % (version, os)
for version in ("17", "19")
for os in ("linux", "linux_aarch64", "macos", "macos_aarch64", "win") + (("win_arm64",) if version != "19" else ())
for os in ("linux", "linux_aarch64", "linux_s390x", "macos", "macos_aarch64", "win") + (("win_arm64",) if version != "19" else ())
]

[
Expand Down

0 comments on commit 66f571e

Please sign in to comment.