mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-19 08:48:21 +03:00
Split off value.proto into own lib (#19279)
* Split off value.proto into own lib * Move the files to daml-lf * Add artifacts * Fix the build * Rationalize bazel struct * Fixes from review: - improve handling of proto dependencies - fix copyright note
This commit is contained in:
parent
19d2d6b17e
commit
f60b1945e1
@ -197,6 +197,9 @@ def _proto_scala_deps(grpc, proto_deps, java_conversions):
|
||||
for label in proto_deps
|
||||
] + ([
|
||||
"@maven//:io_grpc_grpc_services",
|
||||
] if java_conversions else []) + ([
|
||||
"%s_java" % label
|
||||
for label in proto_deps
|
||||
] if java_conversions else [])
|
||||
|
||||
def proto_jars(
|
||||
@ -303,7 +306,7 @@ def proto_jars(
|
||||
tags = _maven_tags(maven_group, maven_artifact_prefix, maven_artifact_scala_suffix),
|
||||
unused_dependency_checker_mode = "error",
|
||||
visibility = visibility,
|
||||
deps = all_scala_deps + (["{}_java".format(name)] if java_conversions else []),
|
||||
deps = all_scala_deps + (["{}_java".format(name)] if java_conversions else []) + scala_deps,
|
||||
exports = all_scala_deps,
|
||||
)
|
||||
|
||||
|
@ -6,9 +6,11 @@ version: v1beta1
|
||||
build:
|
||||
roots:
|
||||
- sdk/canton/community/ledger-api/src/main/protobuf
|
||||
- sdk/daml-lf/ledger-api-value/src/main/protobuf
|
||||
- sdk/3rdparty/protobuf
|
||||
excludes:
|
||||
- sdk/canton/community/ledger-api/src/main/protobuf/com/daml/ledger/api/scalapb
|
||||
- sdk/daml-lf/ledger-api-value/src/main/protobuf/com/daml/ledger/api/scalapb
|
||||
|
||||
breaking:
|
||||
use:
|
||||
@ -21,9 +23,3 @@ breaking:
|
||||
# to select the fields to update, see https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/field_mask.proto
|
||||
|
||||
ignore_only:
|
||||
FIELD_NO_DELETE:
|
||||
- com/daml/ledger/api/v1/commands.proto
|
||||
- com/daml/ledger/api/v1/event.proto
|
||||
- com/daml/ledger/api/v1/transaction_filter.proto
|
||||
ONEOF_NO_DELETE:
|
||||
- com/daml/ledger/api/v1/commands.proto
|
||||
|
@ -1273,7 +1273,10 @@ scala_binary(
|
||||
|
||||
proto_gen(
|
||||
name = "ledger-api-java",
|
||||
srcs = [":ledger_api_proto"],
|
||||
srcs = [
|
||||
":ledger_api_proto",
|
||||
"//daml-lf/ledger-api-value:ledger_api_value_proto",
|
||||
],
|
||||
plugin_name = "java",
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
@ -1305,7 +1308,10 @@ java_library(
|
||||
|
||||
proto_gen(
|
||||
name = "ledger-api-java-grpc",
|
||||
srcs = [":ledger_api_proto"],
|
||||
srcs = [
|
||||
":ledger_api_proto",
|
||||
"//daml-lf/ledger-api-value:ledger_api_value_proto",
|
||||
],
|
||||
plugin_exec = "@io_grpc_grpc_java//compiler:grpc_java_plugin",
|
||||
plugin_name = "java-grpc",
|
||||
visibility = [
|
||||
@ -1443,6 +1449,7 @@ proto_jars(
|
||||
maven_artifact_prefix = "ledger-api",
|
||||
maven_artifact_scala_suffix = "scalapb",
|
||||
maven_group = "com.daml",
|
||||
proto_deps = ["//daml-lf/ledger-api-value:ledger_api_value_proto"],
|
||||
strip_import_prefix = "community/ledger-api/src/main/protobuf",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
@ -1518,11 +1525,7 @@ genrule(
|
||||
|
||||
filegroup(
|
||||
name = "ledger-api-protos-fg",
|
||||
srcs = glob(
|
||||
[
|
||||
"community/ledger-api/src/main/protobuf/com/daml/ledger/api/v2/*.proto",
|
||||
],
|
||||
),
|
||||
srcs = glob(["community/ledger-api/src/main/protobuf/com/daml/ledger/api/v2/*.proto"]),
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
@ -1531,12 +1534,15 @@ ledger_api_haskellpb_sources = [
|
||||
"V2/PackageService.hs",
|
||||
]
|
||||
|
||||
ledger_api_value_proto_source_root = "daml-lf/ledger-api-value/src/main/protobuf"
|
||||
|
||||
genrule(
|
||||
name = "ledger-api-haskellpb-sources",
|
||||
srcs = [
|
||||
"@com_google_protobuf//:well_known_type_protos",
|
||||
"@go_googleapis//google/rpc:status.proto",
|
||||
":ledger-api-protos-fg",
|
||||
"//daml-lf/ledger-api-value:ledger-api-value-protos-fg",
|
||||
],
|
||||
outs = ["Com/Daml/Ledger/Api/V2/PackageService.hs"],
|
||||
cmd = """
|
||||
@ -1544,6 +1550,7 @@ genrule(
|
||||
$(location @proto3-suite//:compile-proto-file) \
|
||||
--includeDir """ + google_protobuf_src + """ \
|
||||
--includeDir """ + google_rpc_src + """ \
|
||||
--includeDir """ + ledger_api_value_proto_source_root + """ \
|
||||
--includeDir """ + ledger_api_proto_source_root + """ \
|
||||
--proto com/daml/ledger/api/v2/$$(basename $$src) \
|
||||
--out $(@D)
|
||||
|
34
sdk/daml-lf/ledger-api-value/BUILD.bazel
Normal file
34
sdk/daml-lf/ledger-api-value/BUILD.bazel
Normal file
@ -0,0 +1,34 @@
|
||||
# Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
load("//bazel_tools:proto.bzl", "proto_jars")
|
||||
|
||||
filegroup(
|
||||
name = "ledger-api-value-protos-fg",
|
||||
srcs = glob(["src/main/protobuf/com/daml/ledger/api/v*/**/*.proto"]),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
proto_jars(
|
||||
name = "ledger_api_value_proto",
|
||||
srcs = glob(["src/main/protobuf/com/daml/ledger/api/v*/**/*.proto"]),
|
||||
grpc = True,
|
||||
java_conversions = True,
|
||||
maven_artifact_prefix = "ledger-api-value",
|
||||
maven_artifact_scala_suffix = "scalapb",
|
||||
maven_group = "com.daml",
|
||||
strip_import_prefix = "src/main/protobuf",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"@com_google_protobuf//:any_proto",
|
||||
"@com_google_protobuf//:descriptor_proto",
|
||||
"@com_google_protobuf//:duration_proto",
|
||||
"@com_google_protobuf//:empty_proto",
|
||||
"@com_google_protobuf//:field_mask_proto",
|
||||
"@com_google_protobuf//:struct_proto",
|
||||
"@com_google_protobuf//:timestamp_proto",
|
||||
"@com_google_protobuf//:wrappers_proto",
|
||||
"@go_googleapis//google/rpc:errdetails_proto",
|
||||
"@go_googleapis//google/rpc:status_proto",
|
||||
],
|
||||
)
|
@ -0,0 +1,14 @@
|
||||
// Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
import "scalapb/scalapb.proto";
|
||||
|
||||
package com.daml.ledger.api;
|
||||
|
||||
option (scalapb.options) = {
|
||||
scope: PACKAGE
|
||||
preserve_unknown_fields: false
|
||||
java_conversions : true
|
||||
};
|
@ -29,6 +29,12 @@
|
||||
type: jar-scala
|
||||
- target: //daml-lf/language:language
|
||||
type: jar-scala
|
||||
- target: //daml-lf/ledger-api-value:ledger_api_value_proto_jar
|
||||
type: jar-lib
|
||||
- target: //daml-lf/ledger-api-value:ledger_api_value_proto_java
|
||||
type: jar-proto
|
||||
- target: //daml-lf/ledger-api-value:ledger_api_value_proto_scala
|
||||
type: jar-scala
|
||||
- target: //daml-lf/parser:parser
|
||||
type: jar-scala
|
||||
- target: //daml-lf/scenario-interpreter:scenario-interpreter
|
||||
|
@ -114,7 +114,7 @@ def _protos_zip_impl(ctx):
|
||||
)
|
||||
tools = [ctx.executable.tar, ctx.executable.gzip]
|
||||
ctx.actions.run_shell(
|
||||
inputs = [ctx.file.ledger_api_tarball] + ctx.files.daml_lf_tarballs,
|
||||
inputs = [ctx.file.ledger_api_tarball] + ctx.files.daml_lf_tarballs + ctx.files.ledger_api_value_tarball,
|
||||
outputs = [tmp_dir],
|
||||
tools = tools,
|
||||
command = """
|
||||
@ -125,8 +125,10 @@ def _protos_zip_impl(ctx):
|
||||
do
|
||||
tar xf $file -C {tmp_dir}
|
||||
done
|
||||
tar xf {ledger_api_value_tarball} -C {tmp_dir}
|
||||
""".format(
|
||||
ledger_api_tarball = ctx.file.ledger_api_tarball.path,
|
||||
ledger_api_value_tarball = ctx.file.ledger_api_value_tarball.path,
|
||||
tmp_dir = tmp_dir.path,
|
||||
lf_tarballs = " ".join([f.path for f in ctx.files.daml_lf_tarballs]),
|
||||
path = ":".join(["$PWD/`dirname {tool}`".format(tool = tool.path) for tool in tools]),
|
||||
@ -169,6 +171,10 @@ protos_zip = rule(
|
||||
allow_single_file = True,
|
||||
default = Label("//canton:ledger_api_proto_tar.tar.gz"),
|
||||
),
|
||||
"ledger_api_value_tarball": attr.label(
|
||||
allow_single_file = True,
|
||||
default = Label("//daml-lf/ledger-api-value:ledger_api_value_proto_tar.tar.gz"),
|
||||
),
|
||||
"zipper": attr.label(
|
||||
default = Label("@bazel_tools//tools/zip:zipper"),
|
||||
cfg = "host",
|
||||
|
Loading…
Reference in New Issue
Block a user