daml/ledger/sandbox/BUILD.bazel
moritzkiefer-da fa4067ad1b
Move POM file generation to Bazel rules (#374)
* Move POM file generation to Bazel rules
2019-04-11 11:24:52 +02:00

149 lines
4.4 KiB
Python

# 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_test_suite',
'da_scala_library',
'da_scala_binary',
)
load(
"//rules_daml:daml.bzl",
"daml_compile"
)
load("//bazel_tools:pom_file.bzl", "pom_file")
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/backend-api',
'//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'
]
da_scala_library(
name = 'sandbox',
srcs = glob(['src/main/scala/**/*.scala']),
resources = glob(['src/main/resources/**/*']) + [
'//:COMPONENT-VERSION'
],
deps = compileDependencies,
runtime_deps = [
'//3rdparty/jvm/ch/qos/logback:logback_core',
'//3rdparty/jvm/ch/qos/logback:logback_classic'
],
visibility = [
'//visibility:public',
],
tags = ["maven_coordinates=com.digitalasset.platform:sandbox:__VERSION__"],
)
da_scala_binary(
name = "sandbox-binary",
main_class = 'com.digitalasset.platform.sandbox.SandboxMain',
deps = [
":sandbox",
],
visibility = ['//visibility:public'],
)
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
cp -L $(location :sandbox-binary_deploy.jar) sandbox/sandbox-$$VERSION.jar
tar zcf $@ sandbox
""",
visibility = [ '//visibility:public']
)
# 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
cp -L $(location :sandbox-binary_deploy.jar) sandbox/sandbox-0.0.0.jar
tar zcf $@ sandbox
""",
visibility = ['//visibility:public']
)
daml_compile(
name = "Test",
main_src = "src/test/resources/damls/Test.daml",
target = "1.3",
damlc = "//daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app-deprecated",
visibility = ['//visibility:public'],
)
#TODO: generate dynamic BuildInfo.scala
testDependencies = [
':sandbox',
'//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'
] + compileDependencies
da_scala_library(
name = "sandbox-scala-tests-lib",
srcs = glob(['src/test/lib/**/*.scala']),
deps = testDependencies,
visibility = ['//visibility:public']
)
da_scala_test_suite(
name = "sandbox-scala-tests",
srcs = glob(
['src/test/suite/**/*.scala'],
),
resources = glob(['src/test/resources/**/*']),
data = ['//ledger/sandbox:Test.dalf', '//daml-foundations/daml-ghc/package-database/deprecated:daml-prim-1.3.dalf'],
deps = [
":sandbox-scala-tests-lib",
] + testDependencies,
)