Migrate from dep.proto to dep[ProtoInfo]

pull/19420/head
Marcel Hlopko 6 years ago
parent a6a6175ff1
commit 49f0fb9035
  1. 2
      WORKSPACE
  2. 4
      bazel/generate_cc.bzl
  3. 4
      bazel/python_rules.bzl

@ -20,7 +20,7 @@ register_toolchains(
git_repository( git_repository(
name = "io_bazel_rules_python", name = "io_bazel_rules_python",
commit = "8b5d0683a7d878b28fffe464779c8a53659fc645", commit = "fdbb17a4118a1728d19e638a5291b4c4266ea5b8",
remote = "https://github.com/bazelbuild/rules_python.git", remote = "https://github.com/bazelbuild/rules_python.git",
) )

@ -41,11 +41,11 @@ def _join_directories(directories):
def generate_cc_impl(ctx): def generate_cc_impl(ctx):
"""Implementation of the generate_cc rule.""" """Implementation of the generate_cc rule."""
protos = [f for src in ctx.attr.srcs for f in src.proto.check_deps_sources.to_list()] protos = [f for src in ctx.attr.srcs for f in src[ProtoInfo].check_deps_sources.to_list()]
includes = [ includes = [
f f
for src in ctx.attr.srcs for src in ctx.attr.srcs
for f in src.proto.transitive_imports.to_list() for f in src[ProtoInfo].transitive_imports.to_list()
] ]
outs = [] outs = []
proto_root = get_proto_root( proto_root = get_proto_root(

@ -28,12 +28,12 @@ def _get_staged_proto_file(context, source_file):
def _generate_py_impl(context): def _generate_py_impl(context):
protos = [] protos = []
for src in context.attr.deps: for src in context.attr.deps:
for file in src.proto.direct_sources: for file in src[ProtoInfo].direct_sources:
protos.append(_get_staged_proto_file(context, file)) protos.append(_get_staged_proto_file(context, file))
includes = [ includes = [
file file
for src in context.attr.deps for src in context.attr.deps
for file in src.proto.transitive_imports.to_list() for file in src[ProtoInfo].transitive_imports.to_list()
] ]
proto_root = get_proto_root(context.label.workspace_root) proto_root = get_proto_root(context.label.workspace_root)
format_str = (_GENERATED_GRPC_PROTO_FORMAT if context.executable.plugin else _GENERATED_PROTO_FORMAT) format_str = (_GENERATED_GRPC_PROTO_FORMAT if context.executable.plugin else _GENERATED_PROTO_FORMAT)

Loading…
Cancel
Save