daml/ledger/sandbox/BUILD.bazel

165 lines
5.1 KiB
Python
Raw Normal View History

2019-04-04 11:33:38 +03:00
# Copyright (c) 2019 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",
2019-04-04 11:33:38 +03:00
)
load(
"//rules_daml:daml.bzl",
"daml_compile",
2019-04-04 11:33:38 +03:00
)
load("//bazel_tools:pom_file.bzl", "pom_file")
2019-04-04 11:33:38 +03:00
load("@os_info//:os_info.bzl", "is_darwin")
compileDependencies = [
# this has to come first other as somehow a different instance of grpc-core.jar
"//3rdparty/jvm/io/grpc:grpc_services",
"//daml-lf/scenario-interpreter",
"//daml-lf/transaction",
"//daml-lf/engine",
"//daml-lf/data",
"//daml-lf/lfpackage",
"//daml-lf/archive:daml_lf_java_proto",
"//daml-lf/archive:daml_lf_archive_scala",
"//daml-lf/interpreter",
"//daml-lf/transaction/src/main/protobuf:value_java_proto",
"//daml-lf/transaction/src/main/protobuf:transaction_java_proto",
"//ledger-api/rs-grpc-bridge",
"//ledger-api/rs-grpc-akka",
"//ledger/ledger-api-akka",
"//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-v2",
"//3rdparty/jvm/com/typesafe/scala_logging:scala_logging",
"//3rdparty/jvm/org/slf4j:slf4j_api",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//3rdparty/jvm/org/scalaz:scalaz_concurrent",
"//3rdparty/jvm/io/netty:netty_codec_http2",
"//3rdparty/jvm/io/netty:netty_tcnative_boringssl_static",
"//3rdparty/jvm/io/grpc:grpc_netty",
"//3rdparty/jvm/io/netty:netty_handler",
"//3rdparty/jvm/com/github/scopt:scopt",
"//3rdparty/jvm/com/typesafe/akka:akka_stream",
"//3rdparty/jvm/com/google/guava:guava",
"//3rdparty/jvm/org/postgresql:postgresql",
"//3rdparty/jvm/com/zaxxer:HikariCP",
"//3rdparty/jvm/org/flywaydb:flyway_core",
"//3rdparty/jvm/com/typesafe/play:anorm",
"//3rdparty/jvm/com/typesafe/play:anorm_akka",
"//3rdparty/jvm/io/dropwizard/metrics:metrics_core",
"//3rdparty/jvm/io/dropwizard/metrics:metrics_jmx",
2019-04-04 11:33:38 +03:00
]
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 = [
"//3rdparty/jvm/ch/qos/logback:logback_classic",
"//3rdparty/jvm/ch/qos/logback:logback_core",
],
deps = compileDependencies,
2019-04-04 11:33:38 +03:00
)
da_scala_binary(
name = "sandbox-binary",
main_class = "com.digitalasset.platform.sandbox.SandboxMain",
resources = ["src/main/resources/logback.xml"],
visibility = ["//visibility:public"],
deps = [
":sandbox",
],
2019-04-04 11:33:38 +03:00
)
genrule(
name = "sandbox-tarball",
srcs = [
":sandbox-binary_deploy.jar",
"//:component-version",
],
2019-04-04 11:33:38 +03:00
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
2019-04-04 11:33:38 +03:00
""",
visibility = ["//visibility:public"],
2019-04-04 11:33:38 +03:00
)
# The sole purpose of this rule is to get the sandbox.jar with version 0.0.0.
genrule(
name = "sandbox-head-tarball",
srcs = [":sandbox-binary_deploy.jar"],
outs = ["sandbox-head-tarball.tar.gz"],
cmd = """
mkdir -p sandbox-head-tarball/sandbox
cp -L $(location :sandbox-binary_deploy.jar) sandbox-head-tarball/sandbox/sandbox-0.0.0.jar
out=$$(realpath $@)
cd sandbox-head-tarball
tar zcf $$out sandbox
2019-04-04 11:33:38 +03:00
""",
visibility = ["//visibility:public"],
2019-04-04 11:33:38 +03:00
)
daml_compile(
name = "Test",
main_src = "src/test/resources/damls/Test.daml",
target = "1.dev",
visibility = ["//visibility:public"],
2019-04-04 11:33:38 +03:00
)
#TODO: generate dynamic BuildInfo.scala
testDependencies = [
":sandbox",
"//ledger/test-common:test-common",
"//ledger-api/testing-utils",
"//3rdparty/jvm/org/scalatest:scalatest",
"//3rdparty/jvm/org/scalacheck:scalacheck",
"//3rdparty/jvm/org/awaitility:awaitility",
"//3rdparty/jvm/commons_io:commons_io",
2019-04-04 11:33:38 +03:00
] + compileDependencies
da_scala_library(
name = "sandbox-scala-tests-lib",
srcs = glob(["src/test/lib/**/*.scala"]),
visibility = ["//visibility:public"],
deps = testDependencies,
2019-04-04 11:33:38 +03:00
)
da_scala_test_suite(
name = "sandbox-scala-tests",
srcs = glob(
["src/test/suite/**/*.scala"],
2019-04-04 11:33:38 +03:00
),
data = [
2019-04-15 17:45:08 +03:00
"//ledger/sandbox:Test.dar",
],
resources = glob(["src/test/resources/**/*"]),
2019-04-04 11:33:38 +03:00
deps = [
":sandbox-scala-tests-lib",
] + testDependencies,
)