From 6f3a00c1a337a165f6b745e2ef0e8a6ea3d302d2 Mon Sep 17 00:00:00 2001 From: Laurent Le Brun Date: Mon, 25 Feb 2019 18:33:33 +0100 Subject: [PATCH] Fix for future Bazel changes This fixes issues found by running Bazel with `--incompatible_no_support_tools_in_action_inputs` and `--incompatible_new_actions_api`. --- bazel/generate_cc.bzl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bazel/generate_cc.bzl b/bazel/generate_cc.bzl index 2f14071f92d..8f30c84f6b9 100644 --- a/bazel/generate_cc.bzl +++ b/bazel/generate_cc.bzl @@ -28,7 +28,7 @@ def generate_cc_impl(ctx): else: outs += [proto.path[label_len:-len(".proto")] + ".pb.h" for proto in protos] outs += [proto.path[label_len:-len(".proto")] + ".pb.cc" for proto in protos] - out_files = [ctx.new_file(out) for out in outs] + out_files = [ctx.actions.declare_file(out) for out in outs] dir_out = str(ctx.genfiles_dir.path + proto_root) arguments = [] @@ -38,10 +38,10 @@ def generate_cc_impl(ctx): if ctx.attr.generate_mocks: flags.append("generate_mock_code=true") arguments += ["--PLUGIN_out=" + ",".join(flags) + ":" + dir_out] - additional_input = [ctx.executable.plugin] + tools = [ctx.executable.plugin] else: arguments += ["--cpp_out=" + ",".join(ctx.attr.flags) + ":" + dir_out] - additional_input = [] + tools = [] # Import protos relative to their workspace root so that protoc prints the # right include paths. @@ -70,8 +70,9 @@ def generate_cc_impl(ctx): arguments += ["-I{0}".format(f + "/../..")] well_known_proto_files = [f for f in ctx.attr.well_known_protos.files] - ctx.action( - inputs = protos + includes + additional_input + well_known_proto_files, + ctx.actions.run( + inputs = protos + includes + well_known_proto_files, + tools = tools, outputs = out_files, executable = ctx.executable._protoc, arguments = arguments,