daml/sdk/compatibility/WORKSPACE
Paul Brauner 9472bf3c6c
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>
2024-05-17 13:44:11 +02:00

438 lines
13 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

workspace(name = "compatibility")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
# We import the main workspace for nix stuff and some shared Bazel rules.
# This is mainly so we dont have to symlink a bunch of files.
# Note that you should never depend on targets from @daml.
local_repository(
name = "daml",
path = "..",
)
load("@daml//bazel_tools:os_info.bzl", "os_info")
os_info(name = "os_info")
load("@os_info//:os_info.bzl", "is_darwin", "is_linux", "is_linux_intel", "is_windows", "os_name")
load("@daml//bazel_tools:build_environment.bzl", "build_environment")
build_environment(name = "build_environment")
load("@daml//bazel_tools:scala_version.bzl", "scala_version_configure")
scala_version_configure(name = "scala_version")
load("//:deps.bzl", "daml_deps")
daml_deps()
load("@rules_haskell//haskell:repositories.bzl", "rules_haskell_dependencies")
rules_haskell_dependencies()
load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies")
go_rules_dependencies()
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
gazelle_dependencies()
load("@daml//bazel_tools/dev_env_tool:dev_env_tool.bzl", "dadew", "dev_env_tool")
dadew(name = "dadew")
load("@daml//bazel_tools/dev_env_tool:dev_env_tool.bzl", "dadew_sh_posix_configure")
dadew_sh_posix_configure() if is_windows else None
load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories")
load(
"@rules_haskell//haskell:nixpkgs.bzl",
"haskell_register_ghc_nixpkgs",
)
load(
"@rules_haskell//haskell:ghc_bindist.bzl",
"haskell_register_ghc_bindists",
)
load(
"@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl",
"nixpkgs_cc_configure",
"nixpkgs_java_configure",
"nixpkgs_local_repository",
"nixpkgs_package",
"nixpkgs_python_configure",
)
load("//:versions.bzl", "latest_stable_version", "sdk_versions", "version_sha256s")
common_nix_file_deps = [
"@daml//nix:bazel.nix",
"@daml//nix:nixpkgs.nix",
"@daml//nix:nixpkgs/default.nix",
"@daml//nix:nixpkgs/default.src.json",
"@daml//nix:system.nix",
]
dev_env_nix_repos = {
"nixpkgs": "@nixpkgs",
}
nixpkgs_local_repository(
name = "nixpkgs",
nix_file = "@daml//nix:nixpkgs.nix",
nix_file_deps = [
"@daml//nix:nixpkgs/default.nix",
"@daml//nix:nixpkgs/default.src.json",
"@daml//nix:system.nix",
],
)
nixpkgs_cc_configure(
nix_file = "@daml//nix:bazel-cc-toolchain.nix",
nix_file_deps = common_nix_file_deps + [
"@daml//nix:tools/bazel-cc-toolchain/default.nix",
],
repositories = dev_env_nix_repos,
) if not is_windows else None
nixpkgs_package(
name = "glibc_locales",
attribute_path = "glibcLocales",
build_file_content = """
package(default_visibility = ["//visibility:public"])
filegroup(
name = "locale-archive",
srcs = ["lib/locale/locale-archive"],
)
""",
nix_file = "@daml//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
) if is_linux else None
# diff system dependency
nixpkgs_package(
name = "diffutils_nix",
attribute_path = "diffutils",
fail_not_supported = False,
nix_file = "@daml//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
)
haskell_register_ghc_bindists(
compiler_flags = [],
version = "9.0.2",
) if is_windows else None
haskell_register_ghc_nixpkgs(
attribute_path = "ghc",
build_file = "@io_tweag_rules_nixpkgs//nixpkgs:BUILD.pkg",
locale_archive = "@glibc_locales//:locale-archive",
nix_file = "@daml//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
version = "9.0.2",
)
nixpkgs_python_configure(repository = "@nixpkgs")
nixpkgs_package(
name = "tar_nix",
attribute_path = "gnutar",
fail_not_supported = False,
nix_file = "@daml//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
)
dev_env_tool(
name = "tar_dev_env",
nix_include = ["bin/tar"],
nix_label = "@tar_nix",
nix_paths = ["bin/tar"],
tools = ["tar"],
win_include = ["usr/bin/tar.exe"],
win_paths = ["usr/bin/tar.exe"],
win_tool = "msys2",
)
nixpkgs_package(
name = "gzip_nix",
attribute_path = "gzip",
fail_not_supported = False,
nix_file = "@daml//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
)
dev_env_tool(
name = "gzip_dev_env",
nix_include = ["bin/gzip"],
nix_label = "@gzip_nix",
nix_paths = ["bin/gzip"],
tools = ["gzip"],
win_include = ["usr/bin/gzip.exe"],
win_paths = ["usr/bin/gzip.exe"],
win_tool = "msys2",
)
nixpkgs_package(
name = "postgresql_nix",
attribute_path = "postgresql_12",
build_file_content = """
package(default_visibility = ["//visibility:public"])
filegroup(
name = "all",
srcs = glob(["**"]),
)
""",
fail_not_supported = False,
nix_file = "@daml//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
)
nixpkgs_package(
name = "openssl_nix",
attribute_path = "openssl",
fail_not_supported = False,
nix_file = "@daml//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
)
dev_env_tool(
name = "openssl_dev_env",
nix_include = ["bin/openssl"],
nix_label = "@openssl_nix",
nix_paths = ["bin/openssl"],
tools = ["openssl"],
win_include = [
"usr/bin",
"usr/ssl",
],
win_paths = ["usr/bin/openssl.exe"],
win_tool = "msys2",
)
nixpkgs_package(
name = "hlint_nix",
attribute_path = "hlint",
nix_file = "@daml//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
)
nixpkgs_package(
name = "node_nix",
attribute_path = "nodejs14Nested",
build_file_content = 'exports_files(glob(["node_nix/**"]))',
fail_not_supported = False,
nix_file = "@daml//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
)
dev_env_tool(
name = "nodejs_dev_env",
nix_include = [
"bin",
"include",
"lib",
"share",
],
nix_label = "@node_nix",
nix_paths = [],
prefix = "nodejs_dev_env",
tools = [],
win_include = [
".",
],
win_paths = [],
win_tool = "nodejs-14",
)
node_repositories(
vendored_node = "@nodejs_dev_env" if is_windows else "@node_nix",
yarn_version = "1.22.4",
)
nixpkgs_package(
name = "patch_nix",
attribute_path = "gnupatch",
fail_not_supported = False,
nix_file = "@daml//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
)
dev_env_tool(
name = "patch_dev_env",
nix_include = ["bin/patch"],
nix_label = "@patch_nix",
nix_paths = ["bin/patch"],
tools = ["patch"],
win_include = ["usr/bin/patch.exe"],
win_paths = ["usr/bin/patch.exe"],
win_tool = "msys2",
)
load("//:bazel-haskell-deps.bzl", "daml_haskell_deps")
daml_haskell_deps()
load("//bazel_tools:daml_sdk.bzl", "daml_sdk", "daml_sdk_head")
local_repository(
name = "head_sdk",
path = "head_sdk",
)
daml_sdk_head(
daml_ledger_tarball = "@head_sdk//:daml-ledger-0.0.0.tgz",
daml_react_tarball = "@head_sdk//:daml-react-0.0.0.tgz",
daml_types_tarball = "@head_sdk//:daml-types-0.0.0.tgz",
os_name = os_name,
sdk_tarball = "@head_sdk//:sdk-release-tarball-ce.tar.gz",
)
[
daml_sdk(
# See the explanation in UpdateVersions.hs
daml_ledger_sha256 = version_sha256s.get(ver).get("daml_ledger"),
daml_react_sha256 = version_sha256s.get(ver).get("daml_react"),
daml_types_sha256 = version_sha256s.get(ver).get("daml_types"),
os_name = os_name,
sdk_sha256 = version_sha256s.get(ver),
version = ver,
)
for ver in sdk_versions
if ver != "0.0.0"
]
load("@daml//bazel_tools:java.bzl", "dadew_java_configure")
dadew_java_configure(
name = "dadew_java_runtime",
dadew_path = "jdk",
) if is_windows else None
nixpkgs_java_configure(
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 = "17",
) if not is_windows else None
load("@rules_jvm_external//:defs.bzl", "maven_install")
grpc_version = "1.35.0"
load("@scala_version//:index.bzl", "scala_artifacts", "scala_major_version", "scala_version")
# We base our Maven artifacts on the latest stable release
# for now. In principle, we could setup one Maven workspace
# per SDK version but that is a bit painful to setup and
# seems to bring little benefit.
maven_install(
name = "maven",
artifacts = [
"com.daml:bindings-akka_2.13:{}".format("2.7.6"),
"com.daml:daml-lf-archive-reader_2.13:{}".format(latest_stable_version),
"com.daml:daml-lf-transaction_2.13:{}".format(latest_stable_version),
"com.daml:ledger-api-common_2.13:{}".format(latest_stable_version),
"com.daml:lf-value-json_2.13:{}".format(latest_stable_version),
"io.grpc:grpc-api:{}".format(grpc_version),
"io.grpc:grpc-core:{}".format(grpc_version),
"io.grpc:grpc-netty:{}".format(grpc_version),
"io.grpc:grpc-protobuf:{}".format(grpc_version),
"io.grpc:grpc-services:{}".format(grpc_version),
"io.grpc:grpc-stub:{}".format(grpc_version),
"com.github.scopt:scopt_{}:3.7.1".format(scala_major_version),
"org.wartremover:wartremover_{}:2.4.21".format(scala_version),
"io.spray:spray-json_{}:1.3.5".format(scala_major_version),
],
maven_install_json = "@compatibility//:maven_install.json",
repositories = [
"https://repo1.maven.org/maven2",
],
version_conflict_policy = "pinned",
)
load("@maven//:defs.bzl", "pinned_maven_install")
pinned_maven_install()
load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config")
scala_config(scala_version)
load(
"@io_bazel_rules_scala//scala:scala.bzl",
"scala_repositories",
)
scala_repositories(
fetch_sources = True,
overriden_artifacts = scala_artifacts,
)
load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains")
register_toolchains("@daml//bazel_tools/scala:toolchain")
# Copies of SDKs at correct versions for daml testing
http_file(
name = "daml-sdk-2.7.5-tarball",
sha256 = "ea2730b1b50075686c82369a20da5a6b93c899e792d0db756218702427884148",
urls = ["https://github.com/digital-asset/daml/releases/download/v2.7.5/daml-sdk-2.7.5-linux.tar.gz"],
) if is_linux_intel else None
http_file(
name = "daml-sdk-2.7.5-tarball",
sha256 = "b8e8bdff694a075431686048311d3a2ad9b62a2c88bf8ef927123c1b5b2addfa",
urls = ["https://github.com/digital-asset/daml/releases/download/v2.7.5/daml-sdk-2.7.5-windows.tar.gz"],
) if is_windows else None
http_file(
name = "daml-sdk-2.7.4-tarball",
sha256 = "c8625a752006821998b49b48d4c734b41dcedfda5ae72d6d5d6ce3eab443f625",
urls = ["https://github.com/digital-asset/daml/releases/download/v2.7.4/daml-sdk-2.7.4-linux.tar.gz"],
) if is_linux_intel else None
http_file(
name = "daml-sdk-2.7.4-tarball",
sha256 = "8040d524d487cfe260b0f94bdcfee1556548875b33666200e9d599f22c31e51c",
urls = ["https://github.com/digital-asset/daml/releases/download/v2.7.4/daml-sdk-2.7.4-windows.tar.gz"],
) if is_windows else None
http_file(
name = "daml-sdk-2.7.1-tarball",
sha256 = "72b6151168b8229e040cf4ed033c9838c1f0d986e63f18186091280dc82f4ea9",
urls = ["https://github.com/digital-asset/daml/releases/download/v2.7.1/daml-sdk-2.7.1-linux.tar.gz"],
) if is_linux_intel else None
http_file(
name = "daml-sdk-2.7.1-tarball",
sha256 = "200d358103daaf3cd58910966f4a5059bf4bbd3a98964bf65c3414fb3ec6cd92",
urls = ["https://github.com/digital-asset/daml/releases/download/v2.7.1/daml-sdk-2.7.1-windows.tar.gz"],
) if is_windows else None
http_file(
name = "daml-sdk-2.8.0-snapshot.20231107.12319.0.v03a51e65-tarball",
sha256 = "cf7b706076fa874b2913547bd6b064890155e656523ad94417300ead72ee19f4",
urls = ["https://github.com/digital-asset/daml/releases/download/v2.8.0-snapshot.20231109.2/daml-sdk-2.8.0-snapshot.20231107.12319.0.v03a51e65-linux.tar.gz"],
) if is_linux_intel else None
http_file(
name = "daml-sdk-2.8.0-snapshot.20231107.12319.0.v03a51e65-tarball",
sha256 = "d2260542d3d63178dc879f96dfd72fcbe703366ce02b3520c28b29ac3817b70f",
urls = ["https://github.com/digital-asset/daml/releases/download/v2.8.0-snapshot.20231109.2/daml-sdk-2.8.0-snapshot.20231107.12319.0.v03a51e65-windows.tar.gz"],
) if is_windows else None