daml/compatibility/deps.bzl

191 lines
7.6 KiB
Python
Raw Normal View History

# Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# The dependencies of the daml workspace.
# This allows using the daml workspace externally
# from another bazel workspace.
#
# For example, another Bazel project can depend on
# targets in the daml repository by doing:
# ---
# local_repository(
# name = "com_github_digital_asset_daml",
# path = "/path/to/daml"
# )
# load("@com_github_digital_asset_daml//:deps.bzl", "daml_deps")
# daml_deps()
# ---
#
# A 3rd-party consumer would also need to register relevant
# toolchains and repositories in order to build targets.
# That is, copy some setup calls from WORKSPACE into the
# other WORKSPACE.
#
# Make sure to reference repository local files with the full
# prefix: @com_github_digital_asset_daml//..., as these won't
# be resolvable from external workspaces otherwise.
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load(
"@daml//:deps.bzl",
Update protobuf docs plugin (#11880) * 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](https://github.com/mwitkow/go-proto-validators/blob/32a686adf8b5194d3ea07d632d49b6fb344af678/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 include https://github.com/envoyproxy/protoc-gen-validate/commit/4f41f10dde19ec4dd9dd8cf6f7537139f52fb58b 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 embedding https://github.com/pseudomuto/protoc-gen-doc/blob/2dde01902b28e8b2201d935467bc4308ec912255/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>
2021-11-25 23:51:24 +03:00
"bazel_gazelle_sha256",
"bazel_gazelle_version",
"buildifier_sha256",
"buildifier_version",
"rules_bazel_common_sha256",
"rules_bazel_common_version",
Update protobuf docs plugin (#11880) * 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](https://github.com/mwitkow/go-proto-validators/blob/32a686adf8b5194d3ea07d632d49b6fb344af678/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 include https://github.com/envoyproxy/protoc-gen-validate/commit/4f41f10dde19ec4dd9dd8cf6f7537139f52fb58b 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 embedding https://github.com/pseudomuto/protoc-gen-doc/blob/2dde01902b28e8b2201d935467bc4308ec912255/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>
2021-11-25 23:51:24 +03:00
"rules_go_sha256",
"rules_go_version",
"rules_haskell_patches",
"rules_haskell_sha256",
"rules_haskell_version",
"rules_jvm_external_sha256",
"rules_jvm_external_version",
"rules_nixpkgs_patches",
"rules_nixpkgs_sha256",
"rules_nixpkgs_version",
"rules_nodejs_sha256",
"rules_nodejs_version",
"rules_scala_sha256",
"rules_scala_version",
"zlib_sha256",
"zlib_version",
)
Add `platform-version` field to `daml.yaml` (#6736) * Add `platform-version` field to `daml.yaml` This PR adds the `platform-version` field to `daml.yaml`. Based on the approach agreed upon in #6558, the logic for this all sits in `daml-helper` and there are no changes to the assistant. The details of how the logic work are in a comment so I’m not going to repeat them here but the commands that are affected are: - `daml sandbox` - `daml sandbox-classic` - `daml json-api` - `daml start` (but only for sandbox and the JSON API, not for Navigator or anything else) For tests, I’ve added a test to the compat workspace that installs two SDKs simultaneously and tries out various combinations and verifies that we get the correct version. Open to other ideas for testing this but that seemed like the most sensible option that actually tests what we run. changelog_begin - [DAML Assistant] You can now specify the version of Sandbox and the JSON API independently of your SDK version by setting ``platform-version`` in your ``daml.yaml``. This is useful if you are deploying to a ledger that is running components from a different SDK version. See https://docs.daml.com/tools/assistant.html#project-config-file-daml-yaml for details. changelog_end * Run platform-version tests changelog_begin changelog_end * Fix tag globbing changelog_begin changelog_end * fmt changelog_begin changelog_end * . changelog_begin changelog_end * Try to fix env vars changelog_begin changelog_end * Remove hardcoded references to 1.2.0 changelog_begin changelog_end * Rephrase doc comment changelog_begin changelog_end * get things to compile changelog_begin changelog_end * maybe fix things for realz changelog_begin changelog_end * Remove debugging output changelog_begin changelog_end * Get angry at windows changelog_begin changelog_end * why is windows changelog_begin changelog_end * . changelog_begin changelog_end
2020-07-15 17:30:01 +03:00
load("//:versions.bzl", "latest_stable_version", "version_sha256s")
load("@os_info//:os_info.bzl", "os_name")
def daml_deps():
if "rules_haskell" not in native.existing_rules():
http_archive(
name = "rules_haskell",
strip_prefix = "rules_haskell-%s" % rules_haskell_version,
urls = ["https://github.com/tweag/rules_haskell/archive/%s.tar.gz" % rules_haskell_version],
patches = [
p.replace("@com_github_digital_asset_daml", "@daml")
for p in rules_haskell_patches
],
patch_args = ["-p1"],
sha256 = rules_haskell_sha256,
)
if "io_tweag_rules_nixpkgs" not in native.existing_rules():
# N.B. rules_nixpkgs was split into separate components, which need to be loaded separately
#
# See https://github.com/tweag/rules_nixpkgs/issues/182 for the rational
strip_prefix = "rules_nixpkgs-%s" % rules_nixpkgs_version
http_archive(
name = "io_tweag_rules_nixpkgs",
strip_prefix = strip_prefix,
urls = ["https://github.com/tweag/rules_nixpkgs/archive/%s.tar.gz" % rules_nixpkgs_version],
sha256 = rules_nixpkgs_sha256,
patches = [
p.replace("@com_github_digital_asset_daml", "@daml")
for p in rules_nixpkgs_patches
],
patch_args = ["-p1"],
)
http_archive(
name = "rules_nixpkgs_core",
strip_prefix = strip_prefix + "/core",
urls = ["https://github.com/tweag/rules_nixpkgs/archive/%s.tar.gz" % rules_nixpkgs_version],
sha256 = rules_nixpkgs_sha256,
patches = [
p.replace("@com_github_digital_asset_daml", "@daml")
for p in rules_nixpkgs_patches
],
patch_args = ["-p2"],
)
for toolchain in ["cc", "java", "python", "go", "rust", "posix"]:
http_archive(
name = "rules_nixpkgs_" + toolchain,
strip_prefix = strip_prefix + "/toolchains/" + toolchain,
urls = ["https://github.com/tweag/rules_nixpkgs/archive/%s.tar.gz" % rules_nixpkgs_version],
sha256 = rules_nixpkgs_sha256,
)
if "com_github_bazelbuild_buildtools" not in native.existing_rules():
http_archive(
name = "com_github_bazelbuild_buildtools",
sha256 = buildifier_sha256,
strip_prefix = "buildtools-{}".format(buildifier_version),
url = "https://github.com/bazelbuild/buildtools/archive/{}.tar.gz".format(buildifier_version),
)
if "com_github_madler_zlib" not in native.existing_rules():
http_archive(
name = "com_github_madler_zlib",
build_file = "@daml//3rdparty/c:zlib.BUILD",
strip_prefix = "zlib-{}".format(zlib_version),
urls = ["https://github.com/madler/zlib/archive/v{}.tar.gz".format(zlib_version)],
sha256 = zlib_sha256,
)
if "build_bazel_rules_nodejs" not in native.existing_rules():
http_archive(
name = "build_bazel_rules_nodejs",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/{}/rules_nodejs-{}.tar.gz".format(rules_nodejs_version, rules_nodejs_version)],
sha256 = rules_nodejs_sha256,
patches = [
# Work around for https://github.com/bazelbuild/rules_nodejs/issues/1565
"@daml//bazel_tools:rules_nodejs_npm_cli_path.patch",
# Enforces a dependency of the rules_nodejs workspace on the
# workspace providing node.
"@daml//bazel_tools:rules_nodejs_node_dependency.patch",
],
patch_args = ["-p1"],
)
if "rules_jvm_external" not in native.existing_rules():
http_archive(
name = "rules_jvm_external",
strip_prefix = "rules_jvm_external-{}".format(rules_jvm_external_version),
sha256 = rules_jvm_external_sha256,
url = "https://github.com/bazelbuild/rules_jvm_external/archive/{}.zip".format(rules_jvm_external_version),
)
if "io_bazel_rules_scala" not in native.existing_rules():
http_archive(
name = "io_bazel_rules_scala",
url = "https://github.com/bazelbuild/rules_scala/archive/%s.tar.gz" % rules_scala_version,
strip_prefix = "rules_scala-%s" % rules_scala_version,
sha256 = rules_scala_sha256,
patches = [
"@daml//bazel_tools:scala-escape-jvmflags.patch",
],
patch_args = ["-p1"],
)
Add `platform-version` field to `daml.yaml` (#6736) * Add `platform-version` field to `daml.yaml` This PR adds the `platform-version` field to `daml.yaml`. Based on the approach agreed upon in #6558, the logic for this all sits in `daml-helper` and there are no changes to the assistant. The details of how the logic work are in a comment so I’m not going to repeat them here but the commands that are affected are: - `daml sandbox` - `daml sandbox-classic` - `daml json-api` - `daml start` (but only for sandbox and the JSON API, not for Navigator or anything else) For tests, I’ve added a test to the compat workspace that installs two SDKs simultaneously and tries out various combinations and verifies that we get the correct version. Open to other ideas for testing this but that seemed like the most sensible option that actually tests what we run. changelog_begin - [DAML Assistant] You can now specify the version of Sandbox and the JSON API independently of your SDK version by setting ``platform-version`` in your ``daml.yaml``. This is useful if you are deploying to a ledger that is running components from a different SDK version. See https://docs.daml.com/tools/assistant.html#project-config-file-daml-yaml for details. changelog_end * Run platform-version tests changelog_begin changelog_end * Fix tag globbing changelog_begin changelog_end * fmt changelog_begin changelog_end * . changelog_begin changelog_end * Try to fix env vars changelog_begin changelog_end * Remove hardcoded references to 1.2.0 changelog_begin changelog_end * Rephrase doc comment changelog_begin changelog_end * get things to compile changelog_begin changelog_end * maybe fix things for realz changelog_begin changelog_end * Remove debugging output changelog_begin changelog_end * Get angry at windows changelog_begin changelog_end * why is windows changelog_begin changelog_end * . changelog_begin changelog_end
2020-07-15 17:30:01 +03:00
Update protobuf docs plugin (#11880) * 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](https://github.com/mwitkow/go-proto-validators/blob/32a686adf8b5194d3ea07d632d49b6fb344af678/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 include https://github.com/envoyproxy/protoc-gen-validate/commit/4f41f10dde19ec4dd9dd8cf6f7537139f52fb58b 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 embedding https://github.com/pseudomuto/protoc-gen-doc/blob/2dde01902b28e8b2201d935467bc4308ec912255/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>
2021-11-25 23:51:24 +03:00
if "bazel_gazelle" not in native.existing_rules():
http_archive(
name = "bazel_gazelle",
urls = [
"https://github.com/bazelbuild/bazel-gazelle/archive/{version}/bazel-gazelle-{version}.tar.gz".format(version = bazel_gazelle_version),
],
strip_prefix = "bazel-gazelle-{version}".format(version = bazel_gazelle_version),
sha256 = bazel_gazelle_sha256,
)
if "io_bazel_rules_go" not in native.existing_rules():
http_archive(
name = "io_bazel_rules_go",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v{version}/rules_go-v{version}.zip".format(version = rules_go_version),
"https://github.com/bazelbuild/rules_go/releases/download/v{version}/rules_go-v{version}.zip".format(version = rules_go_version),
],
sha256 = rules_go_sha256,
)
if "com_github_google_bazel_common" not in native.existing_rules():
http_archive(
name = "com_github_google_bazel_common",
sha256 = rules_bazel_common_sha256,
strip_prefix = "bazel-common-{}".format(rules_bazel_common_version),
urls = ["https://github.com/google/bazel-common/archive/{}.tar.gz".format(rules_bazel_common_version)],
)