daml/ledger/sandbox/BUILD.bazel
Samir Talwar f0c1eb207c
concurrent: Tag DirectExecutionContext. (#7517)
* concurrent: Tag DirectExecutionContext.

1.  Tag `DirectExecutionContext` as `ExecutionContext[Nothing]`, thereby
    stating that it works for any tagged `Future`.
2.  Move `DirectExecutionContext` to the _libs-scala/concurrent_
    library, as it requires it and it's tiny.

CHANGELOG_BEGIN
CHANGELOG_END

* concurrent: Fix the privacy of `DirectExecutionContextInternal`.

Co-authored-by: Stephen Compall <stephen.compall@daml.com>

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2020-09-29 17:23:57 +00:00

322 lines
11 KiB
Python

# Copyright (c) 2020 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("//ledger/ledger-api-test-tool:conformance.bzl", "server_conformance_test")
load("@io_bazel_rules_docker//container:container.bzl", "container_image")
load("@io_bazel_rules_docker//java:image.bzl", "java_image")
load("@os_info//:os_info.bzl", "is_windows")
load("@build_environment//:configuration.bzl", "mvn_version")
da_scala_library(
name = "sandbox",
srcs = glob(["src/main/scala/**/*.scala"]),
plugins = [
"@maven//:com_github_ghik_silencer_plugin_2_12_11",
],
# Do not include logback.xml into the library: let the user
# of the sandbox-as-a-library decide how to log.
resources = ["//ledger/sandbox-common:src/main/resources/banner.txt"],
tags = ["maven_coordinates=com.daml:sandbox:__VERSION__"],
visibility = [
"//visibility:public",
],
runtime_deps = [
"@maven//:ch_qos_logback_logback_classic",
"@maven//:ch_qos_logback_logback_core",
"@maven//:com_h2database_h2",
"@maven//:org_postgresql_postgresql",
"@maven//:org_xerial_sqlite_jdbc",
],
deps = [
"//daml-lf/archive:daml_lf_archive_reader",
"//daml-lf/archive:daml_lf_dev_archive_java_proto",
"//daml-lf/data",
"//daml-lf/engine",
"//daml-lf/transaction",
"//language-support/scala/bindings",
"//ledger/caching",
"//ledger/ledger-api-auth",
"//ledger/ledger-api-common",
"//ledger/ledger-api-domain",
"//ledger/ledger-api-health",
"//ledger/ledger-on-sql",
"//ledger/metrics",
"//ledger/participant-integration-api",
"//ledger/participant-state",
"//ledger/participant-state-metrics",
"//ledger/participant-state/kvutils",
"//ledger/sandbox-common",
"//libs-scala/build-info",
"//libs-scala/contextualized-logging",
"//libs-scala/ports",
"//libs-scala/resources",
"//libs-scala/resources-akka",
"@maven//:ch_qos_logback_logback_classic",
"@maven//:com_github_ghik_silencer_lib_2_12_11",
"@maven//:com_github_scopt_scopt_2_12",
"@maven//:com_typesafe_akka_akka_actor_2_12",
"@maven//:com_typesafe_akka_akka_stream_2_12",
"@maven//:com_typesafe_config",
"@maven//:org_scala_lang_modules_scala_java8_compat_2_12",
"@maven//:org_scalaz_scalaz_core_2_12",
"@maven//:org_slf4j_slf4j_api",
],
)
da_scala_binary(
name = "sandbox-binary",
main_class = "com.daml.platform.sandboxnext.Main",
resources = ["//ledger/sandbox-common:src/main/resources/logback.xml"],
visibility = ["//visibility:public"],
deps = [
":sandbox",
],
)
da_scala_binary(
name = "sandbox-ephemeral-postgresql",
main_class = "com.daml.platform.sandboxnext.persistence.MainWithEphemeralPostgresql",
resources = ["//ledger/sandbox-common:src/main/resources/logback.xml"],
visibility = ["//visibility:public"],
deps = [
":sandbox",
":sandbox-scala-tests-lib",
],
)
genrule(
name = "sandbox-tarball",
srcs = [
":sandbox-binary_deploy.jar",
],
outs = ["sandbox-tarball.tar.gz"],
cmd = """
mkdir -p sandbox-tarball/sandbox
cp -L $(location :sandbox-binary_deploy.jar) sandbox-tarball/sandbox/sandbox-{mvn}.jar
$(execpath //bazel_tools/sh:mktgz) $@ -C sandbox-tarball sandbox
""".format(mvn = mvn_version),
tools = ["//bazel_tools/sh:mktgz"],
visibility = ["//visibility:public"],
)
container_image(
name = "sandbox-image-base",
base = "@java_base//image",
cmd = None,
directory = "/usr/bin",
files = [
"@com_github_grpc_ecosystem_grpc_health_probe_binary//file",
],
) if not is_windows else None
java_image(
name = "sandbox-image",
base = ":sandbox-image-base",
main_class = "com.daml.platform.sandboxnext.Main",
resources = ["//ledger/sandbox-common:src/main/resources/logback.xml"],
visibility = ["//visibility:public"],
runtime_deps = [":sandbox"],
) if not is_windows else None
da_scala_library(
name = "sandbox-scala-tests-lib",
srcs = glob(["src/test/lib/**/*.scala"]),
visibility = ["//visibility:public"],
runtime_deps = [
"@maven//:com_h2database_h2",
"@maven//:com_typesafe_akka_akka_slf4j_2_12",
"@maven//:org_postgresql_postgresql",
],
deps = [
":sandbox",
"//daml-lf/data",
"//language-support/scala/bindings",
"//ledger-api/rs-grpc-bridge",
"//ledger-api/testing-utils",
"//ledger/caching",
"//ledger/ledger-api-auth",
"//ledger/ledger-api-common",
"//ledger/ledger-api-domain",
"//ledger/participant-integration-api",
"//ledger/participant-integration-api:participant-integration-api-tests-lib",
"//ledger/participant-state",
"//ledger/sandbox-common",
"//ledger/sandbox-common:sandbox-common-scala-tests-lib",
"//libs-scala/ports",
"//libs-scala/postgresql-testing",
"//libs-scala/resources",
"@maven//:ch_qos_logback_logback_classic",
"@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",
"@maven//:org_scalaz_scalaz_core_2_12",
"@maven//:org_slf4j_slf4j_api",
],
)
da_scala_test_suite(
name = "sandbox-tests",
srcs = glob(
["src/test/suite/**/*.scala"],
exclude = ["src/test/suite/**/ResetService*IT.scala"],
),
data = [
"//ledger/test-common:model-tests.dar",
"//ledger/test-common/test-certificates",
],
resources = glob(["src/test/resources/**/*"]),
deps = [
":sandbox",
":sandbox-scala-tests-lib",
"//bazel_tools/runfiles:scala_runfiles",
"//daml-lf/archive:daml_lf_archive_reader",
"//daml-lf/archive:daml_lf_dev_archive_java_proto",
"//daml-lf/data",
"//daml-lf/engine",
"//daml-lf/interpreter",
"//daml-lf/language",
"//daml-lf/transaction",
"//daml-lf/transaction-test-lib",
"//language-support/scala/bindings",
"//ledger-api/rs-grpc-akka",
"//ledger-api/rs-grpc-akka:rs-grpc-akka-tests-lib",
"//ledger-api/rs-grpc-bridge",
"//ledger-api/sample-service",
"//ledger-api/testing-utils",
"//ledger/caching",
"//ledger/ledger-api-auth",
"//ledger/ledger-api-client",
"//ledger/ledger-api-common",
"//ledger/ledger-api-common:ledger-api-common-scala-tests-lib",
"//ledger/ledger-api-domain",
"//ledger/ledger-api-health",
"//ledger/metrics",
"//ledger/participant-integration-api",
"//ledger/participant-integration-api:participant-integration-api-tests-lib",
"//ledger/participant-state",
"//ledger/participant-state-index",
"//ledger/participant-state-metrics",
"//ledger/sandbox-common",
"//ledger/sandbox-common:sandbox-common-scala-tests-lib",
"//ledger/test-common",
"//libs-scala/concurrent",
"//libs-scala/contextualized-logging",
"//libs-scala/grpc-utils",
"//libs-scala/ports",
"//libs-scala/postgresql-testing",
"//libs-scala/resources",
"@maven//:ch_qos_logback_logback_classic",
"@maven//:ch_qos_logback_logback_core",
"@maven//:com_typesafe_akka_akka_actor_2_12",
"@maven//:com_typesafe_akka_akka_stream_2_12",
"@maven//:com_typesafe_akka_akka_stream_testkit_2_12",
"@maven//:com_typesafe_akka_akka_testkit_2_12",
"@maven//:com_typesafe_config",
"@maven//:commons_io_commons_io",
"@maven//:io_dropwizard_metrics_metrics_core",
"@maven//:io_grpc_grpc_services",
"@maven//:io_netty_netty_handler",
"@maven//:org_awaitility_awaitility",
"@maven//:org_flywaydb_flyway_core",
"@maven//:org_mockito_mockito_core",
"@maven//:org_mockito_mockito_scala_2_12",
"@maven//:org_reactivestreams_reactive_streams",
"@maven//:org_scalacheck_scalacheck_2_12",
"@maven//:org_scalactic_scalactic_2_12",
"@maven//:org_scalatest_scalatest_2_12",
"@maven//:org_scalaz_scalaz_core_2_12",
"@maven//:org_slf4j_slf4j_api",
],
)
da_scala_test_suite(
name = "sandbox-resetservice-tests",
srcs = glob(
["src/test/suite/**/ResetService*IT.scala"],
),
data = [
"//ledger/test-common:model-tests.dar",
"//ledger/test-common/test-certificates",
],
flaky = True,
resources = glob(["src/test/resources/**/*"]),
deps = [
":sandbox-scala-tests-lib",
"//daml-lf/data",
"//language-support/scala/bindings",
"//ledger-api/rs-grpc-bridge",
"//ledger-api/testing-utils",
"//ledger/ledger-api-common",
"//ledger/ledger-api-domain",
"//ledger/sandbox-common",
"//ledger/sandbox-common:sandbox-common-scala-tests-lib",
"//ledger/test-common",
"//libs-scala/ports",
"//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",
"@maven//:org_scalaz_scalaz_core_2_12",
"@maven//:org_slf4j_slf4j_api",
],
)
NEXT_SERVERS = {
"memory": {
"binary": ":sandbox-binary",
"server_args": [
"--contract-id-seeding=testing-weak",
"--port=6865",
"--eager-package-loading",
],
},
"postgresql": {
"binary": ":sandbox-ephemeral-postgresql",
"server_args": [
"--contract-id-seeding=testing-weak",
"--port=6865",
"--eager-package-loading",
],
},
}
server_conformance_test(
name = "next-conformance-test-static-time",
server_args = [
"--static-time",
],
servers = NEXT_SERVERS,
test_tool_args = [
"--open-world",
"--exclude=ClosedWorldIT",
],
)
server_conformance_test(
name = "next-conformance-test-wall-clock-time",
server_args = [
"--wall-clock-time",
],
servers = NEXT_SERVERS,
test_tool_args = [
"--open-world",
"--exclude=ClosedWorldIT",
],
)
server_conformance_test(
name = "next-conformance-test-closed-world",
server_args = [
"--wall-clock-time",
"--implicit-party-allocation=false",
],
servers = NEXT_SERVERS,
test_tool_args = [
"--verbose",
"--include=ClosedWorldIT",
],
)