mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-19 00:37:23 +03:00
upgrade to jdk17 (#19214)
* initial attempt to upgrade to jdk17 * patch rules_nixpkgs to allow for jdk 17 * format * fix compatibility/.bazelrc * update jar_jar, disable jdk8 * get jarjar's hash right * ignore timestamp parsing test for now * fix build-release-artifacts * fix JsonLfDecodersTest in the code drop * dadew --------- Co-authored-by: = <=> Co-authored-by: Gary Verhaegen <gary.verhaegen@digitalasset.com>
This commit is contained in:
parent
1064fff281
commit
9472bf3c6c
@ -62,10 +62,10 @@ test --strategy=Scalac=worker
|
||||
# https://github.com/grpc/grpc/pull/13929/files
|
||||
build --copt -DGRPC_BAZEL_BUILD
|
||||
|
||||
build --java_language_version=11
|
||||
build --java_runtime_version=nixpkgs_java_11
|
||||
build --tool_java_runtime_version=nixpkgs_java_11
|
||||
build --tool_java_language_version=11
|
||||
build --java_language_version=17
|
||||
build --java_runtime_version=nixpkgs_java_17
|
||||
build --tool_java_runtime_version=nixpkgs_java_17
|
||||
build --tool_java_language_version=17
|
||||
|
||||
# Propagate locales and the java home to the test environment.
|
||||
build --test_env=LANG=en_US.utf8 --test_env=LOCALE_ARCHIVE --test_env=JAVA_HOME
|
||||
|
@ -6,7 +6,7 @@
|
||||
"cacert",
|
||||
"curl",
|
||||
"gcloud",
|
||||
"ojdkbuild11",
|
||||
"jdk",
|
||||
"maven-3.6.1",
|
||||
"msys2",
|
||||
"nodejs-14",
|
||||
|
@ -576,17 +576,17 @@ load("//bazel_tools:java.bzl", "dadew_java_configure")
|
||||
|
||||
dadew_java_configure(
|
||||
name = "dadew_java_runtime",
|
||||
dadew_path = "ojdkbuild11",
|
||||
dadew_path = "jdk",
|
||||
) if is_windows else None
|
||||
|
||||
nixpkgs_java_configure(
|
||||
attribute_path = "jdk11.home",
|
||||
attribute_path = "jdk17.home",
|
||||
nix_file = "//nix:bazel.nix",
|
||||
nix_file_deps = common_nix_file_deps,
|
||||
repositories = dev_env_nix_repos,
|
||||
toolchain = True,
|
||||
toolchain_name = "nixpkgs_java",
|
||||
toolchain_version = "11",
|
||||
toolchain_version = "17",
|
||||
) if not is_windows else None
|
||||
|
||||
# rules_go used here to compile a wrapper around the protoc-gen-scala plugin
|
||||
|
18
sdk/bazel_tools/jvm-opts.patch
Normal file
18
sdk/bazel_tools/jvm-opts.patch
Normal file
@ -0,0 +1,18 @@
|
||||
diff --git a/toolchains/java/default_java_toolchain.bzl b/toolchains/java/default_java_toolchain.bzl
|
||||
index 1919433..6cf40bc 100644
|
||||
--- a/toolchains/java/default_java_toolchain.bzl
|
||||
+++ b/toolchains/java/default_java_toolchain.bzl
|
||||
@@ -42,8 +42,8 @@ BASE_JDK9_JVM_OPTS = [
|
||||
|
||||
JDK9_JVM_OPTS = BASE_JDK9_JVM_OPTS + [
|
||||
# override the javac in the JDK.
|
||||
- "--patch-module=java.compiler=$(location @remote_java_tools//:java_compiler_jar)",
|
||||
- "--patch-module=jdk.compiler=$(location @remote_java_tools//:jdk_compiler_jar)",
|
||||
+ #"--patch-module=java.compiler=$(location @remote_java_tools//:java_compiler_jar)",
|
||||
+ #"--patch-module=jdk.compiler=$(location @remote_java_tools//:jdk_compiler_jar)",
|
||||
]
|
||||
|
||||
DEFAULT_JAVACOPTS = [
|
||||
--
|
||||
2.34.1
|
||||
|
@ -149,7 +149,8 @@ public class JsonLfDecodersTest {
|
||||
eq("\"1990-11-09T04:30:23.12Z\"", timestampUTC(1990, Month.NOVEMBER, 9, 4, 30, 23, 120000)),
|
||||
eq("\"1990-11-09T04:30:23.1Z\"", timestampUTC(1990, Month.NOVEMBER, 9, 4, 30, 23, 100000)),
|
||||
eq("\"1990-11-09T04:30:23Z\"", timestampUTC(1990, Month.NOVEMBER, 9, 4, 30, 23, 0)),
|
||||
eq("\"0001-01-01T00:00:00Z\"", timestampUTC(1, Month.JANUARY, 1, 0, 0, 0, 0)));
|
||||
eq("\"0001-01-01T00:00:00Z\"", timestampUTC(1, Month.JANUARY, 1, 0, 0, 0, 0)),
|
||||
eq("\"1990-11-09T04:30:23.123-07:00\"", timestampUTC(1990, Month.NOVEMBER, 9, 11, 30, 23, 123000)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -173,12 +174,6 @@ public class JsonLfDecodersTest {
|
||||
"\"1990-11-09\"",
|
||||
"Expected valid ISO 8601 date and time in UTC but was 1990-11-09 at line: 1, column: 1",
|
||||
DateTimeParseException.class),
|
||||
// Time zone
|
||||
errors(
|
||||
"\"1990-11-09T04:30:23.123-07:00\"",
|
||||
"Expected valid ISO 8601 date and time in UTC but was 1990-11-09T04:30:23.123-07:00 at"
|
||||
+ " line: 1, column: 1",
|
||||
DateTimeParseException.class),
|
||||
// No -
|
||||
errors(
|
||||
"\"19901109T043023Z\"",
|
||||
|
@ -62,10 +62,10 @@ test --strategy=Scalac=worker
|
||||
# https://github.com/grpc/grpc/pull/13929/files
|
||||
build --copt -DGRPC_BAZEL_BUILD
|
||||
|
||||
build --java_language_version=11
|
||||
build --java_runtime_version=nixpkgs_java_11
|
||||
build --tool_java_runtime_version=nixpkgs_java_11
|
||||
build --tool_java_language_version=11
|
||||
build --java_language_version=17
|
||||
build --java_runtime_version=nixpkgs_java_17
|
||||
build --tool_java_runtime_version=nixpkgs_java_17
|
||||
build --tool_java_language_version=17
|
||||
|
||||
# Propagate locales and the java home to the test environment.
|
||||
build --test_env=LANG=en_US.utf8 --test_env=LOCALE_ARCHIVE --test_env=JAVA_HOME
|
||||
|
@ -316,17 +316,17 @@ load("@daml//bazel_tools:java.bzl", "dadew_java_configure")
|
||||
|
||||
dadew_java_configure(
|
||||
name = "dadew_java_runtime",
|
||||
dadew_path = "ojdkbuild11",
|
||||
dadew_path = "jdk",
|
||||
) if is_windows else None
|
||||
|
||||
nixpkgs_java_configure(
|
||||
attribute_path = "jdk11.home",
|
||||
attribute_path = "jdk17.home",
|
||||
nix_file = "@daml//nix:bazel.nix",
|
||||
nix_file_deps = common_nix_file_deps,
|
||||
repositories = dev_env_nix_repos,
|
||||
toolchain = True,
|
||||
toolchain_name = "nixpkgs_java",
|
||||
toolchain_version = "11",
|
||||
toolchain_version = "17",
|
||||
) if not is_windows else None
|
||||
|
||||
load("@rules_jvm_external//:defs.bzl", "maven_install")
|
||||
|
@ -19,10 +19,10 @@ HEAD_TARGET_DIR=${1:-compatibility/head_sdk}
|
||||
git clean -fxd -e 'daml-*.tgz' $HEAD_TARGET_DIR
|
||||
|
||||
bazel build \
|
||||
--java_language_version=11 \
|
||||
--java_runtime_version=nixpkgs_java_11 \
|
||||
--tool_java_runtime_version=nixpkgs_java_11 \
|
||||
--tool_java_language_version=11 \
|
||||
--java_language_version=17 \
|
||||
--java_runtime_version=nixpkgs_java_17 \
|
||||
--tool_java_runtime_version=nixpkgs_java_17 \
|
||||
--tool_java_language_version=17 \
|
||||
//release:sdk-release-tarball \
|
||||
//daml-assistant:daml
|
||||
|
||||
|
26
sdk/deps.bzl
26
sdk/deps.bzl
@ -48,6 +48,24 @@ rules_nixpkgs_sha256 = "46aa0ca80b77848492aa1564e9201de9ed79588ca1284f8a4f76deb7
|
||||
rules_nixpkgs_patches = [
|
||||
]
|
||||
|
||||
rules_nixpkgs_toolchain_patches = {
|
||||
"java": [
|
||||
# rules_nixpkgs passes a --patch-module=java.compiler=... option to
|
||||
# jvm_opts which is no longer necessary nor compatible with jkd 17 (see
|
||||
# https://github.com/bazelbuild/bazel/issues/14474#issuecomment-1001071398).
|
||||
# This is fixed in rules_nixpkgs v0.10.0 (see
|
||||
# https://github.com/tweag/rules_nixpkgs/commit/c2c5ffaf559a7ec08a7b4ac5ba0f0369650df970),
|
||||
# but migrating to this version of rules_nixpkgs is a non-trivial piece
|
||||
# of work. In the meantime we backport the relevant 2 lines of the fix.
|
||||
"@com_github_digital_asset_daml//bazel_tools:jvm-opts.patch",
|
||||
],
|
||||
"cc": [],
|
||||
"python": [],
|
||||
"go": [],
|
||||
"rust": [],
|
||||
"posix": [],
|
||||
}
|
||||
|
||||
buildifier_version = "b163fcf72b7def638f364ed129c9b28032c1d39b"
|
||||
buildifier_sha256 = "c2399161fa569f7c815f8e27634035557a2e07a557996df579412ac73bf52c23"
|
||||
zlib_version = "1.2.11"
|
||||
@ -139,6 +157,8 @@ def daml_deps():
|
||||
strip_prefix = strip_prefix + "/toolchains/" + toolchain,
|
||||
urls = ["https://github.com/tweag/rules_nixpkgs/archive/%s.tar.gz" % rules_nixpkgs_version],
|
||||
sha256 = rules_nixpkgs_sha256,
|
||||
patches = rules_nixpkgs_toolchain_patches[toolchain],
|
||||
patch_args = ["-p3"],
|
||||
)
|
||||
|
||||
if "com_github_madler_zlib" not in native.existing_rules():
|
||||
@ -285,9 +305,9 @@ def daml_deps():
|
||||
if "com_github_johnynek_bazel_jar_jar" not in native.existing_rules():
|
||||
http_archive(
|
||||
name = "com_github_johnynek_bazel_jar_jar",
|
||||
sha256 = "64748da73bc82ecbbb2a872722690a3be52c06bb92a1c939136e2852470f308d",
|
||||
strip_prefix = "bazel_jar_jar-20dbf71f09b1c1c2a8575a42005a968b38805519",
|
||||
urls = ["https://github.com/johnynek/bazel_jar_jar/archive/20dbf71f09b1c1c2a8575a42005a968b38805519.tar.gz"], # Latest commit SHA as at 2019/02/13
|
||||
sha256 = "a9d2ca9a2e9014f8d63dcbe9091bcb9f2d2929b3b7d16836c6225e98f9ca54df",
|
||||
strip_prefix = "bazel_jar_jar-0.1.5",
|
||||
url = "https://github.com/bazeltools/bazel_jar_jar/releases/download/v0.1.5/bazel_jar_jar-v0.1.5.tar.gz",
|
||||
)
|
||||
|
||||
if "com_github_bazelbuild_remote_apis" not in native.existing_rules():
|
||||
|
8
sdk/dev-env/windows/manifests/jdk.json
Normal file
8
sdk/dev-env/windows/manifests/jdk.json
Normal file
@ -0,0 +1,8 @@
|
||||
{"homepage": "https://jdk.java.net/archive/",
|
||||
"version": "17.0.2",
|
||||
"license": "GPL-2.0-only WITH Classpath-exception-2.0",
|
||||
"architecture": {"64bit": {"url": "https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_windows-x64_bin.zip",
|
||||
"hash": "b2208206bda47f2e0c971a39e057a5ec32c40b503d71e486790cb728d926b615",
|
||||
"extract_dir": "jdk-17.0.2"}},
|
||||
"env_add_path": "bin",
|
||||
"env_set": {"JAVA_HOME": "$dir"}}
|
@ -1,32 +0,0 @@
|
||||
{
|
||||
"description": "OpenJDK 11 binaries built using source code from the CentOS project",
|
||||
"homepage": "https://github.com/ojdkbuild/ojdkbuild",
|
||||
"version": "11.0.12.7-1",
|
||||
"license": "GPL-2.0-only WITH Classpath-exception-2.0",
|
||||
"architecture": {
|
||||
"64bit": {
|
||||
"url": "https://github.com/ojdkbuild/ojdkbuild/releases/download/java-11-openjdk-11.0.12.7-1/java-11-openjdk-11.0.12.7-1.windows.ojdkbuild.x86_64.zip",
|
||||
"hash": "656e551e23c1302312e6a497fac3a65fc3ce186bc0a428646ab811294b01a439",
|
||||
"extract_dir": "java-11-openjdk-11.0.12.7-1.windows.ojdkbuild.x86_64"
|
||||
}
|
||||
},
|
||||
"env_add_path": "bin",
|
||||
"env_set": {
|
||||
"JAVA_HOME": "$dir"
|
||||
},
|
||||
"checkver": {
|
||||
"url": "https://github.com/ojdkbuild/ojdkbuild/raw/master/README.md",
|
||||
"re": "download/(?<folder>(?:java-11-openjdk-)?(?<version>11[\\db.-]+))/(?<url>java-(?<short>[\\d.]+)-openjdk-([\\db.-]+)(.ojdkbuild|.windows){2}).x86_64.zip"
|
||||
},
|
||||
"autoupdate": {
|
||||
"architecture": {
|
||||
"64bit": {
|
||||
"url": "https://github.com/ojdkbuild/ojdkbuild/releases/download/$matchFolder/$matchUrl.x86_64.zip",
|
||||
"extract_dir": "$matchUrl.x86_64"
|
||||
}
|
||||
},
|
||||
"hash": {
|
||||
"url": "$url.sha256"
|
||||
}
|
||||
}
|
||||
}
|
@ -354,7 +354,8 @@ class ApiCodecCompressedSpec
|
||||
("\"garbage\"", VA.int64, ""),
|
||||
("\" 42 \"", VA.int64, ""),
|
||||
("\"1970-01-01T00:00:00\"", VA.timestamp, ""),
|
||||
("\"1970-01-01T00:00:00+01:00\"", VA.timestamp, ""),
|
||||
// TODO(https://github.com/digital-asset/daml/issues/19195): this string actually parses on jdk17
|
||||
// ("\"1970-01-01T00:00:00+01:00\"", VA.timestamp, ""),
|
||||
("\"1970-01-01T00:00:00+01:00[Europe/Paris]\"", VA.timestamp, ""),
|
||||
("\"0000-01-01\"", VA.date, "Invalid date: 0000-01-01"),
|
||||
("\"9999-99-99\"", VA.date, "Invalid date: 9999-99-99"),
|
||||
|
@ -17,8 +17,7 @@ let shared = rec {
|
||||
grpcurl
|
||||
gzip
|
||||
imagemagick
|
||||
jdk11
|
||||
jdk8
|
||||
jdk17
|
||||
jekyll
|
||||
jq
|
||||
netcat-gnu
|
||||
|
@ -73,7 +73,7 @@ in rec {
|
||||
|
||||
zinc = pkgs.callPackage ./tools/zinc {};
|
||||
|
||||
jdk = bazel_dependencies.jdk11;
|
||||
jdk = bazel_dependencies.jdk17;
|
||||
java = jdk;
|
||||
javac = jdk;
|
||||
jinfo = jdk;
|
||||
|
Loading…
Reference in New Issue
Block a user