Skip to content

Commit

Permalink
Use ProtoInfo instead of legacy .proto attr (#211)
Browse files Browse the repository at this point in the history
* Use ProtoInfo instead of legacy .proto attr

bazelbuild/bazel#7152
  • Loading branch information
mfarrugi committed Apr 1, 2019
1 parent 851f70f commit e6aea30
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions proto/proto.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ def _compute_proto_source_path(file, source_root_attr):
return path

def _rust_proto_aspect_impl(target, ctx):
if not hasattr(target, "proto"):
if ProtoInfo not in target:
return None
source_root = ctx.rule.attr.proto_source_root
if source_root and source_root[-1] != "/":
source_root += "/"

sources = [
_compute_proto_source_path(f, source_root)
for f in target.proto.direct_sources
for f in target[ProtoInfo].direct_sources
]
transitive_sources = [
f[RustProtoProvider].transitive_proto_sources
Expand Down Expand Up @@ -195,7 +195,7 @@ rust_proto_library = rule(
One crate for each proto_library will be created with the corresponding stubs.
""",
mandatory = True,
providers = ["proto"],
providers = [ProtoInfo],
aspects = [_rust_proto_aspect],
),
"rust_deps": attr.label_list(
Expand Down

0 comments on commit e6aea30

Please sign in to comment.