daml/extractor/BUILD.bazel
Moritz Kiefer b3a5c3b28d
Share test certificates (#4982)
* Share test certificates

This is primarily an attempt at making sure my contribution stats
remain negative but I think it’s a nice cleanup. The only difference
in the certs used by daml-helper which are now used everywhere is that
they use a different CN for the CA and the server. This is required to
make openssl happy (which is used by the daml-helper).

changelog_begin
changelog_end

* Fix script and trigger tests
2020-03-13 12:12:34 +01:00

254 lines
8.5 KiB
Python

# Copyright (c) 2020 The DAML Authors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"da_scala_binary",
"da_scala_library",
"da_scala_test_suite",
)
load(
"//rules_daml:daml.bzl",
"daml_compile",
)
load(
"//daml-lf/language:daml-lf.bzl",
"lf_dev_version",
"lf_stable_version",
)
TEST_DARS = [
"RecordsAndVariants",
"PrimitiveTypes",
"TransactionExample",
]
[
daml_compile(
name = darmod,
main_src = "src/test/resources/damls/%s.daml" % darmod,
# FixMe: https://github.com/digital-asset/daml/issues/2289
# change version to lf_latest_version when freezing numeric in the next language version
target = lf_dev_version,
)
for darmod in TEST_DARS
]
genrule(
name = "VeryLargeArchive_src",
outs = ["VeryLargeArchive/Blobs.daml"] + ["VeryLargeArchive/Blob%s.daml" % n for n in range(
1,
32 + 1,
)],
cmd =
'''
filecount=32
outs=($(OUTS))
main="$${outs[0]}"
echo 'daml 1.2
module VeryLargeArchive.Blobs where
import VeryLargeArchive.Blob1()' > "$$main"
firstfil="$${outs[1]}"
echo 'daml 1.2
module VeryLargeArchive.Blob1 where
' > "$$firstfil"
{ for linen in `seq 1 1024`; do
echo -n "x$$linen = "\\"
for charn in `seq 1 16`; do
echo -n qqqqqqqq
done;
echo \\"
done; } >> $$firstfil
for filen in `seq 2 $$filecount`; do
echo "import VeryLargeArchive.Blob$$filen()" >> "$$main"
sed -e '2s/^\\(module .*\\)1/\\1'$$filen/ "$$firstfil" > "$${outs[$$filen]}"
done
''',
)
daml_compile(
name = "VeryLargeArchive",
srcs = [":VeryLargeArchive_src"],
main_src = ":VeryLargeArchive/Blobs.daml",
)
da_scala_library(
name = "extractor",
srcs = glob(["src/main/scala/**/*.scala"]),
resources = glob(["src/main/resources/**/*"]),
visibility = ["//visibility:public"],
runtime_deps = [
"@maven//:ch_qos_logback_logback_classic",
"@maven//:ch_qos_logback_logback_core",
"@maven//:org_tpolecat_doobie_postgres_2_12",
],
deps = [
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/transaction",
"//language-support/scala/bindings",
"//ledger-api/rs-grpc-akka",
"//ledger-api/rs-grpc-bridge",
"//ledger-service/lf-value-json",
"//ledger-service/utils",
"//ledger/ledger-api-client",
"//ledger/ledger-api-common",
"//ledger/ledger-api-domain",
"//libs-scala/auth-utils",
"//libs-scala/grpc-utils",
"//libs-scala/ports",
"//libs-scala/timer-utils",
"@maven//:com_chuusai_shapeless_2_12",
"@maven//:com_github_scopt_scopt_2_12",
"@maven//:com_lihaoyi_fansi_2_12",
"@maven//:com_lihaoyi_pprint_2_12",
"@maven//:com_lihaoyi_sourcecode_2_12",
"@maven//:com_typesafe_akka_akka_actor_2_12",
"@maven//:com_typesafe_akka_akka_stream_2_12",
"@maven//:com_typesafe_scala_logging_scala_logging_2_12",
"@maven//:io_circe_circe_core_2_12",
"@maven//:io_circe_circe_generic_2_12",
"@maven//:io_circe_circe_parser_2_12",
"@maven//:io_grpc_grpc_netty",
"@maven//:io_netty_netty_handler",
"@maven//:io_spray_spray_json_2_12",
"@maven//:org_scalaz_scalaz_core_2_12",
"@maven//:org_slf4j_slf4j_api",
"@maven//:org_tpolecat_doobie_core_2_12",
"@maven//:org_tpolecat_doobie_free_2_12",
"@maven//:org_typelevel_cats_core_2_12",
"@maven//:org_typelevel_cats_effect_2_12",
"@maven//:org_typelevel_cats_free_2_12",
"@maven//:org_typelevel_cats_kernel_2_12",
],
)
da_scala_binary(
name = "extractor-binary",
main_class = "com.digitalasset.extractor.Main",
tags = [
"maven_coordinates=com.digitalasset:extractor:__VERSION__",
"no_scala_version_suffix",
],
visibility = ["//visibility:public"],
deps = [
":extractor",
],
)
da_scala_library(
name = "extractor-scala-tests-lib",
srcs = glob(["src/test/lib/**/*.scala"]),
runtime_deps = [
"@maven//:ch_qos_logback_logback_classic",
"@maven//:io_grpc_grpc_netty",
"@maven//:org_tpolecat_doobie_postgres_2_12",
],
deps = [
":extractor",
"//daml-lf/data",
"//daml-lf/interface",
"//language-support/scala/bindings",
"//ledger-api/rs-grpc-bridge",
"//ledger-api/testing-utils",
"//ledger-service/utils",
"//ledger/ledger-api-client",
"//ledger/ledger-api-common",
"//ledger/ledger-api-domain",
"//ledger/sandbox",
"//ledger/sandbox:sandbox-scala-tests-lib",
"//libs-scala/auth-utils",
"//libs-scala/ports",
"//libs-scala/postgresql-testing",
"@maven//:com_chuusai_shapeless_2_12",
"@maven//:com_lihaoyi_sourcecode_2_12",
"@maven//:com_typesafe_akka_akka_actor_2_12",
"@maven//:com_typesafe_akka_akka_stream_2_12",
"@maven//:com_typesafe_scala_logging_scala_logging_2_12",
"@maven//:io_circe_circe_core_2_12",
"@maven//:io_circe_circe_parser_2_12",
"@maven//:io_netty_netty_handler",
"@maven//:org_postgresql_postgresql",
"@maven//:org_scalacheck_scalacheck_2_12",
"@maven//:org_scalactic_scalactic_2_12",
"@maven//:org_scalatest_scalatest_2_12",
"@maven//:org_scalaz_scalaz_core_2_12",
"@maven//:org_slf4j_slf4j_api",
"@maven//:org_tpolecat_doobie_core_2_12",
"@maven//:org_tpolecat_doobie_free_2_12",
"@maven//:org_typelevel_cats_core_2_12",
"@maven//:org_typelevel_cats_effect_2_12",
"@maven//:org_typelevel_cats_free_2_12",
"@maven//:org_typelevel_cats_kernel_2_12",
],
)
da_scala_test_suite(
name = "extractor-scala-tests",
size = "medium",
srcs = glob(["src/test/suite/**/*.scala"]),
data = [
"//daml-lf/encoder:testing-dar-dev",
"//daml-lf/encoder:testing-dar-latest",
"//extractor:PrimitiveTypes.dar",
"//extractor:RecordsAndVariants.dar",
"//extractor:TransactionExample.dar",
"//extractor:VeryLargeArchive.dar",
"//ledger/test-common:Test-stable.dar",
"//ledger/test-common/test-certificates",
],
resources = glob(["src/test/resources/**/*"]),
deps = [
":extractor",
":extractor-scala-tests-lib",
"//bazel_tools/runfiles:scala_runfiles",
"//daml-lf/data",
"//daml-lf/data-scalacheck",
"//daml-lf/interface",
"//daml-lf/transaction",
"//daml-lf/transaction-scalacheck",
"//language-support/scala/bindings",
"//ledger-api/rs-grpc-bridge",
"//ledger-api/testing-utils",
"//ledger-service/utils",
"//ledger/ledger-api-auth",
"//ledger/ledger-api-client",
"//ledger/ledger-api-common",
"//ledger/ledger-api-domain",
"//ledger/participant-state",
"//ledger/sandbox",
"//ledger/sandbox:sandbox-scala-tests-lib",
"//ledger/test-common",
"//libs-scala/auth-utils",
"//libs-scala/grpc-utils",
"//libs-scala/ports",
"//libs-scala/postgresql-testing",
"//libs-scala/resources",
"//libs-scala/timer-utils",
"@maven//:ch_qos_logback_logback_classic",
"@maven//:com_chuusai_shapeless_2_12",
"@maven//:com_github_scopt_scopt_2_12",
"@maven//:com_lihaoyi_sourcecode_2_12",
"@maven//:com_typesafe_akka_akka_actor_2_12",
"@maven//:com_typesafe_akka_akka_stream_2_12",
"@maven//:com_typesafe_scala_logging_scala_logging_2_12",
"@maven//:io_circe_circe_core_2_12",
"@maven//:io_circe_circe_parser_2_12",
"@maven//:io_netty_netty_handler",
"@maven//:org_scalacheck_scalacheck_2_12",
"@maven//:org_scalactic_scalactic_2_12",
"@maven//:org_scalatest_scalatest_2_12",
"@maven//:org_scalaz_scalaz_core_2_12",
"@maven//:org_scalaz_scalaz_scalacheck_binding_2_12",
"@maven//:org_slf4j_slf4j_api",
"@maven//:org_tpolecat_doobie_core_2_12",
"@maven//:org_tpolecat_doobie_free_2_12",
"@maven//:org_typelevel_cats_core_2_12",
"@maven//:org_typelevel_cats_effect_2_12",
"@maven//:org_typelevel_cats_free_2_12",
"@maven//:org_typelevel_cats_kernel_2_12",
],
)
exports_files(["src/main/resources/logback.xml"])