mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-10 10:46:11 +03:00
ecd3110f48
* Fix compat job changelog_begin changelog_end * Cleanup head_sdk changelog_begin changelog_end * turns out removing everything also removes files that shouldn’t be removed changelog_begin changelog_end * gnah changelog_begin changelog_end * maybe this was a bad idea changelog_begin changelog_end * trynottocry changelog_begin changelog_end
361 lines
9.8 KiB
Python
361 lines
9.8 KiB
Python
workspace(name = "compatibility")
|
||
|
||
# We import the main workspace for nix stuff and some shared Bazel rules.
|
||
# This is mainly so we don’t 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_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")
|
||
|
||
scala_version(name = "scala_version")
|
||
|
||
load("//:deps.bzl", "daml_deps")
|
||
|
||
daml_deps()
|
||
|
||
load("@rules_haskell//haskell:repositories.bzl", "rules_haskell_dependencies")
|
||
|
||
rules_haskell_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_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",
|
||
]
|
||
|
||
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",
|
||
],
|
||
)
|
||
|
||
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
|
||
|
||
haskell_register_ghc_bindists(
|
||
compiler_flags = [],
|
||
version = "8.10.3",
|
||
) 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 = "8.10.3",
|
||
)
|
||
|
||
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_9_6",
|
||
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 = "nodejsNested",
|
||
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-12.17.0",
|
||
)
|
||
|
||
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(
|
||
create_daml_app_patch = "@head_sdk//:messaging.patch",
|
||
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",
|
||
ledger_api_test_tool = "@head_sdk//:ledger-api-test-tool_deploy.jar",
|
||
os_name = os_name,
|
||
sdk_tarball = "@head_sdk//:sdk-release-tarball-ce.tar.gz",
|
||
)
|
||
|
||
[
|
||
daml_sdk(
|
||
# See the explanation in UpdateVersions.hs
|
||
create_daml_app_patch = None if version_sha256s.get(ver).get("create_daml_app_patch") else "@daml-sdk-1.1.1//:create_daml_app.patch",
|
||
create_daml_app_patch_sha256 = version_sha256s.get(ver).get("create_daml_app_patch"),
|
||
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),
|
||
test_tool_sha256 = version_sha256s.get(ver).get("test_tool"),
|
||
version = ver,
|
||
)
|
||
for ver in sdk_versions
|
||
if ver != "0.0.0"
|
||
]
|
||
|
||
load("@daml//bazel_tools:java.bzl", "java_home_runtime")
|
||
|
||
java_home_runtime(name = "java_home")
|
||
|
||
load("@rules_jvm_external//:defs.bzl", "maven_install")
|
||
|
||
# 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.12:{}".format(latest_stable_version),
|
||
"com.daml:daml-lf-archive-reader_2.12:{}".format(latest_stable_version),
|
||
"com.daml:daml-lf-transaction_2.12:{}".format(latest_stable_version),
|
||
"com.daml:ledger-api-common_2.12:{}".format(latest_stable_version),
|
||
"com.daml:lf-value-json_2.12:{}".format(latest_stable_version),
|
||
"com.github.scopt:scopt_2.12:3.7.1",
|
||
"org.wartremover:wartremover_2.12.12:2.4.10",
|
||
"io.spray:spray-json_2.12:1.3.3",
|
||
],
|
||
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("2.12.12")
|
||
|
||
load(
|
||
"@io_bazel_rules_scala//scala:scala.bzl",
|
||
"scala_repositories",
|
||
)
|
||
|
||
scala_repositories(
|
||
fetch_sources = True,
|
||
overriden_artifacts =
|
||
{
|
||
"io_bazel_rules_scala_scala_compiler": {
|
||
"artifact": "org.scala-lang:scala-compiler:2.12.12",
|
||
"sha256": "9dfa682ad7c2859cdcf6a31b9734c8f1ee38e7e391aeafaef91967b6ce819b6b",
|
||
},
|
||
"io_bazel_rules_scala_scala_library": {
|
||
"artifact": "org.scala-lang:scala-library:2.12.12",
|
||
"sha256": "1673ffe8792021f704caddfe92067ed1ec75229907f84380ad68fe621358c925",
|
||
},
|
||
"io_bazel_rules_scala_scala_reflect": {
|
||
"artifact": "org.scala-lang:scala-reflect:2.12.12",
|
||
"sha256": "3c502791757c0c8208f00033d8c4d778ed446efa6f49a6f89b59c6f92b347774",
|
||
},
|
||
},
|
||
)
|
||
|
||
load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains")
|
||
|
||
scala_register_toolchains()
|