diff --git a/third_party/rules_protobuf/protobuf/internal/proto_compile.bzl b/third_party/rules_protobuf/protobuf/internal/proto_compile.bzl index 975667a36b4362838b75946506a79de8e9573678..4ffd755873c8555f162c56f8a98786479e7ea7df 100644 --- a/third_party/rules_protobuf/protobuf/internal/proto_compile.bzl +++ b/third_party/rules_protobuf/protobuf/internal/proto_compile.bzl @@ -20,10 +20,10 @@ def _emit_params_file_action(ctx, path, mnemonic, cmds): """ filename = "%s.%sFile.params" % (path, mnemonic) f = ctx.new_file(ctx.configuration.bin_dir, filename) - ctx.file_action( + ctx.actions.write( output = f, content = "\n".join(["set -e"] + cmds), - executable = True, + is_executable = True, ) return f @@ -100,7 +100,7 @@ def _build_output_jar(run, builder): ctx = run.ctx execdir = run.data.execdir name = run.lang.name - protojar = ctx.new_file("%s_%s.jar" % (run.data.label.name, name)) + protojar = ctx.actions.declare_file("%s_%s.jar" % (run.data.label.name, name)) builder["outputs"] += [protojar] builder[name + "_jar"] = protojar builder[name + "_outdir"] = _get_offset_path(execdir, protojar.path) @@ -110,7 +110,7 @@ def _build_output_library(run, builder): ctx = run.ctx execdir = run.data.execdir name = run.lang.name - jslib = ctx.new_file(run.data.label.name + run.lang.pb_file_extensions[0]) + jslib = ctx.actions.declare_file(run.data.label.name + run.lang.pb_file_extensions[0]) builder["jslib"] = [jslib] builder["outputs"] += [jslib] @@ -124,7 +124,7 @@ def _build_output_srcjar(run, builder): name = run.lang.name protojar = builder[name + "_jar"] srcjar_name = "%s_%s.srcjar" % (run.data.label.name, name) - srcjar = ctx.new_file("%s_%s.srcjar" % (run.data.label.name, name)) + srcjar = ctx.actions.declare_file("%s_%s.srcjar" % (run.data.label.name, name)) run.ctx.action( mnemonic = "CpJarToSrcJar", inputs = [protojar], @@ -159,7 +159,7 @@ def _build_output_files(run, builder): for ext in exts: path = _get_relative_dirname(ctx.label.package, file) path.append(base + ext) - pbfile = ctx.new_file("/".join(path)) + pbfile = ctx.actions.declare_file("/".join(path)) builder["outputs"] += [pbfile] def _build_output_libdir(run, builder): @@ -363,7 +363,7 @@ cd $(bazel info execution_root)%s && \ for i in range(len(outputs)): print(" > output%s: %s" % (i, outputs[i])) - ctx.action( + ctx.actions.run_shell( mnemonic = "ProtoCompile", command = " && ".join(cmds), inputs = inputs, diff --git a/tools/common.bzl b/tools/common.bzl index 0d1dfd7fe34eb80ad67cd7b537e9e4fc1ee759fc..a83f768b62848c42affb74fe6a6cde1dece31045 100644 --- a/tools/common.bzl +++ b/tools/common.bzl @@ -47,8 +47,7 @@ template_rule = rule( attrs = { "src": attr.label( mandatory = True, - allow_files = True, - single_file = True, + allow_single_file = True, ), "substitutions": attr.string_dict(mandatory = True), "out": attr.output(mandatory = True),