Drop transitive aspect-based compilation. Closes #137
This commit is contained in:
parent
5ad178627b
commit
8d09a4d73e
|
@ -1,55 +1,17 @@
|
|||
"""Generated definition of android_grpc_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for android_grpc_compile
|
||||
android_grpc_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//android:javalite_plugin"),
|
||||
Label("//android:grpc_javalite_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "android_grpc_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
android_grpc_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [android_grpc_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -61,10 +23,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def android_grpc_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,54 +1,17 @@
|
|||
"""Generated definition of android_proto_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for android_proto_compile
|
||||
android_proto_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//android:javalite_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "android_proto_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
android_proto_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [android_proto_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -59,10 +22,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def android_proto_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,54 +1,17 @@
|
|||
"""Generated definition of c_proto_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for c_proto_compile
|
||||
c_proto_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//c:upb_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "c_proto_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
c_proto_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [c_proto_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -59,10 +22,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def c_proto_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,55 +1,17 @@
|
|||
"""Generated definition of cpp_grpc_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for cpp_grpc_compile
|
||||
cpp_grpc_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//cpp:cpp_plugin"),
|
||||
Label("//cpp:grpc_cpp_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "cpp_grpc_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
cpp_grpc_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [cpp_grpc_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -61,10 +23,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def cpp_grpc_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,54 +1,17 @@
|
|||
"""Generated definition of cpp_proto_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for cpp_proto_compile
|
||||
cpp_proto_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//cpp:cpp_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "cpp_proto_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
cpp_proto_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [cpp_proto_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -59,10 +22,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def cpp_proto_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,55 +1,17 @@
|
|||
"""Generated definition of csharp_grpc_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for csharp_grpc_compile
|
||||
csharp_grpc_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//csharp:csharp_plugin"),
|
||||
Label("//csharp:grpc_csharp_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "csharp_grpc_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
csharp_grpc_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [csharp_grpc_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -61,10 +23,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def csharp_grpc_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,54 +1,17 @@
|
|||
"""Generated definition of csharp_proto_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for csharp_proto_compile
|
||||
csharp_proto_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//csharp:csharp_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "csharp_proto_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
csharp_proto_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [csharp_proto_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -59,10 +22,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def csharp_proto_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,54 +1,17 @@
|
|||
"""Generated definition of d_proto_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for d_proto_compile
|
||||
d_proto_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//d:d_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "d_proto_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
d_proto_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [d_proto_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -59,10 +22,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def d_proto_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
9
defs.bzl
9
defs.bzl
|
@ -1,19 +1,16 @@
|
|||
"""Top level definition exports for rules_proto_grpc."""
|
||||
|
||||
load("//internal:compile.bzl", _proto_compile_aspect_attrs = "proto_compile_aspect_attrs", _proto_compile_aspect_impl = "proto_compile_aspect_impl", _proto_compile_attrs = "proto_compile_attrs", _proto_compile_impl = "proto_compile_impl")
|
||||
load("//internal:compile.bzl", _proto_compile_attrs = "proto_compile_attrs", _proto_compile_impl = "proto_compile_impl")
|
||||
load("//internal:plugin.bzl", _proto_plugin = "proto_plugin")
|
||||
load("//internal:providers.bzl", _ProtoCompileInfo = "ProtoCompileInfo", _ProtoLibraryAspectNodeInfo = "ProtoLibraryAspectNodeInfo", _ProtoPluginInfo = "ProtoPluginInfo")
|
||||
load("//internal:providers.bzl", _ProtoCompileInfo = "ProtoCompileInfo", _ProtoPluginInfo = "ProtoPluginInfo")
|
||||
|
||||
# Export providers
|
||||
ProtoPluginInfo = _ProtoPluginInfo
|
||||
ProtoLibraryAspectNodeInfo = _ProtoLibraryAspectNodeInfo
|
||||
ProtoCompileInfo = _ProtoCompileInfo
|
||||
|
||||
# Export plugin rule
|
||||
proto_plugin = _proto_plugin
|
||||
|
||||
# Export compile and aspect rules
|
||||
# Export compile rule implementation and attrs
|
||||
proto_compile_attrs = _proto_compile_attrs
|
||||
proto_compile_aspect_attrs = _proto_compile_aspect_attrs
|
||||
proto_compile_impl = _proto_compile_impl
|
||||
proto_compile_aspect_impl = _proto_compile_aspect_impl
|
||||
|
|
|
@ -1,54 +1,17 @@
|
|||
"""Generated definition of doc_docbook_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for doc_docbook_compile
|
||||
doc_docbook_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//doc:docbook_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "doc_docbook_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
doc_docbook_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [doc_docbook_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -59,10 +22,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def doc_docbook_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,54 +1,17 @@
|
|||
"""Generated definition of doc_html_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for doc_html_compile
|
||||
doc_html_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//doc:html_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "doc_html_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
doc_html_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [doc_html_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -59,10 +22,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def doc_html_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,54 +1,17 @@
|
|||
"""Generated definition of doc_json_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for doc_json_compile
|
||||
doc_json_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//doc:json_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "doc_json_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
doc_json_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [doc_json_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -59,10 +22,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def doc_json_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,54 +1,17 @@
|
|||
"""Generated definition of doc_markdown_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for doc_markdown_compile
|
||||
doc_markdown_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//doc:markdown_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "doc_markdown_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
doc_markdown_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [doc_markdown_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -59,10 +22,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def doc_markdown_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,54 +1,17 @@
|
|||
"""Generated definition of fsharp_grpc_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for fsharp_grpc_compile
|
||||
fsharp_grpc_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//fsharp:grpc_fsharp_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "fsharp_grpc_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
fsharp_grpc_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [fsharp_grpc_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -59,10 +22,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def fsharp_grpc_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,54 +1,17 @@
|
|||
"""Generated definition of fsharp_proto_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for fsharp_proto_compile
|
||||
fsharp_proto_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//fsharp:fsharp_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "fsharp_proto_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
fsharp_proto_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [fsharp_proto_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -59,10 +22,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def fsharp_proto_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,55 +1,17 @@
|
|||
"""Generated definition of go_grpc_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for go_grpc_compile
|
||||
go_grpc_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//go:go_plugin"),
|
||||
Label("//go:grpc_go_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "go_grpc_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
go_grpc_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [go_grpc_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -61,10 +23,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def go_grpc_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,54 +1,17 @@
|
|||
"""Generated definition of go_proto_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for go_proto_compile
|
||||
go_proto_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//go:go_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "go_proto_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
go_proto_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [go_proto_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -59,10 +22,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def go_proto_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,56 +1,17 @@
|
|||
"""Generated definition of gateway_grpc_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for gateway_grpc_compile
|
||||
gateway_grpc_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//grpc-gateway:grpc_gateway_plugin"),
|
||||
Label("//go:grpc_go_plugin"),
|
||||
Label("//go:go_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "gateway_grpc_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
gateway_grpc_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [gateway_grpc_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -63,10 +24,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def gateway_grpc_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,54 +1,17 @@
|
|||
"""Generated definition of gateway_openapiv2_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for gateway_openapiv2_compile
|
||||
gateway_openapiv2_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//grpc-gateway:openapiv2_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "gateway_openapiv2_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
gateway_openapiv2_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [gateway_openapiv2_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -59,10 +22,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def gateway_openapiv2_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -136,25 +136,6 @@ def php_path(s):
|
|||
"""
|
||||
return "/".join([capitalize(c) for c in s.split("/")])
|
||||
|
||||
def get_int_attr(attr, name):
|
||||
"""
|
||||
Get an attr as an int from a string, with fallbacks.
|
||||
|
||||
Args:
|
||||
attr: The attr object from ctx.
|
||||
name: The attr name to load.
|
||||
|
||||
Returns:
|
||||
The attr value as an int.
|
||||
|
||||
"""
|
||||
value = getattr(attr, name)
|
||||
if value == "":
|
||||
return 0
|
||||
if value == "None":
|
||||
return 0
|
||||
return int(value)
|
||||
|
||||
def get_output_filename(src_file, pattern, proto_info):
|
||||
"""
|
||||
Build the predicted filename for file generated by the given plugin.
|
||||
|
|
|
@ -5,26 +5,25 @@ load(
|
|||
"//internal:common.bzl",
|
||||
"copy_file",
|
||||
"descriptor_proto_path",
|
||||
"get_int_attr",
|
||||
"get_output_filename",
|
||||
"get_package_root",
|
||||
"strip_path_prefix",
|
||||
)
|
||||
load("//internal:providers.bzl", "ProtoCompileInfo", "ProtoLibraryAspectNodeInfo", "ProtoPluginInfo")
|
||||
load("//internal:providers.bzl", "ProtoCompileInfo", "ProtoPluginInfo")
|
||||
load("//internal:protoc.bzl", "build_protoc_args")
|
||||
|
||||
proto_compile_attrs = {
|
||||
# Deps and protos attrs are added per-rule, as it depends on aspect name
|
||||
"protos": attr.label_list(
|
||||
mandatory = True,
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
"options": attr.string_list_dict(
|
||||
doc = "Extra options to pass to plugins, as a dict of plugin label -> list of strings. The key * can be used exclusively to apply to all plugins",
|
||||
),
|
||||
"verbose": attr.int(
|
||||
doc = "The verbosity level. Supported values and results are 1: *show command*, 2: *show command and sandbox after running protoc*, 3: *show command and sandbox before and after running protoc*, 4. *show env, command, expected outputs and sandbox before and after running protoc*",
|
||||
),
|
||||
"verbose_string": attr.string(
|
||||
doc = "String version of the verbose string, used for aspect",
|
||||
default = "0",
|
||||
),
|
||||
"prefix_path": attr.string(
|
||||
doc = "Path to prefix to the generated files in the output directory",
|
||||
),
|
||||
|
@ -33,27 +32,17 @@ proto_compile_attrs = {
|
|||
),
|
||||
}
|
||||
|
||||
proto_compile_aspect_attrs = {
|
||||
"verbose_string": attr.string(
|
||||
doc = "String version of the verbose string, used for aspect",
|
||||
values = ["", "None", "0", "1", "2", "3", "4"],
|
||||
default = "0",
|
||||
),
|
||||
}
|
||||
|
||||
def common_compile(ctx, proto_infos):
|
||||
def proto_compile_impl(ctx):
|
||||
"""
|
||||
Common implementation of protoc setup and compilation action generation.
|
||||
Common implementation function for lang_*_compile rules.
|
||||
|
||||
Args:
|
||||
ctx: The Bazel rule execution context object.
|
||||
proto_infos: The ProtoInfo providers to load direct sources from.
|
||||
|
||||
Returns:
|
||||
Struct with fields:
|
||||
- output_root: The root of the generated files, relative to workspace root
|
||||
- output_files: Any files generated by the plugins
|
||||
- output_dirs: ANy directories generated by the plugins
|
||||
Providers:
|
||||
- ProtoCompileInfo
|
||||
- DefaultInfo
|
||||
|
||||
"""
|
||||
|
||||
|
@ -62,68 +51,56 @@ def common_compile(ctx, proto_infos):
|
|||
###
|
||||
|
||||
# Load attrs
|
||||
verbose = get_int_attr(ctx.attr, "verbose_string") # Integer verbosity level
|
||||
proto_infos = [dep[ProtoInfo] for dep in ctx.attr.protos]
|
||||
verbose = ctx.attr.verbose
|
||||
plugins = [plugin[ProtoPluginInfo] for plugin in ctx.attr._plugins]
|
||||
|
||||
# Load toolchain
|
||||
# Load toolchain and tools
|
||||
protoc_toolchain_info = ctx.toolchains[str(Label("//protobuf:toolchain_type"))]
|
||||
protoc = protoc_toolchain_info.protoc_executable
|
||||
fixer = protoc_toolchain_info.fixer_executable
|
||||
|
||||
# The directory where the outputs will be generated, relative to the package.
|
||||
# TODO(4.0.0): Remove _prefix branch
|
||||
if hasattr(ctx.attr, "_prefix"):
|
||||
# Aspect driven compilation, we must put different rules in different subdirs, since
|
||||
# a commonly used proto file may be hit by multiple aspects that may overlap with plugins
|
||||
# and would otherwise try to touch the same file. This also contains verbose_string for the
|
||||
# same reason.
|
||||
rel_output_root = "{}/{}_verb{}".format(ctx.label.name, ctx.attr._prefix, verbose)
|
||||
else:
|
||||
# Direct compilation. The directory can be named exactly as the label of the rule, since
|
||||
# there is no chance of overlap. A temporary dir is used here to allow output directories
|
||||
# that may need to be merged later
|
||||
rel_output_root = "_rpg_premerge_" + ctx.label.name
|
||||
# TODO(4.0.0): Apply prefix root directly here?
|
||||
#if ctx.attr.prefix_path:
|
||||
# rel_output_root += "/" + ctx.attr.prefix_path
|
||||
# A temporary dir is used here to allow output directories that may need to be merged later
|
||||
rel_premerge_root = "_rpg_premerge_" + ctx.label.name
|
||||
|
||||
# The full path to the output root, relative to the workspace
|
||||
output_root = get_package_root(ctx) + "/" + rel_output_root
|
||||
# The full path to the pre-merge output root, relative to the workspace
|
||||
premerge_root = get_package_root(ctx) + "/" + rel_premerge_root
|
||||
|
||||
# The lists of generated files and directories that we expect to be produced.
|
||||
output_files = []
|
||||
output_dirs = []
|
||||
# The lists of generated files and directories that we expect to be produced, in their pre-merge
|
||||
# locations
|
||||
premerge_files = []
|
||||
premerge_dirs = []
|
||||
|
||||
# Convert options dict to label keys
|
||||
plugin_labels = [plugin.label for plugin in plugins]
|
||||
per_plugin_options = {
|
||||
Label(plugin_label): options
|
||||
for plugin_label, options in ctx.attr.options.items()
|
||||
if plugin_label != "*"
|
||||
}
|
||||
|
||||
# If plugin options are provided, check they are only for the plugins available or *
|
||||
# TODO(4.0.0): Remove check for options in attr, it should always be there when not aspect
|
||||
per_plugin_options = {} # Dict of plugin label to options string list
|
||||
all_plugin_options = [] # Options applied to all plugins, from the '*' key
|
||||
if hasattr(ctx.attr, "options"):
|
||||
# Convert options dict to label keys
|
||||
plugin_labels = [plugin.label for plugin in plugins]
|
||||
per_plugin_options = {
|
||||
Label(plugin_label): options
|
||||
for plugin_label, options in ctx.attr.options.items()
|
||||
if plugin_label != "*"
|
||||
}
|
||||
|
||||
# Only allow '*' by itself
|
||||
if "*" in ctx.attr.options:
|
||||
if len(ctx.attr.options) > 1:
|
||||
fail("The options attr on target {} cannot contain '*' and other labels. Use either '*' or labels".format(ctx.label))
|
||||
all_plugin_options = ctx.attr.options["*"]
|
||||
# Only allow '*' by itself
|
||||
if "*" in ctx.attr.options:
|
||||
if len(ctx.attr.options) > 1:
|
||||
fail("The options attr on target {} cannot contain '*' and other labels. Use either '*' or labels".format(ctx.label))
|
||||
all_plugin_options = ctx.attr.options["*"]
|
||||
|
||||
# Check all labels match a plugin in use
|
||||
for plugin_label in per_plugin_options:
|
||||
if plugin_label not in plugin_labels:
|
||||
fail("The options attr on target {} contains a plugin label {} for a plugin that does not exist on this rule. The available plugins are {} ".format(ctx.label, plugin_label, plugin_labels))
|
||||
# Check all labels match a plugin in use
|
||||
for plugin_label in per_plugin_options:
|
||||
if plugin_label not in plugin_labels:
|
||||
fail("The options attr on target {} contains a plugin label {} for a plugin that does not exist on this rule. The available plugins are {} ".format(ctx.label, plugin_label, plugin_labels))
|
||||
|
||||
###
|
||||
### Setup plugins
|
||||
###
|
||||
|
||||
# Each plugin is isolated to its own execution of protoc, as plugins may have differing exclusions that cannot be
|
||||
# expressed in a single protoc execution for all plugins.
|
||||
# Each plugin is isolated to its own execution of protoc, as plugins may have differing
|
||||
# exclusions that cannot be expressed in a single protoc execution for all plugins.
|
||||
|
||||
for plugin in plugins:
|
||||
###
|
||||
|
@ -148,8 +125,8 @@ def common_compile(ctx, proto_infos):
|
|||
proto.dirname.endswith(exclusion) or proto.path.endswith(exclusion)
|
||||
for exclusion in plugin.exclusions
|
||||
]) or proto in protos:
|
||||
# When using import_prefix, the ProtoInfo.direct_sources list appears to contain duplicate records,
|
||||
# the final check 'proto in protos' removes these. See
|
||||
# When using import_prefix, the ProtoInfo.direct_sources list appears to contain
|
||||
# duplicate records, the final check 'proto in protos' removes these. See
|
||||
# https://github.com/bazelbuild/bazel/issues/9127
|
||||
continue
|
||||
|
||||
|
@ -159,7 +136,7 @@ def common_compile(ctx, proto_infos):
|
|||
# Add per-proto outputs
|
||||
for pattern in plugin.outputs:
|
||||
plugin_outputs.append(ctx.actions.declare_file("{}/{}".format(
|
||||
rel_output_root,
|
||||
rel_premerge_root,
|
||||
get_output_filename(proto, pattern, proto_info),
|
||||
)))
|
||||
|
||||
|
@ -170,38 +147,40 @@ def common_compile(ctx, proto_infos):
|
|||
if len(protos) == 0:
|
||||
if verbose > 2:
|
||||
print(
|
||||
'Skipping plugin "{}" for "{}" as all proto files have been excluded'.format(plugin.name, ctx.label),
|
||||
'Skipping plugin "{}" for "{}" as all proto files have been excluded'.format(
|
||||
plugin.name, ctx.label
|
||||
),
|
||||
) # buildifier: disable=print
|
||||
continue
|
||||
|
||||
# Append current plugin outputs to global outputs before looking at per-plugin outputs; these are manually added
|
||||
# globally as there may be srcjar outputs.
|
||||
output_files.extend(plugin_outputs)
|
||||
# Append current plugin outputs to global outputs before looking at per-plugin outputs;
|
||||
# these are manually added globally as there may be srcjar outputs.
|
||||
premerge_files.extend(plugin_outputs)
|
||||
|
||||
###
|
||||
### Declare per-plugin outputs
|
||||
###
|
||||
|
||||
# Some protoc plugins generate a set of output files (like python) while others generate a single 'archive' file
|
||||
# that contains the individual outputs (like java). Jar outputs are gathered as a special case as we need to
|
||||
# post-process them to have a 'srcjar' extension (java_library rules don't accept source jars with a 'jar'
|
||||
# extension).
|
||||
# Some protoc plugins generate a set of output files (like python) while others generate a
|
||||
# single 'archive' file that contains the individual outputs (like java). Jar outputs are
|
||||
# gathered as a special case as we need to post-process them to have a 'srcjar' extension
|
||||
# (java_library rules don't accept source jars with a 'jar' extension).
|
||||
|
||||
out_file = None
|
||||
if plugin.out:
|
||||
# Define out file
|
||||
out_file = ctx.actions.declare_file("{}/{}".format(
|
||||
rel_output_root,
|
||||
rel_premerge_root,
|
||||
plugin.out.replace("{name}", ctx.label.name),
|
||||
))
|
||||
plugin_outputs.append(out_file)
|
||||
|
||||
if not out_file.path.endswith(".jar"):
|
||||
# Add output direct to global outputs
|
||||
output_files.append(out_file)
|
||||
premerge_files.append(out_file)
|
||||
else:
|
||||
# Create .srcjar from .jar for global outputs
|
||||
output_files.append(copy_file(
|
||||
premerge_files.append(copy_file(
|
||||
ctx,
|
||||
out_file,
|
||||
"{}.srcjar".format(out_file.basename.rpartition(".")[0]),
|
||||
|
@ -212,31 +191,34 @@ def common_compile(ctx, proto_infos):
|
|||
### Declare plugin output directory if required
|
||||
###
|
||||
|
||||
# Some plugins outputs a structure that cannot be predicted from the input file paths alone. For these plugins,
|
||||
# we simply declare the directory.
|
||||
# Some plugins outputs a structure that cannot be predicted from the input file paths alone.
|
||||
# For these plugins, we simply declare the directory.
|
||||
|
||||
if plugin.output_directory:
|
||||
out_file = ctx.actions.declare_directory(rel_output_root + "/" + "_plugin_" + plugin.name)
|
||||
out_file = ctx.actions.declare_directory(rel_premerge_root + "/" + "_plugin_" + plugin.name)
|
||||
plugin_outputs.append(out_file)
|
||||
output_dirs.append(out_file)
|
||||
premerge_dirs.append(out_file)
|
||||
|
||||
###
|
||||
### Build command
|
||||
###
|
||||
|
||||
# Determine the outputs expected by protoc.
|
||||
# When plugin.empty_template is not set, protoc will output directly to the final targets. When set, we will
|
||||
# direct the plugin outputs to a temporary folder, then use the fixer executable to write to the final targets.
|
||||
# When plugin.empty_template is not set, protoc will output directly to the final targets.
|
||||
# When set, we will direct the plugin outputs to a temporary folder, then use the fixer
|
||||
# executable to write to the final targets.
|
||||
if plugin.empty_template:
|
||||
# Create path list for fixer
|
||||
fixer_paths_file = ctx.actions.declare_file(rel_output_root + "/" + "_plugin_fixer_manifest_" + plugin.name + ".txt")
|
||||
fixer_paths_file = ctx.actions.declare_file(rel_premerge_root + "/" + "_plugin_fixer_manifest_" + plugin.name + ".txt")
|
||||
ctx.actions.write(fixer_paths_file, "\n".join([
|
||||
file.path.partition(output_root + "/")[2] # Path of the file relative to the output root
|
||||
file.path.partition(premerge_root + "/")[2] # Path of the file relative to the output root
|
||||
for file in plugin_outputs
|
||||
]))
|
||||
|
||||
# Create output directory for protoc to write into
|
||||
fixer_dir = ctx.actions.declare_directory(rel_output_root + "/" + "_plugin_fixed_" + plugin.name)
|
||||
fixer_dir = ctx.actions.declare_directory(
|
||||
rel_premerge_root + "/" + "_plugin_fixed_" + plugin.name
|
||||
)
|
||||
out_arg = fixer_dir.path
|
||||
plugin_protoc_outputs = [fixer_dir]
|
||||
|
||||
|
@ -248,20 +230,23 @@ def common_compile(ctx, proto_infos):
|
|||
fixer_paths_file.path,
|
||||
plugin.empty_template.path,
|
||||
fixer_dir.path,
|
||||
output_root,
|
||||
premerge_root,
|
||||
],
|
||||
progress_message = "Applying fixer for {} plugin on target {}".format(plugin.name, ctx.label),
|
||||
progress_message = "Applying fixer for {} plugin on target {}".format(
|
||||
plugin.name, ctx.label
|
||||
),
|
||||
executable = fixer,
|
||||
)
|
||||
|
||||
else:
|
||||
# No fixer, protoc writes files directly
|
||||
if out_file and "QUIRK_OUT_PASS_ROOT" not in plugin.quirks:
|
||||
# Single output file, pass the full file name to out arg, unless QUIRK_OUT_PASS_ROOT quirk is in use
|
||||
# Single output file, pass the full file name to out arg, unless QUIRK_OUT_PASS_ROOT
|
||||
# quirk is in use
|
||||
out_arg = out_file.path
|
||||
else:
|
||||
# No single output (or QUIRK_OUT_PASS_ROOT enabled), pass root dir
|
||||
out_arg = output_root
|
||||
out_arg = premerge_root
|
||||
plugin_protoc_outputs = plugin_outputs
|
||||
|
||||
# Build argument list for protoc execution
|
||||
|
@ -277,10 +262,12 @@ def common_compile(ctx, proto_infos):
|
|||
args.add_all(args_list)
|
||||
|
||||
# Add import roots and files if required by plugin
|
||||
# By default we pass just the descriptors and the proto paths, but these may not contain all of the comments
|
||||
# etc from the source files
|
||||
# By default we pass just the descriptors and the proto paths, but these may not contain
|
||||
# all of the comments etc from the source files
|
||||
if "QUIRK_DIRECT_MODE" in plugin.quirks:
|
||||
args.add_all(["--proto_path=" + proto_info.proto_source_root for proto_info in proto_infos])
|
||||
args.add_all([
|
||||
"--proto_path=" + proto_info.proto_source_root for proto_info in proto_infos
|
||||
])
|
||||
cmd_inputs += protos
|
||||
|
||||
# Add source proto files as descriptor paths
|
||||
|
@ -292,7 +279,7 @@ def common_compile(ctx, proto_infos):
|
|||
###
|
||||
|
||||
mnemonic = "ProtoCompile"
|
||||
command = ("mkdir -p '{}' && ".format(output_root)) + protoc.path + " $@" # $@ is replaced with args list
|
||||
command = ("mkdir -p '{}' && ".format(premerge_root)) + protoc.path + " $@" # $@ is replaced with args list
|
||||
inputs = cmd_inputs
|
||||
tools = [protoc] + ([plugin.tool_executable] if plugin.tool_executable else [])
|
||||
|
||||
|
@ -327,124 +314,73 @@ def common_compile(ctx, proto_infos):
|
|||
outputs = plugin_protoc_outputs,
|
||||
use_default_shell_env = plugin.use_built_in_shell_environment,
|
||||
input_manifests = cmd_input_manifests,
|
||||
progress_message = "Compiling protoc outputs for {} plugin on target {}".format(plugin.name, ctx.label),
|
||||
progress_message = "Compiling protoc outputs for {} plugin on target {}".format(
|
||||
plugin.name, ctx.label
|
||||
),
|
||||
)
|
||||
|
||||
# Bundle output
|
||||
return struct(
|
||||
output_root = output_root,
|
||||
output_files = output_files,
|
||||
output_dirs = output_dirs,
|
||||
)
|
||||
|
||||
def proto_compile_impl(ctx):
|
||||
"""
|
||||
Common implementation function for lang_*_compile rules.
|
||||
|
||||
Args:
|
||||
ctx: The Bazel rule execution context object.
|
||||
|
||||
Returns:
|
||||
Providers:
|
||||
- ProtoCompileInfo
|
||||
- DefaultInfo
|
||||
|
||||
"""
|
||||
|
||||
# Check attrs make sense
|
||||
if ctx.attr.protos and ctx.attr.deps: # TODO(4.0.0): Remove
|
||||
fail("Inputs provided to both 'protos' and 'deps' attrs of target {}. Use exclusively 'protos' or 'deps'".format(ctx.label))
|
||||
|
||||
if ctx.attr.deps and ctx.attr.options: # TODO(4.0.0): Remove
|
||||
fail("Options cannot be provided in transitive compilation mode with 'deps' attr of target {}. Use 'protos' mode to pass 'options'".format(ctx.label))
|
||||
|
||||
if ctx.attr.deps and ctx.attr.extra_protoc_args: # TODO(4.0.0): Remove
|
||||
fail("Extra protoc args cannot be provided in transitive compilation mode with 'deps' attr of target {}. Use 'protos' mode to pass 'extra_protoc_args'".format(ctx.label))
|
||||
|
||||
# Select mode
|
||||
if ctx.attr.protos:
|
||||
# Direct compilation mode, build protoc actions here rather than in aspect
|
||||
compile_out = common_compile(ctx, [dep[ProtoInfo] for dep in ctx.attr.protos])
|
||||
|
||||
# Spoof the outputs we'd get from aspect
|
||||
# TODO(4.0.0): Remove
|
||||
output_files_dicts = [{compile_out.output_root: depset(compile_out.output_files)}]
|
||||
output_dirs = depset(compile_out.output_dirs)
|
||||
|
||||
elif ctx.attr.deps:
|
||||
# Transitive mode using aspect compilation. DEPRECATED
|
||||
# TODO(4.0.0): Remove this section
|
||||
print("Inputs provided to 'deps' attr of target {}. Consider replacing with 'protos' attr to avoid transitive compilation. See https://rules-proto-grpc.aliddell.com/en/latest/transitivity.html".format(ctx.label)) # buildifier: disable=print
|
||||
|
||||
# Aggregate all output files and dirs created by the aspect as it has walked the deps
|
||||
output_files_dicts = [dep[ProtoLibraryAspectNodeInfo].output_files for dep in ctx.attr.deps]
|
||||
output_dirs = depset(transitive = [
|
||||
dep[ProtoLibraryAspectNodeInfo].output_dirs
|
||||
for dep in ctx.attr.deps
|
||||
])
|
||||
|
||||
else:
|
||||
# Mode undetermined
|
||||
fail("No inputs provided to 'protos' attr of target {}".format(ctx.label))
|
||||
|
||||
# Build outputs
|
||||
final_output_files = {}
|
||||
final_output_files_list = []
|
||||
final_output_dirs = depset()
|
||||
# Build final output defaults for merged locations
|
||||
output_root = get_package_root(ctx) + "/" + ctx.label.name
|
||||
output_files = depset()
|
||||
output_dirs = depset()
|
||||
prefix_path = ctx.attr.prefix_path
|
||||
|
||||
# TODO(4.0.0): The below can be simplified and prefix path applied directly to output root
|
||||
if output_dirs:
|
||||
# If we have any output dirs specified, we declare a single output
|
||||
# directory and merge all files in one go. This is necessary to prevent
|
||||
# path prefix conflicts
|
||||
# Merge outputs
|
||||
if premerge_dirs:
|
||||
# If we have any output dirs specified, we declare a single output directory and merge all
|
||||
# files in one go. This is necessary to prevent path prefix conflicts
|
||||
|
||||
# Declare single output directory
|
||||
dir_name = ctx.label.name
|
||||
if prefix_path:
|
||||
dir_name = dir_name + "/" + prefix_path
|
||||
new_dir = ctx.actions.declare_directory(dir_name)
|
||||
final_output_dirs = depset(direct = [new_dir])
|
||||
output_dirs = depset(direct = [new_dir])
|
||||
|
||||
# Build copy command for directory outputs
|
||||
# Use cp {}/. rather than {}/* to allow for empty output directories from a plugin (e.g when no service exists,
|
||||
# so no files generated)
|
||||
# Use cp {}/. rather than {}/* to allow for empty output directories from a plugin (e.g when
|
||||
# no service exists, so no files generated)
|
||||
command_parts = ["mkdir -p {} && cp -r {} '{}'".format(
|
||||
" ".join(["'" + d.path + "'" for d in output_dirs.to_list()]), # We need to be sure that the dirs exist, see: https://github.com/bazelbuild/bazel/issues/6393
|
||||
" ".join(["'" + d.path + "/.'" for d in output_dirs.to_list()]),
|
||||
# We need to be sure that the dirs exist, see:
|
||||
# https://github.com/bazelbuild/bazel/issues/6393
|
||||
" ".join(["'" + d.path + "'" for d in premerge_dirs]),
|
||||
" ".join(["'" + d.path + "/.'" for d in premerge_dirs]),
|
||||
new_dir.path,
|
||||
)]
|
||||
|
||||
# Extend copy command with file outputs
|
||||
command_input_files = []
|
||||
for output_files_dict in output_files_dicts:
|
||||
for root, files in output_files_dict.items():
|
||||
for file in files.to_list():
|
||||
# Strip root from file path
|
||||
path = strip_path_prefix(file.path, root)
|
||||
command_input_files = premerge_dirs
|
||||
for file in premerge_files:
|
||||
# Strip pre-merge root from file path
|
||||
path = strip_path_prefix(file.path, premerge_root)
|
||||
|
||||
# Prefix path is contained in new_dir.path created above and
|
||||
# used below
|
||||
# Prefix path is contained in new_dir.path created above and
|
||||
# used below
|
||||
|
||||
# Add command to copy file to output
|
||||
command_input_files.append(file)
|
||||
command_parts.append("cp '{}' '{}'".format(
|
||||
file.path,
|
||||
"{}/{}".format(new_dir.path, path),
|
||||
))
|
||||
# Add command to copy file to output
|
||||
command_input_files.append(file)
|
||||
command_parts.append("cp '{}' '{}'".format(
|
||||
file.path, "{}/{}".format(new_dir.path, path),
|
||||
))
|
||||
|
||||
# Add debug options
|
||||
if ctx.attr.verbose > 1:
|
||||
command_parts = command_parts + ["echo '\n##### SANDBOX AFTER MERGING DIRECTORIES'", "find . -type l"]
|
||||
command_parts = command_parts + [
|
||||
"echo '\n##### SANDBOX AFTER MERGING DIRECTORIES'", "find . -type l"
|
||||
]
|
||||
if ctx.attr.verbose > 2:
|
||||
command_parts = ["echo '\n##### SANDBOX BEFORE MERGING DIRECTORIES'", "find . -type l"] + command_parts
|
||||
command_parts = [
|
||||
"echo '\n##### SANDBOX BEFORE MERGING DIRECTORIES'", "find . -type l"
|
||||
] + command_parts
|
||||
if ctx.attr.verbose > 0:
|
||||
print("Directory merge command: {}".format(" && ".join(command_parts))) # buildifier: disable=print
|
||||
print(
|
||||
"Directory merge command: {}".format(" && ".join(command_parts))
|
||||
) # buildifier: disable=print
|
||||
|
||||
# Copy directories and files to shared output directory in one action
|
||||
ctx.actions.run_shell(
|
||||
mnemonic = "CopyDirs",
|
||||
inputs = depset(direct = command_input_files, transitive = [output_dirs]),
|
||||
inputs = command_input_files,
|
||||
outputs = [new_dir],
|
||||
command = " && ".join(command_parts),
|
||||
progress_message = "copying directories and files to {}".format(new_dir.path),
|
||||
|
@ -452,84 +388,39 @@ def proto_compile_impl(ctx):
|
|||
|
||||
else:
|
||||
# Otherwise, if we only have output files, build the output tree by
|
||||
# aggregating files created by aspect into one directory
|
||||
# aggregating files into one directory
|
||||
|
||||
output_root = get_package_root(ctx) + "/" + ctx.label.name
|
||||
output_files = []
|
||||
for file in premerge_files:
|
||||
# Strip pre-merge root from file path
|
||||
path = strip_path_prefix(file.path, premerge_root)
|
||||
|
||||
for output_files_dict in output_files_dicts:
|
||||
for root, files in output_files_dict.items():
|
||||
for file in files.to_list():
|
||||
# Strip root from file path
|
||||
path = strip_path_prefix(file.path, root)
|
||||
# Prepend prefix path if given
|
||||
if prefix_path:
|
||||
path = prefix_path + "/" + path
|
||||
|
||||
# Prepend prefix path if given
|
||||
if prefix_path:
|
||||
path = prefix_path + "/" + path
|
||||
# Copy file to output
|
||||
output_files.append(copy_file(
|
||||
ctx,
|
||||
file,
|
||||
"{}/{}".format(ctx.label.name, path),
|
||||
))
|
||||
|
||||
# Copy file to output
|
||||
final_output_files_list.append(copy_file(
|
||||
ctx,
|
||||
file,
|
||||
"{}/{}".format(ctx.label.name, path),
|
||||
))
|
||||
|
||||
final_output_files[output_root] = depset(direct = final_output_files_list)
|
||||
output_files = depset(direct = output_files)
|
||||
|
||||
# Create depset containing all outputs
|
||||
all_outputs = depset(direct = final_output_files_list + final_output_dirs.to_list())
|
||||
all_outputs = depset(direct = output_files.to_list() + output_dirs.to_list())
|
||||
|
||||
# Create default and proto compile providers
|
||||
return [
|
||||
ProtoCompileInfo(
|
||||
label = ctx.label,
|
||||
output_files = final_output_files,
|
||||
output_dirs = final_output_dirs,
|
||||
output_root = output_root,
|
||||
output_files = output_files,
|
||||
output_dirs = output_dirs,
|
||||
),
|
||||
DefaultInfo(
|
||||
files = all_outputs,
|
||||
runfiles = ctx.runfiles(transitive_files = all_outputs),
|
||||
),
|
||||
]
|
||||
|
||||
def proto_compile_aspect_impl(target, ctx):
|
||||
"""
|
||||
Common implementation function for lang_*_compile aspects.
|
||||
|
||||
Args:
|
||||
target: The aspect target.
|
||||
ctx: The Bazel rule execution context object.
|
||||
|
||||
Returns:
|
||||
Providers:
|
||||
- ProtoLibraryAspectNodeInfo
|
||||
|
||||
"""
|
||||
|
||||
# Load ProtoInfo of the current node
|
||||
if ProtoInfo not in target: # Skip non-proto targets, which we may get intermingled prior to deps deprecation
|
||||
return []
|
||||
proto_info = target[ProtoInfo]
|
||||
|
||||
# Build protoc compile actions
|
||||
compile_out = common_compile(ctx, [proto_info])
|
||||
|
||||
# Generate providers
|
||||
transitive_infos = [dep[ProtoLibraryAspectNodeInfo] for dep in ctx.rule.attr.deps]
|
||||
output_files_dict = {}
|
||||
if compile_out.output_files:
|
||||
output_files_dict[compile_out.output_root] = depset(direct = compile_out.output_files)
|
||||
|
||||
transitive_output_dirs = []
|
||||
for transitive_info in transitive_infos:
|
||||
output_files_dict.update(**transitive_info.output_files)
|
||||
transitive_output_dirs.append(transitive_info.output_dirs)
|
||||
|
||||
return [
|
||||
ProtoLibraryAspectNodeInfo(
|
||||
output_root = compile_out.output_root,
|
||||
direct_output_files = depset(direct = compile_out.output_files),
|
||||
direct_output_dirs = depset(direct = compile_out.output_dirs),
|
||||
output_files = output_files_dict,
|
||||
output_dirs = depset(direct = compile_out.output_dirs, transitive = transitive_output_dirs),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -19,18 +19,9 @@ ProtoPluginInfo = provider(fields = {
|
|||
"quirks": "List of plugin quirks that toggle behaviours in compilation",
|
||||
})
|
||||
|
||||
ProtoLibraryAspectNodeInfo = provider(
|
||||
fields = {
|
||||
"output_root": "The root directory that direct (non-transitive) outputs were written to, as a string",
|
||||
"direct_output_files": "The files generated by this aspect only, as a depset",
|
||||
"direct_output_dirs": "The directories generated by this aspect only, as a depset",
|
||||
"output_files": "The files generated by this aspect and its transitive dependencies, as a dict of depsets indexed by the root directory",
|
||||
"output_dirs": "The directories generated by this aspect and its transitive dependencies, as a depset",
|
||||
},
|
||||
)
|
||||
|
||||
ProtoCompileInfo = provider(fields = {
|
||||
"label": "label object",
|
||||
"output_files": "The files generated by this rule, as a dict of depsets indexed by the root directory",
|
||||
"output_dirs": "The directories generated by this rule and its transitive dependencies, as a depset",
|
||||
"output_root": "The roots of the generated files and directories, as a string",
|
||||
"output_files": "The files generated by this rule, as a depset",
|
||||
"output_dirs": "The directories generated by this rule, as a depset",
|
||||
})
|
||||
|
|
|
@ -1,55 +1,17 @@
|
|||
"""Generated definition of java_grpc_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for java_grpc_compile
|
||||
java_grpc_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//java:java_plugin"),
|
||||
Label("//java:grpc_java_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "java_grpc_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
java_grpc_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [java_grpc_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -61,10 +23,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def java_grpc_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,54 +1,17 @@
|
|||
"""Generated definition of java_proto_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for java_proto_compile
|
||||
java_proto_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//java:java_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "java_proto_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
java_proto_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [java_proto_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -59,10 +22,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def java_proto_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,57 +1,17 @@
|
|||
"""Generated definition of js_grpc_node_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for js_grpc_node_compile
|
||||
js_grpc_node_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//js:js_plugin"),
|
||||
Label("//js:ts_plugin"),
|
||||
Label("//js:grpc_node_plugin"),
|
||||
Label("//js:grpc_node_ts_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "js_grpc_node_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
js_grpc_node_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [js_grpc_node_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -65,10 +25,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def js_grpc_node_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,56 +1,17 @@
|
|||
"""Generated definition of js_grpc_web_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for js_grpc_web_compile
|
||||
js_grpc_web_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//js:js_plugin"),
|
||||
Label("//js:ts_plugin"),
|
||||
Label("//js:grpc_web_js_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "js_grpc_web_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
js_grpc_web_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [js_grpc_web_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -63,10 +24,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def js_grpc_web_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,55 +1,17 @@
|
|||
"""Generated definition of js_proto_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for js_proto_compile
|
||||
js_proto_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//js:js_plugin"),
|
||||
Label("//js:ts_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "js_proto_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
js_proto_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [js_proto_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -61,10 +23,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def js_proto_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,55 +1,17 @@
|
|||
"""Generated definition of objc_grpc_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for objc_grpc_compile
|
||||
objc_grpc_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//objc:objc_plugin"),
|
||||
Label("//objc:grpc_objc_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "objc_grpc_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
objc_grpc_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [objc_grpc_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -61,10 +23,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def objc_grpc_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,54 +1,17 @@
|
|||
"""Generated definition of objc_proto_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for objc_proto_compile
|
||||
objc_proto_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//objc:objc_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "objc_proto_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
objc_proto_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [objc_proto_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -59,10 +22,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def objc_proto_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,55 +1,17 @@
|
|||
"""Generated definition of php_grpc_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for php_grpc_compile
|
||||
php_grpc_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//php:php_plugin"),
|
||||
Label("//php:grpc_php_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "php_grpc_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
php_grpc_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [php_grpc_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -61,10 +23,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def php_grpc_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,54 +1,17 @@
|
|||
"""Generated definition of php_proto_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for php_proto_compile
|
||||
php_proto_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//php:php_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "php_proto_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
php_proto_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [php_proto_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -59,10 +22,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def php_proto_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,55 +1,17 @@
|
|||
"""Generated definition of python_grpc_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for python_grpc_compile
|
||||
python_grpc_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//python:python_plugin"),
|
||||
Label("//python:grpc_python_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "python_grpc_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
python_grpc_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [python_grpc_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -61,10 +23,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def python_grpc_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,55 +1,17 @@
|
|||
"""Generated definition of python_grpclib_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for python_grpclib_compile
|
||||
python_grpclib_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//python:python_plugin"),
|
||||
Label("//python:grpclib_python_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "python_grpclib_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
python_grpclib_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [python_grpclib_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -61,10 +23,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def python_grpclib_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,54 +1,17 @@
|
|||
"""Generated definition of python_proto_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for python_proto_compile
|
||||
python_proto_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//python:python_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "python_proto_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
python_proto_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [python_proto_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -59,10 +22,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def python_proto_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,55 +1,17 @@
|
|||
"""Generated definition of ruby_grpc_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for ruby_grpc_compile
|
||||
ruby_grpc_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//ruby:ruby_plugin"),
|
||||
Label("//ruby:grpc_ruby_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "ruby_grpc_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
ruby_grpc_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [ruby_grpc_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -61,10 +23,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def ruby_grpc_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,54 +1,17 @@
|
|||
"""Generated definition of ruby_proto_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for ruby_proto_compile
|
||||
ruby_proto_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//ruby:ruby_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "ruby_proto_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
ruby_proto_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [ruby_proto_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -59,10 +22,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def ruby_proto_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,55 +1,17 @@
|
|||
"""Generated definition of rust_grpc_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for rust_grpc_compile
|
||||
rust_grpc_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//rust:rust_plugin"),
|
||||
Label("//rust:grpc_rust_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "rust_grpc_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
rust_grpc_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [rust_grpc_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -61,10 +23,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def rust_grpc_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,54 +1,17 @@
|
|||
"""Generated definition of rust_proto_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for rust_proto_compile
|
||||
rust_proto_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//rust:rust_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "rust_proto_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
rust_proto_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [rust_proto_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -59,10 +22,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def rust_proto_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,54 +1,17 @@
|
|||
"""Generated definition of scala_grpc_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for scala_grpc_compile
|
||||
scala_grpc_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//scala:grpc_scala_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "scala_grpc_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
scala_grpc_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [scala_grpc_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -59,10 +22,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def scala_grpc_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,54 +1,17 @@
|
|||
"""Generated definition of scala_proto_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for scala_proto_compile
|
||||
scala_proto_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//scala:scala_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "scala_proto_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
scala_proto_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [scala_proto_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -59,10 +22,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def scala_proto_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,55 +1,17 @@
|
|||
"""Generated definition of swift_grpc_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for swift_grpc_compile
|
||||
swift_grpc_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//swift:swift_plugin"),
|
||||
Label("//swift:grpc_swift_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "swift_grpc_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
swift_grpc_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [swift_grpc_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -61,10 +23,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def swift_grpc_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,54 +1,17 @@
|
|||
"""Generated definition of swift_proto_compile."""
|
||||
|
||||
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for swift_proto_compile
|
||||
swift_proto_compile_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
Label("//swift:swift_plugin"),
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "swift_proto_compile_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
swift_proto_compile = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [swift_proto_compile_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [
|
||||
|
@ -59,10 +22,3 @@ _rule = rule(
|
|||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def swift_proto_compile(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
load("@rules_proto//proto:defs.bzl", "proto_library")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_test")
|
||||
load("@rules_proto_grpc//cpp:defs.bzl", "cpp_grpc_library")
|
||||
|
||||
package(default_visibility = ["//visibility:private"])
|
||||
|
||||
# Test that old style transitive compilation works
|
||||
|
||||
proto_library(
|
||||
name = "proto_lib",
|
||||
srcs = ["demo.proto"],
|
||||
)
|
||||
|
||||
cpp_grpc_library(
|
||||
name = "cpp_lib",
|
||||
deps = ["proto_lib"],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "test",
|
||||
srcs = ["main.cc"],
|
||||
deps = ["cpp_lib"],
|
||||
)
|
|
@ -1,24 +0,0 @@
|
|||
local_repository(
|
||||
name = "rules_proto_grpc",
|
||||
path = "../../",
|
||||
)
|
||||
|
||||
load("@rules_proto_grpc//:repositories.bzl", "rules_proto_grpc_repos", "rules_proto_grpc_toolchains")
|
||||
|
||||
rules_proto_grpc_toolchains()
|
||||
|
||||
rules_proto_grpc_repos()
|
||||
|
||||
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
|
||||
|
||||
rules_proto_dependencies()
|
||||
|
||||
rules_proto_toolchains()
|
||||
|
||||
load("@rules_proto_grpc//python:repositories.bzl", "python_repos")
|
||||
|
||||
python_repos()
|
||||
|
||||
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
|
||||
|
||||
grpc_deps()
|
|
@ -1,5 +0,0 @@
|
|||
syntax = "proto3";
|
||||
|
||||
message demo {
|
||||
bool field = 1;
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
#include "demo.pb.h"
|
||||
|
||||
int main () {
|
||||
return demo().ByteSizeLong();
|
||||
}
|
|
@ -54,55 +54,18 @@ var libraryRuleAttrs = append(append([]*Attr(nil), compileRuleAttrs...), []*Attr
|
|||
}...)
|
||||
|
||||
|
||||
var compileRuleTemplate = mustTemplate(`load("@rules_proto//proto:defs.bzl", "ProtoInfo")
|
||||
load(
|
||||
var compileRuleTemplate = mustTemplate(`load(
|
||||
"//:defs.bzl",
|
||||
"ProtoLibraryAspectNodeInfo",
|
||||
"ProtoPluginInfo",
|
||||
"proto_compile_aspect_attrs",
|
||||
"proto_compile_aspect_impl",
|
||||
"proto_compile_attrs",
|
||||
"proto_compile_impl",
|
||||
)
|
||||
|
||||
# Create aspect for {{ .Rule.Name }}
|
||||
{{ .Rule.Name }}_aspect = aspect(
|
||||
implementation = proto_compile_aspect_impl,
|
||||
provides = [ProtoLibraryAspectNodeInfo],
|
||||
attr_aspects = ["deps"],
|
||||
attrs = dict(
|
||||
proto_compile_aspect_attrs,
|
||||
_plugins = attr.label_list(
|
||||
doc = "List of protoc plugins to apply",
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [{{ range .Rule.Plugins }}
|
||||
Label("{{ . }}"),{{ end }}
|
||||
],
|
||||
),
|
||||
_prefix = attr.string(
|
||||
doc = "String used to disambiguate aspects when generating outputs",
|
||||
default = "{{ .Rule.Name }}_aspect",
|
||||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create compile rule
|
||||
_rule = rule(
|
||||
{{ .Rule.Name }} = rule(
|
||||
implementation = proto_compile_impl,
|
||||
attrs = dict(
|
||||
proto_compile_attrs,
|
||||
protos = attr.label_list(
|
||||
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
|
||||
providers = [ProtoInfo],
|
||||
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
|
||||
),
|
||||
deps = attr.label_list(
|
||||
mandatory = False,
|
||||
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
|
||||
aspects = [{{ .Rule.Name }}_aspect],
|
||||
doc = "DEPRECATED: Use protos attr",
|
||||
),
|
||||
_plugins = attr.label_list(
|
||||
providers = [ProtoPluginInfo],
|
||||
default = [{{ range .Rule.Plugins }}
|
||||
|
@ -112,14 +75,7 @@ _rule = rule(
|
|||
),
|
||||
),
|
||||
toolchains = [str(Label("//protobuf:toolchain_type"))],
|
||||
)
|
||||
|
||||
# Create macro for converting attrs and passing to compile
|
||||
def {{ .Rule.Name }}(**kwargs):
|
||||
_rule(
|
||||
verbose_string = "{}".format(kwargs.get("verbose", 0)),
|
||||
**kwargs
|
||||
)`)
|
||||
)`)
|
||||
|
||||
// When editing, note that Go and gateway do not use this snippet and have their own local version
|
||||
var argsForwardingSnippet = `**{
|
||||
|
|
Loading…
Reference in New Issue