daml/ledger/test-common/BUILD.bazel
Samir Talwar 83ed13d799
Split the ledger-api-test-tool into libraries, under /ledger/ledger-api-tests. [KVL-1076] (#12771)
* Move //ledger/ledger-api-test-tool to //ledger/ledger-api-tests/tool.

And conformance.bzl to //ledger/ledger-api-tests.

* Move test tool infra to //ledger/ledger-api-tests/infrastructure.

* Split the ledger API test tool into smaller libraries.

There is no change to behavior.

CHANGELOG_BEGIN
CHANGELOG_END

* ledger-api-tests: Encapsulate performance tests.

* ledger-api-tests: Extract a "runner" library.

* ledger-api-tests: Publish libraries to Maven Central.

* ledger-api-tests: Fix Scaladoc so it compiles correctly.

Unfortunately I had to remove some Scaladoc in ActiveContractsServiceIT
which is incorrectly interpreted as not being attached to anything.
Fortunately, it's not actually that helpful.

* compatibility: Fix paths to the Ledger API Test Tool.

* Fix release types for ledger API test libraries.

* test-common: Publish generated Scala.

These libraries are dependencies of the ledger API tests components.

* ledger-api-tests: Use "com.daml" as the group ID everywhere.

* ledger-api-tests: Check that tests in `--additional` are valid.

* compatibility: Fix a reference to ledger-api-test-tool I missed.
2022-02-10 13:25:23 +00:00

141 lines
4.6 KiB
Python

# Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"da_scala_library",
)
load(
"//language-support/scala/codegen:codegen.bzl",
"dar_to_scala",
)
load("@scala_version//:index.bzl", "scala_major_version")
load("@scala_version//:index.bzl", "scala_major_version")
load(
"//daml-lf/language:daml-lf.bzl",
"lf_version_configuration",
"lf_version_configuration_versions",
)
load("//ledger/test-common:test-common.bzl", "da_scala_dar_resources_library")
alias(
name = "dar-files",
actual = "dar-files-default",
visibility = ["//visibility:public"],
)
[
[
# alias model-tests-KEYWORD.dar, dar-files-KEYWORD, and dar-files-KEYWORD-lib
# to model-tests-TAG.dar, dar-files-TAG, dar-files-TAG-lib, and test-common-TAG
# where : KEYWORD is a keyword like default, latest, or dev
# TAG is a (java friendly) version TAG like 1_8
# The mapping KEYWORD -> TAG is defined by test_common_configurations
alias(
name = "%s-%s%s" % (target_prefix, name, target_suffix),
actual = ":%s-%s%s" % (target_prefix, lf_version, target_suffix),
visibility = ["//visibility:public"],
),
]
for (target_prefix, target_suffix) in [
("model-tests", ".dar"),
("dar-files", ""),
("dar-files", "-lib"),
("test-common", ""),
]
for (name, lf_version) in lf_version_configuration.items()
]
alias(
name = "test-common",
actual = "test-common-default",
visibility = ["//visibility:public"],
)
[
[
da_scala_library(
name = "test-common-%s" % target,
srcs = glob(["src/main/scala/**/*.scala"]),
scala_deps = [
"@maven//:org_scalatest_scalatest_shouldmatchers",
"@maven//:org_scalatest_scalatest_core",
"@maven//:org_scalactic_scalactic",
"@maven//:org_scalatest_scalatest_matchers_core",
],
tags = ["maven_coordinates=com.daml:test-common-%s:__VERSION__" % target],
visibility = [
"//visibility:public",
],
deps = [
"//daml-lf/archive:daml_lf_1.dev_archive_proto_java",
"//daml-lf/archive:daml_lf_archive_reader",
"//ledger-api/grpc-definitions:ledger_api_proto_scala",
"//ledger/test-common:dar-files-%s-lib" % target,
"//libs-scala/scala-utils",
"//libs-scala/timer-utils",
"@maven//:ch_qos_logback_logback_classic",
"@maven//:ch_qos_logback_logback_core",
"@maven//:io_grpc_grpc_context",
"@maven//:org_scalatest_scalatest_compatible",
"@maven//:org_slf4j_slf4j_api",
],
),
]
for target in lf_version_configuration_versions
]
# Correspond to the directories under src/test/lib/daml
test_names = [
"model",
"semantic",
"performance",
"package_management",
]
da_scala_dar_resources_library(
add_maven_tag = True,
daml_dir_names = test_names,
daml_root_dir = "src/main/daml",
enable_scenarios = True,
exclusions = {
"1.8": ["**/*Exception*.daml"],
},
lf_versions = lf_version_configuration_versions,
maven_name_prefix = "test",
visibility = ["//visibility:public"],
)
[
[
[
dar_to_scala(
name = "%s-tests-%s.scala-codegen" % (test_name, target),
srcs = [":%s-tests-%s.dar" % (test_name, target)],
package_prefix = "com.daml.ledger.test.%s" % test_name,
srcjar_out = "%s-%s.scala.srcjar" % (test_name, target),
visibility = ["//visibility:public"],
),
da_scala_library(
name = "%s-tests-%s.scala" % (test_name, target),
srcs = [
":%s-tests-%s.scala-codegen" % (test_name, target),
],
scalacopts = [
"-Wconf:cat=unused-imports&site=com\\.daml\\.ledger\\.test\\.%s\\..*:s" % test_name,
],
tags = ["maven_coordinates=com.daml:test-common-%s-tests-scala-%s:__VERSION__" % (
test_name.replace("_", "-"),
target,
)],
visibility = ["//visibility:public"],
deps = [
"//language-support/scala/bindings",
],
),
]
for test_name in test_names
]
for target in lf_version_configuration_versions
]