2023-05-11 02:15:26 +03:00
|
|
|
# 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",
|
|
|
|
)
|
2023-06-01 18:06:35 +03:00
|
|
|
load("//:canton_dep.bzl", "canton")
|
2023-07-27 02:12:22 +03:00
|
|
|
load("@build_environment//:configuration.bzl", "artif_pass", "artif_user")
|
2023-06-27 12:00:24 +03:00
|
|
|
load("@os_info//:os_info.bzl", "is_windows")
|
2023-05-11 02:15:26 +03:00
|
|
|
|
|
|
|
java_binary(
|
|
|
|
name = "canton",
|
|
|
|
main_class = "com.digitalasset.canton.CantonCommunityApp",
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
runtime_deps = [
|
|
|
|
# Do not sort
|
2023-06-01 18:06:35 +03:00
|
|
|
"//canton:lib",
|
2023-05-11 02:15:26 +03:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
# 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",
|
2023-06-01 18:06:35 +03:00
|
|
|
"//canton:lib",
|
2023-05-11 02:15:26 +03:00
|
|
|
],
|
|
|
|
)
|
2023-06-01 18:06:35 +03:00
|
|
|
|
|
|
|
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"],
|
|
|
|
)
|
2023-06-27 12:00:24 +03:00
|
|
|
|
|
|
|
genrule(
|
|
|
|
name = "canton-lib-ee",
|
|
|
|
# We don't use the else branch but we need a resolvable value
|
2023-07-12 18:53:32 +03:00
|
|
|
srcs = [":lib/canton-ee.jar"] if canton["local"] else ["@canton//:jar"],
|
2023-06-27 12:00:24 +03:00
|
|
|
outs = ["canton-lib-ee.jar"],
|
|
|
|
cmd = """
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
if [ "{local}" = "true" ]; then
|
|
|
|
cp $(location {src}) $@
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2023-09-29 12:41:31 +03:00
|
|
|
CANTON_ENTERPRISE_VERSION=2.8.0-snapshot.20230928.11251.0.v45432592
|
|
|
|
CANTON_ENTERPRISE_SHA=7e8cca83780bd69257e5973dda828f27b033754ebe1d6a9ce234f14b9efdd5c5
|
|
|
|
CANTON_ENTERPRISE_URL=https://digitalasset.jfrog.io/artifactory/assembly/daml/canton-backup/2.8.0-snapshot.20230928.11251.0.v45432592/7e8cca83780bd69257e5973dda828f27b033754ebe1d6a9ce234f14b9efdd5c5/canton-enterprise-2.8.0-snapshot.20230928.11251.0.v45432592.tar.gz
|
2023-06-27 12:00:24 +03:00
|
|
|
|
2023-09-18 19:16:24 +03:00
|
|
|
url=$$CANTON_ENTERPRISE_URL
|
2023-06-27 12:00:24 +03:00
|
|
|
|
|
|
|
curl=$(location {curl})
|
|
|
|
|
|
|
|
tmp=$$(mktemp)
|
2023-07-27 02:12:22 +03:00
|
|
|
auth=$$(echo -n "{artif_user}:{artif_pass}" | base64 -w0)
|
2023-06-27 12:00:24 +03:00
|
|
|
$$curl --location \
|
|
|
|
--fail \
|
|
|
|
--insecure \
|
|
|
|
--silent \
|
2023-07-27 02:12:22 +03:00
|
|
|
-H "Authorization: Basic $$auth" \
|
2023-06-27 12:00:24 +03:00
|
|
|
$$url \
|
2023-07-27 02:12:22 +03:00
|
|
|
> $$tmp || echo >&2 " Failed to download from $$url \n Have you set your ARTIFACTORY_USERNAME and ARTIFACTORY_PASSWORD env vars correctly?"
|
2023-06-27 12:00:24 +03:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2023-08-23 11:54:29 +03:00
|
|
|
cp canton-*/lib/*.jar $@
|
2023-06-27 12:00:24 +03:00
|
|
|
""".format(
|
2023-09-01 16:15:36 +03:00
|
|
|
src = ":lib/canton-ee.jar" if canton["local"] else "@canton//:jar", # not used in else case but still must resolve
|
2023-07-27 02:12:22 +03:00
|
|
|
artif_pass = artif_pass,
|
2023-09-01 16:15:36 +03:00
|
|
|
artif_user = artif_user,
|
2023-06-27 12:00:24 +03:00
|
|
|
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"],
|
|
|
|
)
|
2023-06-29 12:03:32 +03:00
|
|
|
|
|
|
|
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__"],
|
2023-08-23 11:54:29 +03:00
|
|
|
runtime_deps = ["//canton:lib-ee"],
|
2023-06-29 12:03:32 +03:00
|
|
|
)
|