This is an automated email from the ASF dual-hosted git repository. nicknezis pushed a commit to branch nicknezis/bazel-2 in repository https://gitbox.apache.org/repos/asf/incubator-heron.git
commit 1fca5f263561061825a59a8715e0a71afdc770dd Author: Nicholas Nezis <[email protected]> AuthorDate: Thu Feb 6 02:08:04 2020 -0500 Minor deprecation syntax cleanup --- tools/rules/newgenproto.bzl | 28 ++++++++++++++-------------- tools/rules/proto.bzl | 14 +++++++------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tools/rules/newgenproto.bzl b/tools/rules/newgenproto.bzl index 6fd3cae..e21387b 100644 --- a/tools/rules/newgenproto.bzl +++ b/tools/rules/newgenproto.bzl @@ -33,7 +33,7 @@ def _genproto_impl(ctx): if ctx.attr.gen_java: if ctx.outputs.java_src.path.endswith(".srcjar"): - srcjar = ctx.new_file(ctx.outputs.java_src.basename[:-6] + "jar") + srcjar = ctx.actions.declare_file(ctx.outputs.java_src.basename[:-6] + "jar") else: srcjar = ctx.outputs.java_src outputs += [srcjar] @@ -43,7 +43,7 @@ def _genproto_impl(ctx): outputs += [ctx.outputs.py_src] arguments += ["--python_out=" + ctx.configuration.genfiles_dir.path] - ctx.action( + ctx.actions.run( mnemonic = "GenProto", inputs = inputs, outputs = outputs, @@ -53,7 +53,7 @@ def _genproto_impl(ctx): # This is required because protoc only understands .jar extensions, but Bazel # requires source JAR files end in .srcjar. if ctx.attr.gen_java and srcjar != ctx.outputs.java_src: - ctx.action( + ctx.actions.run( mnemonic = "FixProtoSrcJar", inputs = [srcjar], outputs = [ctx.outputs.java_src], @@ -70,7 +70,7 @@ def _genproto_impl(ctx): _genproto_attrs = { "src": attr.label( allow_files = FileType([".proto"]), - single_file = True, + allow_single_file = True, ), "deps": attr.label_list( allow_files = False, @@ -88,18 +88,18 @@ _genproto_attrs = { def _genproto_outputs(attrs): outputs = {} if attrs.gen_cc: - outputs += { - "cc_hdr": "%{src}.pb.h", - "cc_src": "%{src}.pb.cc" - } + outputs += dict( + "cc_hdr"= "%{src}.pb.h", + "cc_src"= "%{src}.pb.cc" + ) if attrs.gen_java: - outputs += { - "java_src": "%{src}.srcjar", - } + outputs += dict( + "java_src"= "%{src}.srcjar", + ) if attrs.gen_py: - outputs += { - "py_src": "%{src}_pb2.py" - } + outputs += dict( + "py_src"= "%{src}_pb2.py" + ) return outputs genproto = rule( diff --git a/tools/rules/proto.bzl b/tools/rules/proto.bzl index 0aae26c..4674d40 100644 --- a/tools/rules/proto.bzl +++ b/tools/rules/proto.bzl @@ -23,7 +23,7 @@ def proto_package_impl(ctx): genproto_base_attrs = { "src": attr.label( allow_files = FileType([".proto"]), - single_file = True, + allow_single_file = True, ), "deps": attr.label_list( allow_files = False, @@ -40,7 +40,7 @@ def genproto_java_impl(ctx): src = ctx.file.src protoc = ctx.file._protoc - srcjar = ctx.new_file(ctx.configuration.genfiles_dir, ctx.label.name + ".srcjar") + srcjar = ctx.actions.declare_file(ctx.configuration.genfiles_dir, ctx.label.name + ".srcjar") java_srcs = srcjar.path + ".srcs" inputs = [src, protoc] @@ -52,7 +52,7 @@ def genproto_java_impl(ctx): "jar cMf " + srcjar.path + " -C " + java_srcs + " .", "rm -rf " + java_srcs, ]) - ctx.action( + ctx.actions.run( inputs = inputs, outputs = [srcjar], mnemonic = 'ProtocJava', @@ -63,13 +63,13 @@ def genproto_java_impl(ctx): genproto_java = rule( genproto_java_impl, - attrs = genproto_base_attrs + { - "_protoc": attr.label( + attrs = dict(genproto_base_attrs, + "_protoc" = attr.label( default = Label("//third_party/protobuf:protoc"), allow_files = True, single_file = True, - ), - }, + ) + ) ) def proto_library(name, src=None, includes=[], deps=[], visibility=None,
