|
|
|
@ -80,6 +80,7 @@ def _proto_gen_impl(ctx): |
|
|
|
|
srcs = ctx.files.srcs |
|
|
|
|
langs = ctx.attr.langs or [] |
|
|
|
|
out_type = ctx.attr.out_type |
|
|
|
|
enable_editions = ctx.attr.enable_editions |
|
|
|
|
deps = depset(direct = ctx.files.srcs) |
|
|
|
|
source_dir = _SourceDir(ctx) |
|
|
|
|
gen_dir = _GenDir(ctx).rstrip("/") |
|
|
|
@ -130,6 +131,8 @@ def _proto_gen_impl(ctx): |
|
|
|
|
generated_files = [] |
|
|
|
|
for src in srcs: |
|
|
|
|
args = [] |
|
|
|
|
if enable_editions: |
|
|
|
|
args.append("--experimental_editions") |
|
|
|
|
|
|
|
|
|
in_gen_dir = src.root.path == gen_dir |
|
|
|
|
if in_gen_dir: |
|
|
|
@ -247,6 +250,7 @@ _proto_gen = rule( |
|
|
|
|
attrs = { |
|
|
|
|
"srcs": attr.label_list(allow_files = True), |
|
|
|
|
"deps": attr.label_list(providers = [ProtoGenInfo]), |
|
|
|
|
"enable_editions": attr.bool(), |
|
|
|
|
"includes": attr.string_list(), |
|
|
|
|
"protoc": attr.label( |
|
|
|
|
cfg = "exec", |
|
|
|
@ -406,11 +410,11 @@ def internal_objc_proto_library( |
|
|
|
|
includes = ["."], |
|
|
|
|
default_runtime = Label("//:protobuf_objc"), |
|
|
|
|
protoc = Label("//:protoc"), |
|
|
|
|
enable_editions = False, |
|
|
|
|
testonly = None, |
|
|
|
|
visibility = ["//visibility:public"], |
|
|
|
|
**kwargs): |
|
|
|
|
"""Bazel rule to create a Objective-C protobuf library from proto source |
|
|
|
|
files |
|
|
|
|
"""Bazel rule to create a Objective-C protobuf library from proto sources |
|
|
|
|
|
|
|
|
|
NOTE: the rule is only an internal workaround to generate protos. The |
|
|
|
|
interface may change and the rule may be removed when bazel has introduced |
|
|
|
@ -423,9 +427,10 @@ def internal_objc_proto_library( |
|
|
|
|
outs: a list of expected output files. |
|
|
|
|
proto_deps: a list of proto file dependencies that don't have a |
|
|
|
|
objc_proto_library rule. |
|
|
|
|
include: a string indicating the include path of the .proto files. |
|
|
|
|
includes: a string indicating the include path of the .proto files. |
|
|
|
|
default_runtime: the Objective-C Protobuf runtime |
|
|
|
|
protoc: the label of the protocol compiler to generate the sources. |
|
|
|
|
enable_editions: if editions should be enabled while invoking the compiler. |
|
|
|
|
testonly: common rule attribute (see: |
|
|
|
|
https://bazel.build/reference/be/common-definitions#common-attributes) |
|
|
|
|
visibility: the visibility of the generated files. |
|
|
|
@ -440,6 +445,7 @@ def internal_objc_proto_library( |
|
|
|
|
testonly = testonly, |
|
|
|
|
srcs = proto_deps, |
|
|
|
|
protoc = protoc, |
|
|
|
|
enable_editions = enable_editions, |
|
|
|
|
includes = includes, |
|
|
|
|
) |
|
|
|
|
full_deps.append(":%s_deps_genproto" % name) |
|
|
|
@ -454,6 +460,7 @@ def internal_objc_proto_library( |
|
|
|
|
out_type = "hdrs", |
|
|
|
|
includes = includes, |
|
|
|
|
protoc = protoc, |
|
|
|
|
enable_editions = enable_editions, |
|
|
|
|
testonly = testonly, |
|
|
|
|
visibility = visibility, |
|
|
|
|
tags = ["manual"], |
|
|
|
@ -467,6 +474,7 @@ def internal_objc_proto_library( |
|
|
|
|
out_type = "srcs", |
|
|
|
|
includes = includes, |
|
|
|
|
protoc = protoc, |
|
|
|
|
enable_editions = enable_editions, |
|
|
|
|
testonly = testonly, |
|
|
|
|
visibility = visibility, |
|
|
|
|
tags = ["manual"], |
|
|
|
|