Use newer Bazel actions API

Also pass in the binary correctly as a tool. This is required for #5383.

I have tested the build with older Bazel versions and this doesn't
appear to affect compatibility, ie grpc-java continues to be compatible
with Bazel >=0.19.
This commit is contained in:
Rodrigo Queiro 2019-02-28 12:08:11 +01:00 committed by Eric Anderson
parent 05d5e4802a
commit 054def3c63
1 changed files with 5 additions and 4 deletions

View File

@ -26,9 +26,10 @@ def _java_rpc_library_impl(ctx):
args.add_all(includes, map_each = _create_include_path) args.add_all(includes, map_each = _create_include_path)
args.add_all(srcs, map_each = _path_ignoring_repository) args.add_all(srcs, map_each = _path_ignoring_repository)
ctx.action( ctx.actions.run(
inputs = depset([ctx.executable._java_plugin] + srcs, transitive = [includes]), inputs = depset(srcs, transitive = [includes]),
outputs = [ctx.outputs.srcjar], outputs = [ctx.outputs.srcjar],
tools = [ctx.executable._java_plugin],
executable = ctx.executable._protoc, executable = ctx.executable._protoc,
arguments = [args], arguments = [args],
) )
@ -52,12 +53,12 @@ _java_rpc_library = rule(
attrs = { attrs = {
"srcs": attr.label_list( "srcs": attr.label_list(
mandatory = True, mandatory = True,
non_empty = True, allow_empty = False,
providers = ["proto"], providers = ["proto"],
), ),
"deps": attr.label_list( "deps": attr.label_list(
mandatory = True, mandatory = True,
non_empty = True, allow_empty = False,
providers = [JavaInfo], providers = [JavaInfo],
), ),
"flavor": attr.string( "flavor": attr.string(