# 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", "da_scala_test_suite", "lf_scalacopts", ) lf_targets_with_deps = { "1.0": [], "1.1": ["1.0"], "1.3": ["1.1"], "1.dev": ["1.3"], } lf_targets = lf_targets_with_deps.keys() da_scala_library( name = "encoder", srcs = glob( ["src/main/**/*.scala"], exclude = ["src/main/scala/com/digitalasset/daml/lf/testing/archive/DamlLfEncoder.scala"], ), scalacopts = lf_scalacopts, visibility = ["//daml-lf:__subpackages__"], deps = [ "//3rdparty/jvm/com/google/protobuf:protobuf_java", "//3rdparty/jvm/org/scalaz:scalaz_core", "//daml-lf/archive:daml_lf_archive_scala", "//daml-lf/archive:daml_lf_java_proto", "//daml-lf/data", "//daml-lf/language", ], ) da_scala_test_suite( name = "tests", size = "small", srcs = glob(["src/test/scala/com/digitalasset/daml/lf/testing/archive/**/*.scala"]), data = [":testing-dar-%s" % target for target in lf_targets], scalacopts = lf_scalacopts, deps = [ ":encoder", "//3rdparty/jvm/com/google/protobuf:protobuf_java", "//3rdparty/jvm/org/scalacheck", "//3rdparty/jvm/org/scalatest", "//3rdparty/jvm/org/scalaz:scalaz_core", "//bazel_tools/runfiles:scala_runfiles", "//daml-lf/archive:daml_lf_archive_scala", "//daml-lf/archive:daml_lf_java_proto", "//daml-lf/data", "//daml-lf/language", "//daml-lf/parser", "//daml-lf/validation", ], ) da_scala_binary( name = "encoder_binary", srcs = glob(["src/main/scala/com/digitalasset/daml/lf/testing/archive/DamlLfEncoder.scala"]), main_class = "com.digitalasset.daml.lf.testing.archive.DamlLfEncoder", scalacopts = ["-Xsource:2.13"], visibility = [ "//daml-lf:__subpackages__", "//language-support:__subpackages__", ], deps = [ ":encoder", "//3rdparty/jvm/com/google/protobuf:protobuf_java", "//3rdparty/jvm/org/scalacheck", "//3rdparty/jvm/org/scalatest", "//3rdparty/jvm/org/scalaz:scalaz_core", "//bazel_tools/runfiles:scala_runfiles", "//daml-lf/archive:daml_lf_archive_scala", "//daml-lf/archive:daml_lf_java_proto", "//daml-lf/data", "//daml-lf/language", "//daml-lf/parser", "//daml-lf/validation", ], ) [ filegroup( name = "lf_since_%s" % target, srcs = [":lf_since_%s" % dep for dep in lf_targets_with_deps[target]] + glob([ "src/test/lf/since_%s/**/*.lf" % target, ]), ) for target in lf_targets ] [ genrule( name = "testing-dar-%s" % target, srcs = [":lf_since_%s" % target], outs = ["test-%s.dar" % target], cmd = "$(location :encoder_binary) $(SRCS) --output $@ --target %s" % target, tools = [":encoder_binary"], visibility = [ "//daml-lf:__subpackages__", "//language-support:__subpackages__", ], ) for target in lf_targets ]