mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-10 10:46:11 +03:00
a125860a9d
* hide unreferenced circe encoders * derive an extractor-compatible lf-value-json codec * replace circe bespoke LedgerValue enc with lf-value-json-based enc * mixed up the encoder's string settings (boolean blindness) * match tests to new labelless record encoding * match tests to new Optional format, no Some/None tag * match tests to new Map format, no Map tag * make other extractor encoders coherent with lf-value-json formats * remove unused circe encoders * stray unused variable * release note * fix #3087's release note formatting; move SQL Extractor note down * move SQL Extractor note down
162 lines
4.6 KiB
Python
162 lines
4.6 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",
|
|
"da_scala_library",
|
|
"da_scala_test_suite",
|
|
)
|
|
load(
|
|
"//rules_daml:daml.bzl",
|
|
"daml_compile",
|
|
)
|
|
|
|
compileDependencies = [
|
|
# this has to come first other as somehow a different instance of grpc-core.jar
|
|
"//3rdparty/jvm/io/grpc:grpc_services",
|
|
"//daml-lf/data",
|
|
"//daml-lf/interface",
|
|
"//daml-lf/transaction",
|
|
"//ledger-api/rs-grpc-bridge",
|
|
"//ledger-api/rs-grpc-akka",
|
|
"//language-support/scala/bindings",
|
|
"//ledger/ledger-api-client",
|
|
"//ledger/ledger-api-common",
|
|
"//ledger/ledger-api-domain",
|
|
"//ledger-service/utils",
|
|
"//ledger-service/lf-value-json",
|
|
"//3rdparty/jvm/io/netty:netty_tcnative_boringssl_static",
|
|
"//3rdparty/jvm/com/chuusai:shapeless",
|
|
"//3rdparty/jvm/org/spire_math:kind_projector",
|
|
"//3rdparty/jvm/com/github/scopt:scopt",
|
|
"//3rdparty/jvm/com/lihaoyi:pprint",
|
|
"//3rdparty/jvm/org/tpolecat:doobie_core",
|
|
"//3rdparty/jvm/org/tpolecat:doobie_postgres",
|
|
"//3rdparty/jvm/com/typesafe/akka:akka_stream",
|
|
"//3rdparty/jvm/org/scalaz:scalaz_core",
|
|
"//3rdparty/jvm/org/slf4j:slf4j_api",
|
|
"//3rdparty/jvm/com/typesafe/scala_logging",
|
|
"//3rdparty/jvm/io/circe:circe_core",
|
|
"//3rdparty/jvm/io/circe:circe_generic",
|
|
"//3rdparty/jvm/io/circe:circe_parser",
|
|
"//3rdparty/jvm/io/spray:spray_json",
|
|
"//3rdparty/jvm/io/grpc:grpc_netty",
|
|
]
|
|
|
|
TEST_DARS = [
|
|
"RecordsAndVariants",
|
|
"PrimitiveTypes",
|
|
"TransactionExample",
|
|
]
|
|
|
|
[
|
|
daml_compile(
|
|
name = darmod,
|
|
main_src = "src/test/resources/damls/%s.daml" % darmod,
|
|
)
|
|
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",
|
|
)
|
|
|
|
testDependencies = [
|
|
":extractor",
|
|
"//daml-lf/data-scalacheck",
|
|
"//daml-lf/transaction-scalacheck",
|
|
"//ledger/sandbox:sandbox",
|
|
"//ledger-api/testing-utils",
|
|
"//ledger/sandbox:sandbox-scala-tests-lib",
|
|
"//3rdparty/jvm/org/scalacheck",
|
|
"//3rdparty/jvm/org/scalaz:scalaz_scalacheck_binding",
|
|
"//3rdparty/jvm/org/scalatest:scalatest",
|
|
] + compileDependencies
|
|
|
|
da_scala_library(
|
|
name = "extractor",
|
|
srcs = glob(["src/main/scala/**/*.scala"]),
|
|
resources = glob(["src/main/resources/**/*"]),
|
|
runtime_deps = [
|
|
"//3rdparty/jvm/ch/qos/logback:logback_classic",
|
|
"//3rdparty/jvm/ch/qos/logback:logback_core",
|
|
],
|
|
deps = compileDependencies,
|
|
)
|
|
|
|
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"]),
|
|
deps = testDependencies,
|
|
)
|
|
|
|
da_scala_test_suite(
|
|
name = "extractor-scala-tests",
|
|
size = "medium",
|
|
srcs = glob(["src/test/suite/**/*.scala"]),
|
|
data = [
|
|
"//daml-lf/encoder:testing-dar-latest",
|
|
"//extractor:PrimitiveTypes.dar",
|
|
"//extractor:RecordsAndVariants.dar",
|
|
"//extractor:TransactionExample.dar",
|
|
"//extractor:VeryLargeArchive.dar",
|
|
"@postgresql_dev_env//:all",
|
|
"@postgresql_dev_env//:createdb",
|
|
"@postgresql_dev_env//:initdb",
|
|
"@postgresql_dev_env//:pg_ctl",
|
|
],
|
|
resources = glob(["src/test/resources/**/*"]),
|
|
deps = [
|
|
":extractor-scala-tests-lib",
|
|
"//bazel_tools/runfiles:scala_runfiles",
|
|
] + testDependencies,
|
|
)
|