daml/extractor/BUILD.bazel
Remy e7bbf87692 Freeze DAML-LF version 1.6 (#1937)
* daml-lf: cosmetic

* daml-lf: release V1.6

* daml-lf: update spec

* update unreleased.rst

* Address Martin's comments

* damlc: active daml-lf-target 1.6

* lf-encoder: fix testing dar generation

* daml-lf spec: simplify 1.dev description

* daml-lf: fix engine test

* daml-lf: fix version timeline

* extractor: fix test

* Address Stephen's comments

* Add more meat to the release notes

* java-codegen: update docs

* damlc: set 1.6 as default output version

* java-codegen update integration tests

* undo replicating typo

* release notes

* scala-codegen: update test

* java-codegen: fix doc

* extractor: fix  test

* address Gerolf's comments

* realse-notes: cleanup unreleased.rst

* Address last comment from Stephen

+ cosmetic cleanup

* formatting
2019-07-12 19:06:44 +00:00

158 lines
4.5 KiB
Python

# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. 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-domain",
"//ledger-service/utils",
"//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/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/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,
)