daml/extractor/BUILD.bazel
Stephen Compall 5709fd0474
extractor: use daml-lf transaction Value ADT instead of bespoke ADT (#1117)
* stub away the components of LedgerValue

* rewrite v1 api converters to produce transaction Value ADT

* a needless 'case'

* shortcut methods for ImmArraySeq and tests

* porting extractor's JSON encoders to transaction Value

- JSON object ordering now matches record field order, instead of being
  its reverse
- Includes a new encoding for records missing labels, to a list of
  2-tuples

* porting extractor main transaction Value

- JSON date/time is just <num>s since epoch, maybe revisit

* adapt to Decimal newtype

* use daml-lf/data stringification for decimals in JSON

* snap aliases for Cid-less LedgerValue subtypes

* snap aliases for Cid-containing LedgerValue subtypes

* remove needless indirection

* test new missing-label Record JSON encoding

* write ImmArray traverse with syntax extension

* remove RecordField; move Name parsing to former RecordField converter
2019-05-15 20:21:09 -04:00

113 lines
3.2 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/archive:daml_lf_java_proto",
"//daml-lf/archive:daml_lf_archive_scala",
"//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",
"//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/io/circe:circe_core",
"//3rdparty/jvm/io/circe:circe_generic",
"//3rdparty/jvm/io/circe:circe_parser",
"//3rdparty/jvm/io/grpc:grpc_netty",
]
daml_compile(
name = "RecordsAndVariants",
main_src = "src/test/resources/damls/RecordsAndVariants.daml",
target = "1.3",
)
daml_compile(
name = "PrimitiveTypes",
main_src = "src/test/resources/damls/PrimitiveTypes.daml",
target = "1.3",
)
daml_compile(
name = "TransactionExample",
main_src = "src/test/resources/damls/TransactionExample.daml",
target = "1.3",
)
testDependencies = [
":extractor",
"//ledger/sandbox:sandbox",
"//ledger-api/testing-utils",
"//ledger/sandbox:sandbox-scala-tests-lib",
"//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 = "small",
srcs = glob(["src/test/suite/**/*.scala"]),
data = [
"//extractor:PrimitiveTypes.dar",
"//extractor:RecordsAndVariants.dar",
"//extractor:TransactionExample.dar",
],
resources = glob(["src/test/resources/**/*"]),
deps = [
":extractor-scala-tests-lib",
] + testDependencies,
)