Skip to content

Commit e14a6f2

Browse files
Ruixin Baocopybara-github
Ruixin Bao
authored andcommitted
Add embedded jdk support for s390x
This patch follows a similar approach used in PR #11436 to add support for embedding OpenJDK in bazel on s390x. Similar to ppc, the openjdk used will be downloadded from adoptopenjdk website. /cc @philwo Closes #11965. PiperOrigin-RevId: 327798995
1 parent 15e691d commit e14a6f2

File tree

7 files changed

+45
-1
lines changed

7 files changed

+45
-1
lines changed

WORKSPACE

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,16 @@ 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://mirror.bazel.build/github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7+10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.7_10.tar.gz",
369+
"https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7+10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.7_10.tar.gz",
370+
],
371+
)
372+
363373
http_file(
364374
name = "openjdk_macos",
365375
downloaded_file_path = "zulu-macos.tar.gz",
@@ -758,6 +768,20 @@ http_archive(
758768
],
759769
)
760770

771+
# This must be kept in sync with src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.
772+
http_archive(
773+
name = "remotejdk11_linux_s390x_for_testing",
774+
build_file = "@local_jdk//:BUILD.bazel",
775+
patch_cmds = EXPORT_WORKSPACE_IN_BUILD_BAZEL_FILE,
776+
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_BAZEL_FILE_WIN,
777+
sha256 = "d9b72e87a1d3ebc0c9552f72ae5eb150fffc0298a7cb841f1ce7bfc70dcd1059",
778+
strip_prefix = "jdk-11.0.7+10",
779+
urls = [
780+
"https://mirror.bazel.build/github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7+10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.7_10.tar.gz",
781+
"https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7+10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.7_10.tar.gz",
782+
],
783+
)
784+
761785
# This must be kept in sync with src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.
762786
http_archive(
763787
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: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,19 @@ 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://mirror.bazel.build/github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7+10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.7_10.tar.gz",
142+
"https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7+10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.7_10.tar.gz",
143+
],
144+
)
145+
133146
# This must be kept in sync with the top-level WORKSPACE file.
134147
maybe(
135148
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)