Skip to content

Commit 7da042a

Browse files
author
Ruixin Bao
committed
Add embedded jdk support for s390x
This patch follows a similar approach used in PR bazelbuild#11436 to add support for embedding OpenJDK in bazel on s390x. Similar to ppc, the openjdk used will be downloadded from adoptopenjdk website.
1 parent 7a11752 commit 7da042a

File tree

7 files changed

+42
-1
lines changed

7 files changed

+42
-1
lines changed

WORKSPACE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,15 @@ http_file(
360360
],
361361
)
362362

363+
http_file(
364+
name = "openjdk_linux_s390x_vanilla",
365+
downloaded_file_path="adoptopenjdk-s390x-vanilla.tar.gz",
366+
sha256 = "d9b72e87a1d3ebc0c9552f72ae5eb150fffc0298a7cb841f1ce7bfc70dcd1059",
367+
urls = [
368+
"https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7%2B10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.7_10.tar.gz",
369+
],
370+
)
371+
363372
http_file(
364373
name = "openjdk_macos",
365374
downloaded_file_path = "zulu-macos.tar.gz",
@@ -758,6 +767,19 @@ http_archive(
758767
],
759768
)
760769

770+
# This must be kept in sync with src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.
771+
http_archive(
772+
name = "remotejdk11_linux_s390x_for_testing",
773+
build_file = "@local_jdk//:BUILD.bazel",
774+
patch_cmds = EXPORT_WORKSPACE_IN_BUILD_BAZEL_FILE,
775+
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_BAZEL_FILE_WIN,
776+
sha256 = "d9b72e87a1d3ebc0c9552f72ae5eb150fffc0298a7cb841f1ce7bfc70dcd1059",
777+
strip_prefix = "jdk-11.0.7+10",
778+
urls = [
779+
"https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7%2B10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.7_10.tar.gz",
780+
],
781+
)
782+
761783
# This must be kept in sync with src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.
762784
http_archive(
763785
name = "remotejdk11_macos_for_testing",

src/BUILD

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ filegroup(
229229
"//src/conditions:linux_ppc64le": [
230230
"@openjdk_linux_ppc64le_vanilla//file",
231231
],
232+
"//src/conditions:linux_s390x": [
233+
"@openjdk_linux_s390x_vanilla//file",
234+
],
232235
"//conditions:default": [
233236
"@openjdk_linux_vanilla//file",
234237
],
@@ -769,6 +772,7 @@ filegroup(
769772
"@remotejdk11_linux_aarch64_for_testing//:WORKSPACE",
770773
"@remotejdk11_linux_for_testing//:WORKSPACE",
771774
"@remotejdk11_linux_ppc64le_for_testing//:WORKSPACE",
775+
"@remotejdk11_linux_s390x_for_testing//:WORKSPACE",
772776
"@remotejdk11_macos_for_testing//:WORKSPACE",
773777
"@remotejdk11_win_for_testing//:WORKSPACE",
774778
"@remotejdk14_linux_for_testing//:WORKSPACE",

src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,18 @@ maybe(
130130
],
131131
)
132132

133+
# This must be kept in sync with the top-level WORKSPACE file.
134+
maybe(
135+
http_archive,
136+
name = "remotejdk11_linux_s390x",
137+
build_file = "@local_jdk//:BUILD.bazel",
138+
sha256 = "d9b72e87a1d3ebc0c9552f72ae5eb150fffc0298a7cb841f1ce7bfc70dcd1059",
139+
strip_prefix = "jdk-11.0.7+10",
140+
urls = [
141+
"https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7%2B10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.7_10.tar.gz",
142+
],
143+
)
144+
133145
# This must be kept in sync with the top-level WORKSPACE file.
134146
maybe(
135147
http_archive,

src/minimize_jdk.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fi
3131
fulljdk=$1
3232
out=$3
3333
ARCH=`uname -p`
34-
if [[ "${ARCH}" == 'ppc64le' ]]; then
34+
if [[ "${ARCH}" == 'ppc64le' ]] || [[ "${ARCH}" == 's390x' ]]; then
3535
FULL_JDK_DIR="jdk*"
3636
DOCS=""
3737
else

src/test/py/bazel/test_base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class TestBase(unittest.TestCase):
5959
'remotejdk11_linux_for_testing',
6060
'remotejdk11_linux_aarch64_for_testing',
6161
'remotejdk11_linux_ppc64le_for_testing',
62+
'remotejdk11_linux_s390x_for_testing',
6263
'remotejdk11_macos_for_testing',
6364
'remotejdk11_win_for_testing',
6465
'remotejdk14_linux_for_testing',

src/test/shell/testenv.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ EOF
300300
"remotejdk11_linux_for_testing"
301301
"remotejdk11_linux_aarch64_for_testing"
302302
"remotejdk11_linux_ppc64le_for_testing"
303+
"remotejdk11_linux_s390x_for_testing"
303304
"remotejdk11_macos_for_testing"
304305
"remotejdk11_win_for_testing"
305306
"remotejdk14_linux_for_testing"

tools/jdk/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,7 @@ alias(
504504
"//src/conditions:linux_aarch64": "@remotejdk11_linux_aarch64//:jdk",
505505
"//src/conditions:linux_x86_64": "@remotejdk11_linux//:jdk",
506506
"//src/conditions:linux_ppc64le": "@remotejdk11_linux_ppc64le//:jdk",
507+
"//src/conditions:linux_s390x": "@remotejdk11_linux_s390x//:jdk",
507508
},
508509
no_match_error = "Could not find a JDK for host execution environment, please explicitly" +
509510
" provide one using `--host_javabase.`",

0 commit comments

Comments
 (0)