daml/test-common/canton/BUILD.bazel
azure-pipelines[bot] 174098ad41
bump canton to 2.8.0-snapshot.20231018.11351.0.v06a2a591 (#17604)
CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Azure Pipelines Daml Build <support@digitalasset.com>
2023-10-20 00:10:22 +02:00

126 lines
3.8 KiB
Python

# Copyright (c) 2023 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"da_scala_library",
"lf_scalacopts_stricter",
)
load("//:canton_dep.bzl", "canton")
load("@build_environment//:configuration.bzl", "artif_pass", "artif_user")
load("@os_info//:os_info.bzl", "is_windows")
java_binary(
name = "canton",
main_class = "com.digitalasset.canton.CantonCommunityApp",
visibility = ["//visibility:public"],
runtime_deps = [
# Do not sort
"//test-common/canton:lib",
],
)
# We replace engine and archive classes in canton
# This should be used for testing only
java_binary(
name = "canton-patched",
main_class = "com.digitalasset.canton.CantonCommunityApp",
visibility = ["//visibility:public"],
runtime_deps = [
# The following prevents buildifier from sorting the deps
# Do not sort
"//daml-lf/engine",
"//daml-lf/archive:daml_lf_archive_reader",
"//test-common/canton:lib",
],
)
genrule(
name = "canton-lib",
srcs = [":lib/canton.jar"] if canton["local"] else ["@canton//:jar"],
outs = ["canton-lib.jar"],
cmd = """
set -euo pipefail
cp $(location {src}) $@
""".format(src = ":lib/canton.jar" if canton["local"] else "@canton//:jar"),
visibility = ["//visibility:public"],
)
java_import(
name = "lib",
jars = [":canton-lib.jar"],
visibility = ["//visibility:public"],
)
genrule(
name = "canton-lib-ee",
# We don't use the else branch but we need a resolvable value
srcs = [":lib/canton-ee.jar"] if canton["local"] else ["@canton//:jar"],
outs = ["canton-lib-ee.jar"],
cmd = """
set -euo pipefail
if [ "{local}" = "true" ]; then
cp $(location {src}) $@
exit 0
fi
CANTON_ENTERPRISE_VERSION=2.8.0-snapshot.20231018.11351.0.v06a2a591
CANTON_ENTERPRISE_SHA=b4c7c4aa7953693996e0559b919640b812703ab733f6c750fb44754de3b910a1
CANTON_ENTERPRISE_URL=https://digitalasset.jfrog.io/artifactory/assembly/daml/canton-backup/2.8.0-snapshot.20231018.11351.0.v06a2a591/b4c7c4aa7953693996e0559b919640b812703ab733f6c750fb44754de3b910a1/canton-enterprise-2.8.0-snapshot.20231018.11351.0.v06a2a591.tar.gz
url=$$CANTON_ENTERPRISE_URL
curl=$(location {curl})
tmp=$$(mktemp)
auth=$$(echo -n "{artif_user}:{artif_pass}" | base64 -w0)
$$curl --location \
--fail \
--insecure \
--silent \
-H "Authorization: Basic $$auth" \
$$url \
> $$tmp || echo >&2 " Failed to download from $$url \n Have you set your ARTIFACTORY_USERNAME and ARTIFACTORY_PASSWORD env vars correctly?"
computed_sha=$$(sha256sum $$tmp | awk '{{print $$1}}')
if [ "$$CANTON_ENTERPRISE_SHA" != "$$computed_sha" ]; then
echo "Wrong sha for canton enterprise jar." >&2
echo "Trying to download from: $$url" >&2
echo "Got: $$computed_sha" >&2
echo "Expected: $$CANTON_ENTERPRISE_SHA" >&2
exit 1
fi
tar xzf $$tmp
cp canton-*/lib/*.jar $@
""".format(
src = ":lib/canton-ee.jar" if canton["local"] else "@canton//:jar", # not used in else case but still must resolve
artif_pass = artif_pass,
artif_user = artif_user,
curl = "@curl_dev_env//:bin/curl" if not is_windows else "@curl_dev_env//:bin/curl.exe",
local = "true" if canton["local"] else "",
),
tags = ["canton-ee"],
tools = [
"@curl_dev_env//:bin/curl" if not is_windows else "@curl_dev_env//:bin/curl.exe",
],
visibility = ["//visibility:public"],
)
java_import(
name = "lib-ee",
jars = [":canton-lib-ee.jar"],
tags = ["canton-ee"],
)
java_binary(
name = "canton-ee",
main_class = "com.digitalasset.canton.CantonEnterpriseApp",
tags = ["canton-ee"],
visibility = ["//ledger-service:__subpackages__"],
runtime_deps = ["//test-common/canton:lib-ee"],
)