daml/deps.bzl

376 lines
17 KiB
Python
Raw Normal View History

# Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
2019-04-04 11:33:38 +03:00
# 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")
2019-04-04 11:33:38 +03:00
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
2019-04-04 11:33:38 +03:00
Disable writing volatile bits in Scala statsfile (#11875) Make Scala targets deterministic by disabling writing milliseconds timestamps into the statsfile. Before (cache disabled) ``` $ n=1; bazel clean; bazel build //libs-scala/adjustable-clock --execution_log_json_file=execlog$n.json; rsync -aL bazel-bin output$n $ n=2; bazel clean; bazel build //libs-scala/adjustable-clock --execution_log_json_file=execlog$n.json; rsync -aL bazel-bin output$n $ diff -u execlog1.json execlog2.json --- execlog1.json 2021-11-25 09:53:45.638891575 +0100 +++ execlog2.json 2021-11-25 10:01:52.831225558 +0100 @@ -311392,7 +311392,7 @@ }, { "path": "bazel-out/k8-opt/bin/external/io_bazel_rules_scala/third_party/dependency_analyzer/src/main/scala_version.statsfile", "digest": { - "hash": "1c535baa94812c16d33b6b3dcf2dec8e12b77e3a28cd1280ca2c9678840c4de6", + "hash": "a7f6f1b168649c1c5346ff92c69f0095b68781690e4b3f33321d8f35af8b3d77", "sizeBytes": "16", "hashFunctionName": "SHA-256" } @@ -311705,7 +311705,7 @@ }, { "path": "bazel-out/k8-opt/bin/external/io_bazel_rules_scala/third_party/dependency_analyzer/src/main/dependency_analyzer.statsfile", "digest": { - "hash": "b3af662512a906ec56abfb222f43af189b88b00ae0449bd44c25b7e90689c4db", + "hash": "d6c6e2a36754efea4863593a838fbfb500a66e0150d3c3e2e2490ad65c22a2cd", "sizeBytes": "16", "hashFunctionName": "SHA-256" } @@ -312025,7 +312025,7 @@ }, { "path": "bazel-out/k8-opt/bin/libs-scala/adjustable-clock/adjustable-clock.statsfile", "digest": { - "hash": "4326088227e5ecf2c21e76ddb6d77c9692ef1689dd146f65ec1e75c235382251", + "hash": "8a6b23f3c64ce3ff171772808ca0064af52bc145a32d1b6398de124aeb813c97", "sizeBytes": "16", "hashFunctionName": "SHA-256" } $ diff -r output1 output2 diff -ur output1/bazel-bin/external/io_bazel_rules_scala/third_party/dependency_analyzer/src/main/dependency_analyzer.statsfile output2/bazel-bin/external/io_bazel_rules_scala/third_party/dependency_analyzer/src/main/dependency_analyzer.statsfile --- output1/bazel-bin/external/io_bazel_rules_scala/third_party/dependency_analyzer/src/main/dependency_analyzer.statsfile 2021-11-25 09:53:41.706824833 +0100 +++ output2/bazel-bin/external/io_bazel_rules_scala/third_party/dependency_analyzer/src/main/dependency_analyzer.statsfile 2021-11-25 10:01:49.047160467 +0100 @@ -1 +1 @@ -build_time=2507 +build_time=2522 diff -ur output1/bazel-bin/external/io_bazel_rules_scala/third_party/dependency_analyzer/src/main/scala_version.statsfile output2/bazel-bin/external/io_bazel_rules_scala/third_party/dependency_analyzer/src/main/scala_version.statsfile --- output1/bazel-bin/external/io_bazel_rules_scala/third_party/dependency_analyzer/src/main/scala_version.statsfile 2021-11-25 09:53:39.110780774 +0100 +++ output2/bazel-bin/external/io_bazel_rules_scala/third_party/dependency_analyzer/src/main/scala_version.statsfile 2021-11-25 10:01:46.427115402 +0100 @@ -1 +1 @@ -build_time=4162 +build_time=3946 diff -ur output1/bazel-bin/libs-scala/adjustable-clock/adjustable-clock.statsfile output2/bazel-bin/libs-scala/adjustable-clock/adjustable-clock.statsfile --- output1/bazel-bin/libs-scala/adjustable-clock/adjustable-clock.statsfile 2021-11-25 09:53:45.282885532 +0100 +++ output2/bazel-bin/libs-scala/adjustable-clock/adjustable-clock.statsfile 2021-11-25 10:01:52.511220053 +0100 @@ -1 +1 @@ -build_time=3158 +build_time=3100 ``` After (cache disabled) ``` $ n=3; bazel clean; bazel build //libs-scala/adjustable-clock --execution_log_json_file=execlog$n.json; rsync -aL bazel-bin output$n $ n=4; bazel clean; bazel build //libs-scala/adjustable-clock --execution_log_json_file=execlog$n.json; rsync -aL bazel-bin output$n $ diff -u execlog3.json execlog4.json $ diff -ur output3 output4 ``` See https://github.com/bazelbuild/rules_scala/pull/1298 changelog_begin changelog_end Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2021-11-25 14:01:17 +03:00
rules_scala_version = "17791a18aa966cdf2babb004822e6c70a7decc76"
rules_scala_sha256 = "6899cddf7407d09266dddcf6faf9f2a8b414de5e2b35ef8b294418f559172f28"
rules_haskell_version = "e2a74e5c29588f2107daae7c438e0d4117fcafb3"
rules_haskell_sha256 = "db8bf1813a07948269e622f646be3e7acc2799664fce548ed6c1afbe141d7085"
rules_haskell_patches = [
# This is a daml specific patch and not upstreamable.
"@com_github_digital_asset_daml//bazel_tools:haskell-windows-extra-libraries.patch",
# This should be made configurable in rules_haskell.
# Remove this patch once that's available.
"@com_github_digital_asset_daml//bazel_tools:haskell-opt.patch",
# This should be upstreamed
"@com_github_digital_asset_daml//bazel_tools:haskell-rts-docs.patch",
# This should be upstreamed
"@com_github_digital_asset_daml//bazel_tools:haskell-ghc-includes.patch",
]
Revert "Switch to Bazel 5 (#12935)" (#12974) This reverts commit 4c0118df4d0304153e8f6ed9e3cfb1a1295876df. This breaks passing -p to bazel test for Haskell tests, e.g., bazel test //compiler/damlc/tests:integration-v1dev --test_arg -p --test_arg InterfaceEq which breaks with something horrifying like moritz@adjunction ~/daml (main)> bazel test //compiler/damlc/tests:integration-v1dev --test_arg -p --test_arg InterfaceEq [dev-env] Building tools.bazel... [dev-env] Built tools.bazel in /nix/store/m7gzlmr0pqjpl01ihgvazxgfs3sfwl61-bazel and linked to /home/moritz/daml/dev-env/var/gc-roots/bazel [dev-env] Building tools.find... [dev-env] Built tools.find in /nix/store/645v3545lcbx77wq7355rgdrgbhn5wx7-findutils-4.8.0 and linked to /home/moritz/daml/dev-env/var/gc-roots/find INFO: Invocation ID: 034b3e45-851f-472e-ab71-b7f718829582 DEBUG: /home/moritz/.cache/bazel/_bazel_moritz/bb4e4404f889dc1b816f246b08c0d9ea/external/rules_haskell/haskell/private/versions.bzl:60:10: WARNING: bazel version is too recent. Supported versions range from 4.0.0 to 4.2.1, but found: 5.0.0- (@non-git) /nix/store/dadkhf8vch2i2kvig962ilfr5j3chshr-go-1.17.6 /nix/store/pzh24n543i6jqa01hdmgqknlyf294bn1-bazel-nixpkgs-posix-toolchain /nix/store/2hfwndk47wpvaib06qyhcdp83b423xvh-jq-1.6-bin /nix/store/hjggs9s82qh7r5j8sgapn389hf24wdx8-bazel-nixpkgs-cc-toolchain /nix/store/yxgg3bn4v288sc00kf09svrwz2r461c9-ghc-native-bignum-9.0.2 /nix/store/2hwx0jhcdsx3wfvmb50ih19jkh2ra4jh-glibc-locales-2.33-108 /nix/store/8wpmx049z8m0ffhy3jyi41qb6pbxwvy8-bazel-nixpkgs-java-runtime ERROR: file 'external/bazel_tools/src/tools/launcher/_objs/launcher/dummy.pic.o' is generated by these conflicting actions: Label: @bazel_tools//src/tools/launcher:launcher RuleClass: cc_binary rule Configuration: 869f6bbd14d2ac66dcacb164312d88fa059b017e3c17513cb5051b23879ac7f9, 8c138cc79f95329f01b0d325511ad0ea89ca5126e421e67e5239706d0f247c2c Mnemonic: CppCompile Action key: 3d79fe1470dcb842d5944c98dfe7a62715db6d86fdb12d3ff60af3bdf41b7996 Progress message: Compiling src/tools/launcher/dummy.cc PrimaryInput: File:[/home/moritz/.cache/bazel/_bazel_moritz/bb4e4404f889dc1b816f246b08c0d9ea/external/bazel_tools[source]]src/tools/launcher/dummy.cc PrimaryOutput: File:[[<execution_root>]bazel-out/k8-opt/bin]external/bazel_tools/src/tools/launcher/_objs/launcher/dummy.pic.o Owner information: ConfiguredTargetKey{label=@bazel_tools//src/tools/launcher:launcher, config=BuildConfigurationValue.Key[869f6bbd14d2ac66dcacb164312d88fa059b017e3c17513cb5051b23879ac7f9]}, ConfiguredTargetKey{label=@bazel_tools//src/tools/launcher:launcher, config=BuildConfigurationValue.Key[8c138cc79f95329f01b0d325511ad0ea89ca5126e421e67e5239706d0f247c2c]} MandatoryInputs: are equal Outputs: are equal ERROR: file 'external/bazel_tools/src/tools/launcher/_objs/launcher/dummy.o' is generated by these conflicting actions: Label: @bazel_tools//src/tools/launcher:launcher RuleClass: cc_binary rule Configuration: 869f6bbd14d2ac66dcacb164312d88fa059b017e3c17513cb5051b23879ac7f9, 8c138cc79f95329f01b0d325511ad0ea89ca5126e421e67e5239706d0f247c2c Mnemonic: CppCompile Action key: 9f46e824944add9e9951ef51ddb6cb4b744bc97f90b5749132179d1d1699dfa1 Progress message: Compiling src/tools/launcher/dummy.cc PrimaryInput: File:[/home/moritz/.cache/bazel/_bazel_moritz/bb4e4404f889dc1b816f246b08c0d9ea/external/bazel_tools[source]]src/tools/launcher/dummy.cc PrimaryOutput: File:[[<execution_root>]bazel-out/k8-opt/bin]external/bazel_tools/src/tools/launcher/_objs/launcher/dummy.o Owner information: ConfiguredTargetKey{label=@bazel_tools//src/tools/launcher:launcher, config=BuildConfigurationValue.Key[869f6bbd14d2ac66dcacb164312d88fa059b017e3c17513cb5051b23879ac7f9]}, ConfiguredTargetKey{label=@bazel_tools//src/tools/launcher:launcher, config=BuildConfigurationValue.Key[8c138cc79f95329f01b0d325511ad0ea89ca5126e421e67e5239706d0f247c2c]} MandatoryInputs: are equal Outputs: are equal ERROR: com.google.devtools.build.lib.skyframe.ArtifactConflictFinder$ConflictException: com.google.devtools.build.lib.actions.MutableActionGraph$ActionConflictException: for external/bazel_tools/src/tools/launcher/_objs/launcher/dummy.o, previous action: action 'Compiling src/tools/launcher/dummy.cc', attempted action: action 'Compiling src/tools/launcher/dummy.cc' changelog_begin changelog_end
2022-02-16 21:24:00 +03:00
rules_nixpkgs_version = "81f61c4b5afcf50665b7073f7fce4c1755b4b9a3"
rules_nixpkgs_sha256 = "33fd540d0283cf9956d0a5a640acb1430c81539a84069114beaf9640c96d221a"
rules_nixpkgs_patches = [
# On CI and locally we observe occasional segmantation faults
# of nix. A known issue since Nix 2.2.2 is that HTTP2 support
# can cause such segmentation faults. Since Nix 2.3.2 it is
# possible to disable HTTP2 via a command-line flag, which
# reportedly solves the issue. See
# https://github.com/NixOS/nix/issues/2733#issuecomment-518324335
"@com_github_digital_asset_daml//bazel_tools:nixpkgs-disable-http2.patch",
]
buildifier_version = "4.0.0"
buildifier_sha256 = "0d3ca4ed434958dda241fb129f77bd5ef0ce246250feed2d5a5470c6f29a77fa"
zlib_version = "1.2.11"
zlib_sha256 = "629380c90a77b964d896ed37163f5c3a34f6e6d897311f1df2a7016355c45eff"
rules_nodejs_version = "4.6.1"
rules_nodejs_sha256 = "d63ecec7192394f5cc4ad95a115f8a6c9de55c60d56c1f08da79c306355e4654"
rules_jvm_external_version = "3.3"
rules_jvm_external_sha256 = "d85951a92c0908c80bd8551002d66cb23c3434409c814179c0ff026b53544dab"
rules_go_version = "0.29.0"
rules_go_sha256 = "2b1641428dff9018f9e85c0384f03ec6c10660d935b750e3fa1492a281a53b0f"
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_version = "67a3e22af6547f43bb9b8e4dd0bad5f354ad4e60"
bazel_gazelle_sha256 = "c71b12d890d1e299e012bfa6f08dc3d9e57281a0955dc28a1e9c16769d556203"
rules_bazel_common_version = "9e3880428c1837db9fb13335ed390b7e33e346a7"
rules_bazel_common_sha256 = "5290e0c8e0b7639f20b70f8d0046b50ad340cb55a4733545f6ec8f43af8727fe"
# Recent davl.
davl_version = "f2d7480d118f32626533d6a150a8ee7552cc0222" # 2020-03-23, "Deploy upgrade to SDK 0.13.56-snapshot.20200318",https://github.com/digital-asset/davl/pull/233/commits.
davl_sha256 = "3e8ae2a05724093e33b7f0363381e81a7e8e9655ccb3aa47ad540ea87e814321"
# Pinned davl relied on by damlc packaging tests.
davl_v3_version = "51d3977be2ab22f7f4434fd4692ca2e17a7cce23"
davl_v3_sha256 = "e8e76e21b50fb3adab36df26045b1e8c3ee12814abc60f137d39b864d2eae166"
# daml cheat sheet
daml_cheat_sheet_version = "2710b8df28d97253b5487a68feb2d1452d29fc54" # 2021-09-17
daml_cheat_sheet_sha256 = "eb022565a929a69d869f0ab0497f02d1a3eacb4dafdafa076a82ecbe7c401315"
platforms_version = "0.0.3"
platforms_sha256 = "15b66b5219c03f9e8db34c1ac89c458bb94bfe055186e5505d5c6f09cb38307f"
2019-04-04 11:33:38 +03:00
def daml_deps():
if "platforms" not in native.existing_rules():
http_archive(
name = "platforms",
sha256 = platforms_sha256,
strip_prefix = "platforms-{}".format(platforms_version),
urls = ["https://github.com/bazelbuild/platforms/archive/{version}.tar.gz".format(version = platforms_version)],
)
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 = rules_haskell_patches,
patch_args = ["-p1"],
sha256 = rules_haskell_sha256,
)
2019-04-04 11:33:38 +03:00
if "io_tweag_rules_nixpkgs" not in native.existing_rules():
http_archive(
name = "io_tweag_rules_nixpkgs",
strip_prefix = "rules_nixpkgs-%s" % rules_nixpkgs_version,
urls = ["https://github.com/tweag/rules_nixpkgs/archive/%s.tar.gz" % rules_nixpkgs_version],
sha256 = rules_nixpkgs_sha256,
patches = rules_nixpkgs_patches,
patch_args = ["-p1"],
)
2019-04-04 11:33:38 +03:00
if "com_github_madler_zlib" not in native.existing_rules():
http_archive(
name = "com_github_madler_zlib",
build_file = "@com_github_digital_asset_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,
)
2019-04-04 11:33:38 +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 "go_googleapis" not in native.existing_rules():
# The Haskell gRPC bindings require access to the status.proto source file.
# This import of go_googleapis is taken from rules_go and extended with the status.proto patch.
http_archive(
name = "go_googleapis",
# master, as of 2021-10-06
urls = [
"https://mirror.bazel.build/github.com/googleapis/googleapis/archive/409e134ffaacc243052b08e6fb8e2d458014ed37.zip",
"https://github.com/googleapis/googleapis/archive/409e134ffaacc243052b08e6fb8e2d458014ed37.zip",
],
sha256 = "a85c6a00e9cf0f004992ebea1d10688e3beea9f8e1a5a04ee53f367e72ee85af",
strip_prefix = "googleapis-409e134ffaacc243052b08e6fb8e2d458014ed37",
patches = [
# releaser:patch-cmd find . -name BUILD.bazel -delete
"@io_bazel_rules_go//third_party:go_googleapis-deletebuild.patch",
# set gazelle directives; change workspace name
"@io_bazel_rules_go//third_party:go_googleapis-directives.patch",
# releaser:patch-cmd gazelle -repo_root .
"@io_bazel_rules_go//third_party:go_googleapis-gazelle.patch",
# The Haskell gRPC bindings require access to the status.proto source file.
"//bazel_tools:googleapis-status-proto.patch",
],
patch_args = ["-E", "-p1"],
)
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,
)
2019-04-04 11:33:38 +03:00
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 = [
"@com_github_digital_asset_daml//bazel_tools:scala-escape-jvmflags.patch",
],
patch_args = ["-p1"],
)
2019-04-04 11:33:38 +03:00
if "bazel_gazelle" not in native.existing_rules():
http_archive(
name = "bazel_gazelle",
urls = [
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
"https://github.com/bazelbuild/bazel-gazelle/archive/{version}/bazel-gazelle-{version}.tar.gz".format(version = bazel_gazelle_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
strip_prefix = "bazel-gazelle-{version}".format(version = bazel_gazelle_version),
sha256 = bazel_gazelle_sha256,
)
2019-04-04 11:33:38 +03:00
if "io_bazel_rules_sass" not in native.existing_rules():
http_archive(
name = "io_bazel_rules_sass",
sha256 = "7b9c9a88099d00dbb16be359c3b1946309d99673220c6b39c7e8bda8ecc692f8",
strip_prefix = "rules_sass-1.24.4",
urls = [
"https://github.com/bazelbuild/rules_sass/archive/1.24.4.zip",
"https://mirror.bazel.build/github.com/bazelbuild/rules_sass/archive/1.24.4.zip",
],
)
2019-04-04 11:33:38 +03:00
# Fetch rules_nodejs so we can install our npm dependencies
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
"@com_github_digital_asset_daml//bazel_tools:rules_nodejs_npm_cli_path.patch",
"@com_github_digital_asset_daml//bazel_tools:rules_nodejs_node_dependency.patch",
],
patch_args = ["-p1"],
)
2019-04-04 11:33:38 +03:00
if "com_github_grpc_grpc" not in native.existing_rules():
http_archive(
name = "com_github_grpc_grpc",
strip_prefix = "grpc-1.44.0",
urls = ["https://github.com/grpc/grpc/archive/v1.44.0.tar.gz"],
sha256 = "8c05641b9f91cbc92f51cc4a5b3a226788d7a63f20af4ca7aaca50d92cc94a0d",
patches = [
"@com_github_digital_asset_daml//bazel_tools:grpc-bazel-mingw.patch",
],
patch_args = ["-p1"],
)
if "com_google_protobuf" not in native.existing_rules():
http_archive(
name = "com_google_protobuf",
sha256 = "4dd35e788944b7686aac898f77df4e9a54da0ca694b8801bd6b2a9ffc1b3085e",
strip_prefix = "protobuf-3.19.2",
urls = [
"https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.19.2.tar.gz",
],
)
if "io_grpc_grpc_java" not in native.existing_rules():
http_archive(
name = "io_grpc_grpc_java",
strip_prefix = "grpc-java-1.44.0",
urls = ["https://github.com/grpc/grpc-java/archive/v1.44.0.tar.gz"],
sha256 = "e3781bcab2a410a7cd138f13b2e6a643e111575f6811b154c570f4d020e87507",
patch_args = ["-p1"],
)
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
)
if "com_github_bazelbuild_remote_apis" not in native.existing_rules():
http_archive(
name = "com_github_bazelbuild_remote_apis",
strip_prefix = "remote-apis-2.0.0",
urls = ["https://github.com/bazelbuild/remote-apis/archive/v2.0.0.tar.gz"],
sha256 = "79204ed1fa385c03b5235f65b25ced6ac51cf4b00e45e1157beca6a28bdb8043",
patches = ["@com_github_digital_asset_daml//:bazel_tools/remote_apis_no_services.patch"],
patch_args = ["-p1"],
)
# Buildifier.
# It is written in Go and hence needs rules_go to be available.
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),
)
native.bind(
name = "guava",
actual = "@com_google_guava_guava//jar",
)
native.bind(
name = "gson",
actual = "@com_google_code_gson_gson//jar",
)
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)],
)
maybe(
http_archive,
name = "rules_pkg",
urls = [
"https://github.com/bazelbuild/rules_pkg/releases/download/0.2.6-1/rules_pkg-0.2.6.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.2.6/rules_pkg-0.2.6.tar.gz",
],
sha256 = "aeca78988341a2ee1ba097641056d168320ecc51372ef7ff8e64b139516a4937",
)
if "com_github_grpc_ecosystem_grpc_health_probe_binary" not in native.existing_rules():
http_file(
name = "com_github_grpc_ecosystem_grpc_health_probe_binary",
sha256 = "bfbe82e34645e91cdf3bacbb0d2dc7786f3c3cc4da6b64a446e5fdfb7bb0429f",
downloaded_file_path = "grpc-health-probe",
urls = [
"https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/v0.3.1/grpc_health_probe-linux-amd64",
],
executable = True,
)
if "daml-cheat-sheet" not in native.existing_rules():
http_archive(
name = "daml-cheat-sheet",
strip_prefix = "daml-cheat-sheet-{}".format(daml_cheat_sheet_version),
urls = ["https://github.com/digital-asset/daml-cheat-sheet/archive/{}.tar.gz".format(daml_cheat_sheet_version)],
sha256 = daml_cheat_sheet_sha256,
build_file_content = """
package(default_visibility = ["//visibility:public"])
genrule(
name = "site",
srcs = ["_config.yml"] + glob(["**/*"],
exclude = ["_config.yml", "LICENSE", "WORKSPACE", "BUILD.bazel", "README.md"]),
outs = ["cheat-sheet.tar.gz"],
tools = ["@jekyll_nix//:bin/jekyll"],
cmd = '''
DIR=$$(dirname $(execpath _config.yml))
$(execpath @jekyll_nix//:bin/jekyll) build -s $$DIR
tar hc _site \\\\
--owner=1000 \\\\
--group=1000 \\\\
--mtime=2000-01-01\\\\ 00:00Z \\\\
--no-acls \\\\
--no-xattrs \\\\
--no-selinux \\\\
--sort=name \\\\
| gzip -n > $(OUTS)
''',
)
""",
)
if "canton" not in native.existing_rules():
http_archive(
name = "canton",
build_file_content = """
package(default_visibility = ["//visibility:public"])
java_import(
name = "lib",
jars = glob(["lib/**/*.jar"]),
)
""",
sha256 = "5b77835398b5e3629f51bc97ad26f3ee01c54622311055954e9c5236d718c1b5",
strip_prefix = "canton-community-1.0.0-SNAPSHOT",
urls = ["https://www.canton.io/releases/canton-community-20220224.tar.gz"],
)
if "freefont" not in native.existing_rules():
http_archive(
name = "freefont",
build_file_content = """
filegroup(
name = "fonts",
srcs = glob(["**/*.otf"]),
visibility = ["//visibility:public"],
)""",
sha256 = "3a6c51868c71b006c33c4bcde63d90927e6fcca8f51c965b8ad62d021614a860",
strip_prefix = "freefont-20120503",
urls = ["http://ftp.gnu.org/gnu/freefont/freefont-otf-20120503.tar.gz"],
)