mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-10 10:46:11 +03:00
d17dd7e5f1
* Ledger API test tool: test against legacy and preview version. + use dictionary instead of alias to map version keywords to LF version CHANGELOG_BEGIN CHANGELOG_END
149 lines
4.2 KiB
Python
149 lines
4.2 KiB
Python
# Copyright (c) 2021 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",
|
|
"lf_scalacopts",
|
|
)
|
|
load(
|
|
"//daml-lf/language:daml-lf.bzl",
|
|
"ENCODER_LF_VERSIONS",
|
|
"lf_version_configuration",
|
|
)
|
|
|
|
da_scala_library(
|
|
name = "encoder",
|
|
srcs = glob(
|
|
["src/main/**/*.scala"],
|
|
exclude = ["src/main/scala/com/digitalasset/daml/lf/archive/testing/DamlLfEncoder.scala"],
|
|
),
|
|
scala_deps = [
|
|
"@maven//:org_scalaz_scalaz_core",
|
|
],
|
|
scalacopts = lf_scalacopts,
|
|
visibility = [
|
|
"//daml-lf:__subpackages__",
|
|
"//ledger:__subpackages__",
|
|
],
|
|
deps = [
|
|
"//daml-lf/archive:daml_lf_archive_reader",
|
|
"//daml-lf/archive:daml_lf_dev_archive_proto_java",
|
|
"//daml-lf/data",
|
|
"//daml-lf/language",
|
|
"@maven//:com_google_protobuf_protobuf_java",
|
|
],
|
|
)
|
|
|
|
da_scala_test_suite(
|
|
name = "tests",
|
|
size = "small",
|
|
srcs = glob(["src/test/scala/**/*.scala"]),
|
|
data = [":testing-dar-%s" % target for target in ENCODER_LF_VERSIONS],
|
|
scala_deps = [
|
|
"@maven//:org_scalatest_scalatest",
|
|
"@maven//:org_scalaz_scalaz_core",
|
|
],
|
|
scalacopts = lf_scalacopts,
|
|
versioned_scala_deps = {
|
|
"2.12": [
|
|
"@maven//:org_scala_lang_modules_scala_collection_compat",
|
|
],
|
|
},
|
|
deps = [
|
|
":encoder",
|
|
"//bazel_tools/runfiles:scala_runfiles",
|
|
"//daml-lf/archive:daml_lf_archive_reader",
|
|
"//daml-lf/archive:daml_lf_dev_archive_proto_java",
|
|
"//daml-lf/data",
|
|
"//daml-lf/language",
|
|
"//daml-lf/parser",
|
|
"//daml-lf/validation",
|
|
"@maven//:com_google_protobuf_protobuf_java",
|
|
],
|
|
)
|
|
|
|
da_scala_binary(
|
|
name = "encoder_binary",
|
|
srcs = glob(["src/main/scala/com/digitalasset/daml/lf/archive/testing/DamlLfEncoder.scala"]),
|
|
main_class = "com.daml.lf.archive.testing.DamlLfEncoder",
|
|
scalacopts = lf_scalacopts,
|
|
visibility = [
|
|
"//daml-lf:__subpackages__",
|
|
"//language-support:__subpackages__",
|
|
],
|
|
deps = [
|
|
":encoder",
|
|
"//:sdk-version-scala-lib",
|
|
"//daml-lf/archive:daml_lf_archive_reader",
|
|
"//daml-lf/archive:daml_lf_dev_archive_proto_java",
|
|
"//daml-lf/archive/encoder",
|
|
"//daml-lf/data",
|
|
"//daml-lf/language",
|
|
"//daml-lf/parser",
|
|
"//daml-lf/validation",
|
|
"@maven//:com_google_protobuf_protobuf_java",
|
|
],
|
|
)
|
|
|
|
[
|
|
filegroup(
|
|
name = "lf_%s" % target,
|
|
srcs = glob([
|
|
"src/test/lf/*_all_*.lf",
|
|
"src/test/lf/*_%s_*.lf" % target,
|
|
]),
|
|
)
|
|
for target in ENCODER_LF_VERSIONS
|
|
]
|
|
|
|
[
|
|
[
|
|
genrule(
|
|
name = "testing-dar-%s" % target,
|
|
srcs = [":lf_%s" % target],
|
|
outs = ["test-%s.dar" % target],
|
|
cmd = "$(location :encoder_binary) $(SRCS) --output $@ --target %s" % target,
|
|
tools = [":encoder_binary"],
|
|
visibility = [
|
|
"//daml-lf:__subpackages__",
|
|
"//extractor:__subpackages__",
|
|
"//language-support:__subpackages__",
|
|
],
|
|
),
|
|
sh_test(
|
|
name = "validate-dar-%s" % target,
|
|
srcs = ["src/validate.sh"],
|
|
args = [
|
|
"$(location //daml-lf/repl:repl)",
|
|
"$(location :testing-dar-%s)" % target,
|
|
"--dev" if (target == lf_version_configuration.get("dev") or target == lf_version_configuration.get("preview")) else "",
|
|
],
|
|
data = [
|
|
"//daml-lf/repl",
|
|
"testing-dar-%s" % target,
|
|
],
|
|
deps = [
|
|
"@bazel_tools//tools/bash/runfiles",
|
|
],
|
|
),
|
|
]
|
|
for target in ENCODER_LF_VERSIONS
|
|
]
|
|
|
|
[
|
|
filegroup(
|
|
name = "testing-dar-%s" % alias,
|
|
srcs = [":testing-dar-%s" % version],
|
|
visibility = [
|
|
"//daml-lf:__subpackages__",
|
|
"//extractor:__subpackages__",
|
|
"//language-support:__subpackages__",
|
|
"//ledger:__subpackages__",
|
|
],
|
|
)
|
|
for (alias, version) in lf_version_configuration.items()
|
|
]
|