Skip to content

Commit

Permalink
Drop transitive aspect-based compilation. Closes rules-proto-grpc#137
Browse files Browse the repository at this point in the history
  • Loading branch information
aaliddell committed Sep 17, 2021
1 parent 5ad1786 commit 8d09a4d
Show file tree
Hide file tree
Showing 47 changed files with 194 additions and 2,127 deletions.
47 changes: 1 addition & 46 deletions android/android_grpc_compile.bzl
Original file line number Diff line number Diff line change
@@ -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 = [
Expand All @@ -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
)
46 changes: 1 addition & 45 deletions android/android_proto_compile.bzl
Original file line number Diff line number Diff line change
@@ -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 = [
Expand All @@ -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
)
46 changes: 1 addition & 45 deletions c/c_proto_compile.bzl
Original file line number Diff line number Diff line change
@@ -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 = [
Expand All @@ -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
)
47 changes: 1 addition & 46 deletions cpp/cpp_grpc_compile.bzl
Original file line number Diff line number Diff line change
@@ -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 = [
Expand All @@ -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
)
46 changes: 1 addition & 45 deletions cpp/cpp_proto_compile.bzl
Original file line number Diff line number Diff line change
@@ -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 = [
Expand All @@ -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
)
Loading

0 comments on commit 8d09a4d

Please sign in to comment.