mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-10 10:46:11 +03:00
89d6c7375c
Fixes #3363
274 lines
8.0 KiB
Python
274 lines
8.0 KiB
Python
# Copyright (c) 2019 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_suite",
|
|
)
|
|
load(
|
|
"//rules_daml:daml.bzl",
|
|
"daml_compile",
|
|
)
|
|
load("//bazel_tools:pom_file.bzl", "pom_file")
|
|
load(
|
|
"//ledger/ledger-api-test-tool:conformance.bzl",
|
|
"server_conformance_test",
|
|
)
|
|
|
|
compileDependencies = [
|
|
# grpc_services has to come first other as somehow a different instance of grpc-core.jar
|
|
"@maven//:io_grpc_grpc_services",
|
|
"@maven//:ch_qos_logback_logback_classic",
|
|
"//daml-lf/scenario-interpreter",
|
|
"//daml-lf/transaction",
|
|
"//daml-lf/engine",
|
|
"//daml-lf/data",
|
|
"//daml-lf/language",
|
|
"//daml-lf/archive:daml_lf_dev_archive_java_proto",
|
|
"//daml-lf/archive:daml_lf_archive_reader",
|
|
"//daml-lf/interpreter",
|
|
"//daml-lf/transaction:value_java_proto",
|
|
"//daml-lf/transaction:transaction_java_proto",
|
|
"//ledger-api/rs-grpc-bridge",
|
|
"//ledger-api/rs-grpc-akka",
|
|
"//ledger/ledger-api-akka",
|
|
"//ledger/ledger-api-auth",
|
|
"//ledger/ledger-api-scala-logging",
|
|
"//language-support/scala/bindings",
|
|
"//ledger/ledger-api-domain:ledger-api-domain",
|
|
"//ledger/ledger-api-common:ledger-api-common",
|
|
"//ledger/ledger-api-client:ledger-api-client",
|
|
"//ledger/participant-state",
|
|
"//ledger/participant-state-index:participant-state-index",
|
|
"//ledger-service/jwt",
|
|
"@maven//:ch_qos_logback_logback_core",
|
|
"@maven//:com_typesafe_scala_logging_scala_logging_2_12",
|
|
"@maven//:org_slf4j_slf4j_api",
|
|
"@maven//:org_scalaz_scalaz_core_2_12",
|
|
"@maven//:org_scalaz_scalaz_concurrent_2_12",
|
|
"@maven//:io_netty_netty_codec_http2",
|
|
"@maven//:io_netty_netty_tcnative_boringssl_static",
|
|
"@maven//:io_grpc_grpc_netty",
|
|
"@maven//:io_netty_netty_common",
|
|
"@maven//:io_netty_netty_transport",
|
|
"@maven//:io_netty_netty_handler",
|
|
"@maven//:com_github_scopt_scopt_2_12",
|
|
"@maven//:com_typesafe_akka_akka_stream_2_12",
|
|
"@maven//:com_typesafe_akka_akka_actor_2_12",
|
|
"@maven//:com_google_guava_guava",
|
|
"@maven//:org_postgresql_postgresql",
|
|
"@maven//:com_h2database_h2",
|
|
"@maven//:com_zaxxer_HikariCP",
|
|
"@maven//:org_flywaydb_flyway_core",
|
|
"@maven//:com_typesafe_config",
|
|
"@maven//:com_typesafe_play_anorm_2_12",
|
|
"@maven//:com_typesafe_play_anorm_akka_2_12",
|
|
"@maven//:com_typesafe_play_anorm_tokenizer_2_12",
|
|
"@maven//:io_dropwizard_metrics_metrics_core",
|
|
"@maven//:io_dropwizard_metrics_metrics_jmx",
|
|
"@maven//:io_zipkin_brave_brave",
|
|
"@maven//:org_scala_lang_modules_scala_java8_compat_2_12",
|
|
]
|
|
|
|
da_scala_library(
|
|
name = "sandbox",
|
|
srcs = glob(["src/main/scala/**/*.scala"]),
|
|
resources =
|
|
glob(
|
|
["src/main/resources/**/*"],
|
|
# Do not include logback.xml into the library: let the user
|
|
# of the sandbox-as-a-library decide how to log.
|
|
exclude = ["src/main/resources/logback.xml"],
|
|
) + [
|
|
"//:COMPONENT-VERSION",
|
|
],
|
|
tags = ["maven_coordinates=com.digitalasset.platform:sandbox:__VERSION__"],
|
|
visibility = [
|
|
"//visibility:public",
|
|
],
|
|
runtime_deps = [
|
|
"@maven//:ch_qos_logback_logback_classic",
|
|
"@maven//:ch_qos_logback_logback_core",
|
|
],
|
|
deps = compileDependencies + ["//ledger/test-common"],
|
|
)
|
|
|
|
da_scala_library(
|
|
name = "ledger-api-server",
|
|
srcs = glob(["src/main/scala/**/*.scala"]),
|
|
resources =
|
|
glob(
|
|
["src/main/resources/**/*"],
|
|
# Do not include logback.xml into the library: let the user
|
|
# of the sandbox-as-a-library decide how to log.
|
|
exclude = ["src/main/resources/logback.xml"],
|
|
) + [
|
|
"//:COMPONENT-VERSION",
|
|
],
|
|
tags = ["maven_coordinates=com.daml.ledger:ledger-api-server:__VERSION__"],
|
|
visibility = [
|
|
"//visibility:public",
|
|
],
|
|
runtime_deps = [
|
|
"@maven//:ch_qos_logback_logback_classic",
|
|
"@maven//:ch_qos_logback_logback_core",
|
|
],
|
|
deps = compileDependencies + ["//ledger/test-common"],
|
|
)
|
|
|
|
da_scala_binary(
|
|
name = "sandbox-binary",
|
|
main_class = "com.digitalasset.platform.sandbox.SandboxMain",
|
|
resources = ["src/main/resources/logback.xml"],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
":sandbox",
|
|
],
|
|
)
|
|
|
|
da_scala_binary(
|
|
name = "sandbox-ephemeral-postgres",
|
|
main_class = "com.digitalasset.platform.sandbox.persistence.EphemeralPostgresSandboxMain",
|
|
resources = ["src/main/resources/logback.xml"],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
":sandbox",
|
|
":sandbox-scala-tests-lib",
|
|
],
|
|
)
|
|
|
|
genrule(
|
|
name = "sandbox-tarball",
|
|
srcs = [
|
|
":sandbox-binary_deploy.jar",
|
|
"//:component-version",
|
|
],
|
|
outs = ["sandbox-tarball.tar.gz"],
|
|
cmd = """
|
|
VERSION=$$(cat $(location //:component-version))
|
|
mkdir -p sandbox-tarball/sandbox
|
|
cp -L $(location :sandbox-binary_deploy.jar) sandbox-tarball/sandbox/sandbox-$$VERSION.jar
|
|
out=$$(realpath $@)
|
|
cd sandbox-tarball
|
|
tar zcf $$out sandbox
|
|
""",
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
alias(
|
|
name = "Test-1.5.dar",
|
|
actual = ":historical-dars/Test-1.5.dar",
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
#TODO: generate dynamic BuildInfo.scala
|
|
|
|
testDependencies = [
|
|
":sandbox",
|
|
"//ledger/ledger-api-common:ledger-api-common-scala-tests-lib",
|
|
"//ledger/test-common:test-common",
|
|
"//ledger-api/testing-utils",
|
|
"@maven//:org_scalatest_scalatest_2_12",
|
|
"@maven//:org_scalacheck_scalacheck_2_12",
|
|
"@maven//:org_scalactic_scalactic_2_12",
|
|
"@maven//:org_awaitility_awaitility",
|
|
"@maven//:commons_io_commons_io",
|
|
"//bazel_tools/runfiles:scala_runfiles",
|
|
] + compileDependencies
|
|
|
|
da_scala_library(
|
|
name = "sandbox-scala-tests-lib",
|
|
srcs = glob(["src/test/lib/**/*.scala"]),
|
|
visibility = ["//visibility:public"],
|
|
deps = testDependencies,
|
|
)
|
|
|
|
da_scala_test_suite(
|
|
name = "sandbox-scala-tests",
|
|
srcs = glob(
|
|
["src/test/suite/**/*.scala"],
|
|
),
|
|
data = [
|
|
"//ledger/test-common:Test-stable.dar",
|
|
"@postgresql_dev_env//:all",
|
|
"@postgresql_dev_env//:createdb",
|
|
"@postgresql_dev_env//:initdb",
|
|
"@postgresql_dev_env//:pg_ctl",
|
|
],
|
|
resources = glob(["src/test/resources/**/*"]),
|
|
deps = [
|
|
":sandbox-scala-tests-lib",
|
|
] + testDependencies,
|
|
)
|
|
|
|
SERVERS = {
|
|
"memory": {
|
|
"binary": ":sandbox-binary",
|
|
"server_args": [
|
|
"--port=6865",
|
|
"--eager-package-loading",
|
|
],
|
|
},
|
|
"h2database": {
|
|
"binary": ":sandbox-binary",
|
|
"server_args": [
|
|
"--port=6865",
|
|
"--eager-package-loading",
|
|
# "db_close_delay=-1" is needed so that the in-memory database is not closed
|
|
# (and therefore lost) after the flyway migration
|
|
"--sql-backend-jdbcurl=jdbc:h2:mem:static_time;db_close_delay=-1",
|
|
],
|
|
},
|
|
"postgres": {
|
|
"binary": ":sandbox-ephemeral-postgres",
|
|
"extra_data": [
|
|
"@postgresql_dev_env//:all",
|
|
"@postgresql_dev_env//:createdb",
|
|
"@postgresql_dev_env//:initdb",
|
|
"@postgresql_dev_env//:pg_ctl",
|
|
],
|
|
"server_args": [
|
|
"--port=6865",
|
|
"--eager-package-loading",
|
|
],
|
|
},
|
|
}
|
|
|
|
server_conformance_test(
|
|
name = "conformance-test-static-time",
|
|
server_args = [
|
|
"--static-time",
|
|
],
|
|
servers = SERVERS,
|
|
test_tool_args = [
|
|
"--all-tests",
|
|
"--exclude=LotsOfPartiesIT",
|
|
],
|
|
)
|
|
|
|
server_conformance_test(
|
|
name = "conformance-test-lots-of-parties",
|
|
server_args = [
|
|
"--static-time",
|
|
],
|
|
servers = SERVERS,
|
|
test_tool_args = [
|
|
"--include=LotsOfPartiesIT",
|
|
],
|
|
)
|
|
|
|
server_conformance_test(
|
|
name = "conformance-test-wall-clock",
|
|
server_args = [
|
|
"--wall-clock-time",
|
|
],
|
|
servers = SERVERS,
|
|
test_tool_args = [
|
|
"--all-tests",
|
|
"--exclude=LotsOfPartiesIT",
|
|
"--exclude=TimeIT",
|
|
],
|
|
)
|