Skip to content

Commit

Permalink
Add embedded jdk support for s390x
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Ruixin Bao committed Aug 14, 2020
1 parent e6cce76 commit 01c4898
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 1 deletion.
22 changes: 22 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,15 @@ http_file(
],
)

http_file(
name = "openjdk_linux_s390x_vanilla",
downloaded_file_path="adoptopenjdk-s390x-vanilla.tar.gz",
sha256 = "d9b72e87a1d3ebc0c9552f72ae5eb150fffc0298a7cb841f1ce7bfc70dcd1059",
urls = [
"https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7%2B10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.7_10.tar.gz",
],
)

http_file(
name = "openjdk_macos",
downloaded_file_path = "zulu-macos.tar.gz",
Expand Down Expand Up @@ -758,6 +767,19 @@ http_archive(
],
)

# This must be kept in sync with src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.
http_archive(
name = "remotejdk11_linux_s390x_for_testing",
build_file = "@local_jdk//:BUILD.bazel",
patch_cmds = EXPORT_WORKSPACE_IN_BUILD_BAZEL_FILE,
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_BAZEL_FILE_WIN,
sha256 = "d9b72e87a1d3ebc0c9552f72ae5eb150fffc0298a7cb841f1ce7bfc70dcd1059",
strip_prefix = "jdk-11.0.7+10",
urls = [
"https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7%2B10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.7_10.tar.gz",
],
)

# This must be kept in sync with src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.
http_archive(
name = "remotejdk11_macos_for_testing",
Expand Down
4 changes: 4 additions & 0 deletions src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ filegroup(
"//src/conditions:linux_ppc64le": [
"@openjdk_linux_ppc64le_vanilla//file",
],
"//src/conditions:linux_s390x": [
"@openjdk_linux_s390x_vanilla//file",
],
"//conditions:default": [
"@openjdk_linux_vanilla//file",
],
Expand Down Expand Up @@ -765,6 +768,7 @@ filegroup(
"@remotejdk11_linux_aarch64_for_testing//:WORKSPACE",
"@remotejdk11_linux_for_testing//:WORKSPACE",
"@remotejdk11_linux_ppc64le_for_testing//:WORKSPACE",
"@remotejdk11_linux_s390x_for_testing//:WORKSPACE",
"@remotejdk11_macos_for_testing//:WORKSPACE",
"@remotejdk11_win_for_testing//:WORKSPACE",
"@remotejdk14_linux_for_testing//:WORKSPACE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,18 @@ maybe(
],
)

# This must be kept in sync with the top-level WORKSPACE file.
maybe(
http_archive,
name = "remotejdk11_linux_s390x",
build_file = "@local_jdk//:BUILD.bazel",
sha256 = "d9b72e87a1d3ebc0c9552f72ae5eb150fffc0298a7cb841f1ce7bfc70dcd1059",
strip_prefix = "jdk-11.0.7+10",
urls = [
"https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7%2B10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.7_10.tar.gz",
],
)

# This must be kept in sync with the top-level WORKSPACE file.
maybe(
http_archive,
Expand Down
2 changes: 1 addition & 1 deletion src/minimize_jdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fi
fulljdk=$1
out=$3
ARCH=`uname -p`
if [[ "${ARCH}" == 'ppc64le' ]]; then
if [[ "${ARCH}" == 'ppc64le' ]] || [[ "${ARCH}" == 's390x' ]]; then
FULL_JDK_DIR="jdk*"
DOCS=""
else
Expand Down
1 change: 1 addition & 0 deletions src/test/py/bazel/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class TestBase(unittest.TestCase):
'remotejdk11_linux_for_testing',
'remotejdk11_linux_aarch64_for_testing',
'remotejdk11_linux_ppc64le_for_testing',
'remotejdk11_linux_s390x_for_testing',
'remotejdk11_macos_for_testing',
'remotejdk11_win_for_testing',
'remotejdk14_linux_for_testing',
Expand Down
1 change: 1 addition & 0 deletions src/test/shell/testenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ EOF
"remotejdk11_linux_for_testing"
"remotejdk11_linux_aarch64_for_testing"
"remotejdk11_linux_ppc64le_for_testing"
"remotejdk11_linux_s390x_for_testing"
"remotejdk11_macos_for_testing"
"remotejdk11_win_for_testing"
"remotejdk14_linux_for_testing"
Expand Down
1 change: 1 addition & 0 deletions tools/jdk/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ alias(
"//src/conditions:linux_aarch64": "@remotejdk11_linux_aarch64//:jdk",
"//src/conditions:linux_x86_64": "@remotejdk11_linux//:jdk",
"//src/conditions:linux_ppc64le": "@remotejdk11_linux_ppc64le//:jdk",
"//src/conditions:linux_s390x": "@remotejdk11_linux_s390x//:jdk",
},
no_match_error = "Could not find a JDK for host execution environment, please explicitly" +
" provide one using `--host_javabase.`",
Expand Down

0 comments on commit 01c4898

Please sign in to comment.