daml/daml-lf/interface/BUILD.bazel
Stephen Compall 0b5ad7a7bd
interface support in the interface library (#13154)
This adds the presence of interface names, as well as lists of choices
and their argument/return types for each interface.

It also changes the semantics of DefTemplate and EnvironmentInterface:
each may contain "unresolved choices", which are the choices inherited
from interfaces for each implementing template;
EnvironmentInterface#resolveChoices will copy the full type information
as a concrete choice for each implementing template, which should be
much simpler for codegen and json-api.

A type generator should take account of the astInterfaces as well as
typeDecls in EnvironmentInterface; interfaces aren't included in
typeDecls because where I is an interface only ContractId I is
serializable.

* Ast.DataInterface is empty, just use the interfaces map directly
* port json-api for interface API changes; does not solve #12689
* port Scala codegen for interface API changes; does not add support
* port Java codegen for interface API changes; does not solve #11350

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-15 19:34:54 +00:00

65 lines
1.9 KiB
Python

# Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"da_scala_library",
"da_scala_test",
"lf_scalacopts",
"lf_scalacopts_stricter",
)
load("//rules_daml:daml.bzl", "daml_compile")
load("//daml-lf/language:daml-lf.bzl", "lf_version_configuration")
da_scala_library(
name = "interface",
srcs = glob(["src/main/**/*.scala"]),
scala_deps = [
"@maven//:org_scalaz_scalaz_core",
],
scalacopts = lf_scalacopts_stricter,
tags = ["maven_coordinates=com.daml:daml-lf-interface:__VERSION__"],
visibility = [
"//daml-assistant/daml-sdk:__subpackages__",
"//daml-lf:__subpackages__",
"//daml-script:__subpackages__",
"//language-support:__subpackages__",
"//ledger-service:__subpackages__",
"//navigator:__subpackages__",
],
deps = [
"//daml-lf/archive:daml_lf_1.dev_archive_proto_java",
"//daml-lf/archive:daml_lf_archive_reader",
"//daml-lf/data",
"//daml-lf/language",
"@maven//:com_google_protobuf_protobuf_java",
],
)
daml_compile(
name = "InterfaceTestPackage",
srcs = ["src/test/daml/InterfaceTestPackage.daml"],
target = lf_version_configuration.get("dev"), # TODO(SC) remove when interfaces in default
)
da_scala_test(
name = "tests",
size = "small",
srcs = glob(["src/test/**/*.scala"]),
data = [":InterfaceTestPackage.dar"],
scala_deps = [
"@maven//:org_scalaz_scalaz_core",
],
scalacopts = lf_scalacopts,
deps = [
":interface",
"//bazel_tools/runfiles:scala_runfiles",
"//daml-lf/archive:daml_lf_1.dev_archive_proto_java",
"//daml-lf/archive:daml_lf_archive_reader",
"//daml-lf/data",
"//daml-lf/language",
"//daml-lf/parser",
"@maven//:com_google_protobuf_protobuf_java",
],
)