daml/ledger/ledger-on-sql/BUILD.bazel
Samir Talwar e13f9a7edd
kvutils: Use resources in KeyValueParticipantState, not AutoClo… (#4177)
* kvutils: Use resources in KeyValueParticipantState, not AutoCloseable.

CHANGELOG_BEGIN
- [kvutils] The simplified API now uses ``com.digitalasset.resources``
  to manage acquiring and releasing resources instead of ``Closeable``.
CHANGELOG_END

* ledger-on-posix-filesystem: Remove dead code due to a refactoring fail.
2020-01-23 16:59:01 +01:00

168 lines
5.4 KiB
Python

# Copyright (c) 2020 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",
)
load("//ledger/ledger-api-test-tool:conformance.bzl", "conformance_test")
supported_databases = [
{
"name": "h2-memory",
"conformance_test_tags": [
"manual",
],
"conformance_test_server_args": [
"--jdbc-url=jdbc:h2:mem:daml-on-sql-conformance-test",
],
"conformance_test_tool_args": [
"--concurrent-test-runs=2",
"--timeout-scale-factor=4",
],
"runtime_deps": [
"@maven//:com_h2database_h2",
],
},
{
"name": "h2-file",
"conformance_test_tags": [
"manual",
],
"conformance_test_server_main": "com.daml.ledger.on.sql.MainWithEphemeralDirectory",
"conformance_test_server_args": [
"--jdbc-url=jdbc:h2:%DIR/test",
],
"conformance_test_tool_args": [
"--concurrent-test-runs=2",
"--timeout-scale-factor=4",
],
"runtime_deps": [
"@maven//:com_h2database_h2",
],
},
{
"name": "sqlite-memory",
"conformance_test_server_args": [
"--jdbc-url=jdbc:sqlite::memory:",
],
"runtime_deps": [
"@maven//:org_xerial_sqlite_jdbc",
],
},
{
"name": "sqlite-file",
"conformance_test_server_main": "com.daml.ledger.on.sql.MainWithEphemeralDirectory",
"conformance_test_server_args": [
"--jdbc-url=jdbc:sqlite:%DIR/test.sqlite",
],
"runtime_deps": [
"@maven//:org_xerial_sqlite_jdbc",
],
},
]
da_scala_library(
name = "ledger-on-sql",
srcs = glob(["src/main/scala/**/*.scala"]),
resources = glob(["src/main/resources/**/*"]),
tags = ["maven_coordinates=com.daml.ledger:on-sql:__VERSION__"],
visibility = [
"//visibility:public",
],
runtime_deps = [
"@maven//:ch_qos_logback_logback_classic",
"@maven//:ch_qos_logback_logback_core",
"@maven//:com_h2database_h2",
],
deps = [
"//daml-lf/data",
"//daml-lf/engine",
"//ledger/ledger-api-common",
"//ledger/ledger-api-health",
"//ledger/participant-state",
"//ledger/participant-state/kvutils",
"//ledger/participant-state/kvutils/app",
"//libs-scala/contextualized-logging",
"//libs-scala/resources",
"@maven//:com_github_scopt_scopt_2_12",
"@maven//:com_google_protobuf_protobuf_java",
"@maven//:com_typesafe_akka_akka_actor_2_12",
"@maven//:com_typesafe_akka_akka_stream_2_12",
"@maven//:com_typesafe_play_anorm_2_12",
"@maven//:com_typesafe_play_anorm_tokenizer_2_12",
"@maven//:com_zaxxer_HikariCP",
],
)
da_scala_test(
name = "ledger-on-sql-tests",
size = "small",
srcs = glob(["src/test/suite/**/*.scala"]),
data = [
"//ledger/test-common:Test-stable.dar",
],
resources = glob(["src/test/resources/*"]),
runtime_deps = [
"@maven//:com_h2database_h2",
"@maven//:org_xerial_sqlite_jdbc",
],
deps = [
":ledger-on-sql",
"//daml-lf/data",
"//ledger-api/rs-grpc-bridge",
"//ledger-api/testing-utils",
"//ledger/ledger-api-common",
"//ledger/ledger-api-health",
"//ledger/participant-state",
"//ledger/participant-state/kvutils",
"//ledger/participant-state/kvutils:kvutils-tests-lib",
"//libs-scala/contextualized-logging",
"//libs-scala/resources",
"@maven//:com_typesafe_akka_akka_actor_2_12",
"@maven//:com_typesafe_akka_akka_stream_2_12",
"@maven//:org_scalactic_scalactic_2_12",
"@maven//:org_scalatest_scalatest_2_12",
],
)
[
(
da_scala_binary(
name = "conformance-test-{}-bin".format(db["name"]),
srcs = glob(["src/test/lib/**/*.scala"]),
main_class = db.get("conformance_test_server_main", "com.daml.ledger.on.sql.Main"),
visibility = ["//visibility:public"],
runtime_deps = db.get("runtime_deps", []),
deps = [
":ledger-on-sql",
"//daml-lf/data",
"//ledger/ledger-api-health",
"//ledger/participant-state",
"//ledger/participant-state/kvutils",
"//ledger/participant-state/kvutils/app",
"//libs-scala/resources",
"@maven//:com_github_scopt_scopt_2_12",
"@maven//:com_typesafe_akka_akka_stream_2_12",
],
),
conformance_test(
name = "conformance-test-{}".format(db["name"]),
ports = [6865],
server = ":conformance-test-{}-bin".format(db["name"]),
server_args = ["--port=6865"] + db.get("conformance_test_server_args", []),
tags = db.get("conformance_test_tags", []),
test_tool_args = db.get("conformance_test_tool_args", []) + [
"--all-tests",
"--exclude=ConfigManagementServiceIT",
"--exclude=LotsOfPartiesIT",
"--exclude=TimeIT",
"--exclude=TransactionScaleIT",
],
),
)
for db in supported_databases
]