Treat plugins as host tools.

As a followup to ca3ead7745, treat plugin executables as well as protoc as host tools.
pull/6265/head
Benjamin Peterson 6 years ago committed by Adam Cozzette
parent ce0dca83ab
commit 310ba5ee72
  1. 6
      protobuf.bzl

@ -117,6 +117,7 @@ def _proto_gen_impl(ctx):
outs = [ctx.actions.declare_file(out, sibling = src) for out in outs] outs = [ctx.actions.declare_file(out, sibling = src) for out in outs]
inputs = [src] + deps inputs = [src] + deps
tools = [ctx.executable.protoc]
if ctx.executable.plugin: if ctx.executable.plugin:
plugin = ctx.executable.plugin plugin = ctx.executable.plugin
lang = ctx.attr.plugin_language lang = ctx.attr.plugin_language
@ -131,11 +132,12 @@ def _proto_gen_impl(ctx):
outdir = ",".join(ctx.attr.plugin_options) + ":" + outdir outdir = ",".join(ctx.attr.plugin_options) + ":" + outdir
args += [("--plugin=protoc-gen-%s=" + path_tpl) % (lang, plugin.path)] args += [("--plugin=protoc-gen-%s=" + path_tpl) % (lang, plugin.path)]
args += ["--%s_out=%s" % (lang, outdir)] args += ["--%s_out=%s" % (lang, outdir)]
inputs += [plugin] tools.append(plugin)
if not in_gen_dir: if not in_gen_dir:
ctx.actions.run( ctx.actions.run(
inputs = inputs, inputs = inputs,
tools = tools,
outputs = outs, outputs = outs,
arguments = args + import_flags + [src.path], arguments = args + import_flags + [src.path],
executable = ctx.executable.protoc, executable = ctx.executable.protoc,
@ -162,7 +164,7 @@ def _proto_gen_impl(ctx):
outputs = [out], outputs = [out],
command = command, command = command,
mnemonic = "ProtoCompile", mnemonic = "ProtoCompile",
tools = [ctx.executable.protoc], tools = tools,
use_default_shell_env = True, use_default_shell_env = True,
) )

Loading…
Cancel
Save