Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for bazel incompatible changes #198

Merged
merged 1 commit into from
May 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')

http_archive(
name = "io_bazel_rules_go",
urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.18.3/rules_go-0.18.3.tar.gz"],
sha256 = "86ae934bd4c43b99893fc64be9d9fc684b81461581df7ea8fc291c816f5ee8c5",
urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.18.5/rules_go-0.18.5.tar.gz"],
sha256 = "a82a352bffae6bee4e95f68a8d80a70e87f42c4741e6a448bec11998fcc82329",
)
http_archive(
name = "bazel_gazelle",
Expand Down
17 changes: 9 additions & 8 deletions bazel/protobuf.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def _protoc_cc_output_files(proto_file_sources):
def _proto_sources(ctx):
protos = []
for dep in ctx.attr.deps:
protos += [f for f in dep.proto.direct_sources]
protos += [f for f in dep[ProtoInfo].direct_sources]

return protos

Expand Down Expand Up @@ -76,8 +76,8 @@ def _protoc_gen_validate_impl(ctx, lang, protos, out_files, protoc_args, package
if ctx.label.workspace_root:
dir_out += "/" + ctx.label.workspace_root

tds = depset([], transitive = [dep.proto.transitive_descriptor_sets for dep in ctx.attr.deps])
descriptor_args = [ds.path for ds in tds]
tds = depset([], transitive = [dep[ProtoInfo].transitive_descriptor_sets for dep in ctx.attr.deps])
descriptor_args = [ds.path for ds in tds.to_list()]

if len(descriptor_args) != 0:
protoc_args += ["--descriptor_set_in=%s" % ctx.configuration.host_path_separator.join(descriptor_args)]
Expand Down Expand Up @@ -105,13 +105,13 @@ cc_proto_gen_validate = rule(
attrs = {
"deps": attr.label_list(
mandatory = True,
providers = ["proto"],
providers = [ProtoInfo],
),
"_protoc": attr.label(
cfg = "host",
default = Label("@com_google_protobuf//:protoc"),
executable = True,
single_file = True,
allow_single_file = True,
),
"_plugin": attr.label(
cfg = "host",
Expand Down Expand Up @@ -147,10 +147,11 @@ def _java_proto_gen_validate_aspect_impl(target, ctx):
args.add_all(srcs, map_each = _proto_path)

ctx.actions.run(
inputs = depset([ctx.executable._plugin], transitive = [proto_info.transitive_imports]),
inputs = depset(transitive = [proto_info.transitive_imports]),
outputs = [srcjar],
executable = ctx.executable._protoc,
arguments = [args],
tools = [ctx.executable._plugin],
progress_message = "Generating %s" % srcjar.path,
)

Expand All @@ -170,7 +171,7 @@ _java_proto_gen_validate_aspect = aspect(
cfg = "host",
default = Label("@com_google_protobuf//:protoc"),
executable = True,
single_file = True,
allow_single_file = True,
),
"_plugin": attr.label(
cfg = "host",
Expand All @@ -182,7 +183,7 @@ _java_proto_gen_validate_aspect = aspect(
)

def _java_proto_gen_validate_impl(ctx):
source_jars = [source_jar for dep in ctx.attr.deps for source_jar in dep[_ProtoValidateSourceInfo].sources]
source_jars = [source_jar for dep in ctx.attr.deps for source_jar in dep[_ProtoValidateSourceInfo].sources.to_list()]

deps = [java_common.make_non_strict(dep[JavaInfo]) for dep in ctx.attr.java_deps]
deps += [dep[JavaInfo] for dep in ctx.attr._validate_deps]
Expand Down