mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-10 10:46:11 +03:00
66b407467f
* Try to upgrade protobuf docs plugin changelog_begin changelog_end * Fix extension number 65020 is already registered Building `//ledger-api/grpc-definitions:ledger-api-docs` [failed with](https://github.com/digital-asset/daml/issues/11761#issuecomment-978947565) ``` panic: proto: extension number 65020 is already registered on message google.protobuf.FieldOptions ``` Go dependencies are now pulled in via Gazelle. By default Gazelle will generate new proto rules for any `.proto` files encountered in third party Go dependencies. However, many of these already have pregenerated `.pb.go` files generate with the appropriate configuration. The problem can be avoided by configuring Gazelle to not generate new proto rules, but instead use pre-existing `.pb.go` files. For reference the field number is set in [go-proto-validators](32a686adf8/validator.proto (L19)
) which is an indirect dependency through protoc-gen-doc. In this case we need to update protoc-gen-validate to v0.6.2 to include4f41f10dde
which fixes unknown label errors. * ./fmt * Expose gRPC status.proto for Haskell bindings * Update Gazelle to support embedsrcs on Windows `protoc-gen-doc` relies on `go:embed` file embedding2dde01902b/resources.go (L8)
. Gazelle supports `embedsrcs`, however, it did not generate the attribute correctly on Windows due to the different directory separator. This is fixed in https://github.com/bazelbuild/bazel-gazelle/pull/1101. * Add gazelle to compatibility workspace It's loaded into `@daml`'s top-level `BUILD` file and ends up being a dependency of the compatibility workspace as well. * shift go_googleapis import * Delete dead code protobuf is imported transitively. * Document how to add Go dependencies Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org> Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
375 lines
10 KiB
Python
375 lines
10 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_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_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.7",
|
||
) 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.7",
|
||
)
|
||
|
||
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_10",
|
||
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", "dadew_java_configure", "nixpkgs_java_configure")
|
||
|
||
dadew_java_configure(
|
||
name = "dadew_java_runtime",
|
||
dadew_path = "ojdkbuild11",
|
||
) if is_windows else None
|
||
|
||
nixpkgs_java_configure(
|
||
attribute_path = "jdk11.home",
|
||
nix_file = "@daml//nix:bazel.nix",
|
||
nix_file_deps = common_nix_file_deps,
|
||
repositories = dev_env_nix_repos,
|
||
) 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(latest_stable_version),
|
||
"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.16".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")
|