mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-10 10:46:11 +03:00
5e962a2b61
This is a first step towards DAML triggers. At the moment, triggers can consume (very simplified) create and archive events via the Ledger API, update a state based on that and emit log mesages at each update. All of this is likely to change significantly in the future, so I would prefer to not focus too much on minor details for now. As a test, I added a simple trigger that tracks active contract ids.
68 lines
1.7 KiB
Python
68 lines
1.7 KiB
Python
# Copyright (c) 2019 The DAML Authors. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
load(
|
|
"//bazel_tools:scala.bzl",
|
|
"da_scala_binary",
|
|
)
|
|
load(
|
|
"//bazel_tools/client_server_test:client_server_test.bzl",
|
|
"client_server_test",
|
|
)
|
|
|
|
genrule(
|
|
name = "acs",
|
|
srcs =
|
|
glob(["**/*.daml"]) + [
|
|
"//triggers/daml:trigger.dar",
|
|
],
|
|
outs = ["acs.dar"],
|
|
cmd = """
|
|
set -eou pipefail
|
|
cat << EOF > daml.yaml
|
|
sdk-version: 0.0.0
|
|
name: acs
|
|
source: triggers/tests/daml
|
|
version: 0.0.1
|
|
dependencies:
|
|
- daml-stdlib
|
|
- daml-prim
|
|
- $(location //triggers/daml:trigger.dar)
|
|
EOF
|
|
|
|
$(location //compiler/damlc) build -o $(location acs.dar)
|
|
""",
|
|
tools = ["//compiler/damlc"],
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
da_scala_binary(
|
|
name = "acs_test_client",
|
|
srcs = glob(["src/**/*.scala"]),
|
|
main_class = "com.daml.trigger.test.AcsMain",
|
|
deps = [
|
|
"//3rdparty/jvm/com/github/scopt",
|
|
"//3rdparty/jvm/com/typesafe/akka:akka_stream",
|
|
"//3rdparty/jvm/org/scalaz:scalaz_core",
|
|
"//daml-lf/archive:daml_lf_archive_scala",
|
|
"//daml-lf/archive:daml_lf_java_proto",
|
|
"//daml-lf/data",
|
|
"//daml-lf/interpreter",
|
|
"//daml-lf/language",
|
|
"//daml-lf/transaction",
|
|
"//language-support/scala/bindings",
|
|
"//language-support/scala/bindings-akka",
|
|
"//ledger-api/rs-grpc-bridge",
|
|
"//triggers/runner:trigger-runner-lib",
|
|
],
|
|
)
|
|
|
|
client_server_test(
|
|
name = "acs_test",
|
|
client = ":acs_test_client",
|
|
client_files = ["$(rootpath :acs.dar)"],
|
|
data = [":acs.dar"],
|
|
server = "//ledger/sandbox:sandbox-binary",
|
|
server_files = ["$(rootpath :acs.dar)"],
|
|
)
|