|
| 1 | +diff --git a/lib/private/run_binary.bzl b/lib/private/run_binary.bzl |
| 2 | +index 7ce4038..65c2f15 100644 |
| 3 | +--- a/lib/private/run_binary.bzl |
| 4 | ++++ b/lib/private/run_binary.bzl |
| 5 | +@@ -51,12 +51,12 @@ Possible fixes: |
| 6 | + # Location and Make variable expansion can reference paths that aren't path mapped. |
| 7 | + can_path_map = True |
| 8 | + for a in ctx.attr.args: |
| 9 | +- expanded = expand_variables(ctx, ctx.expand_location(a, targets = ctx.attr.srcs), inputs = ctx.files.srcs, outs = outputs) |
| 10 | ++ expanded = expand_variables(ctx, ctx.expand_location(a, targets = ctx.attr.tools + ctx.attr.srcs), inputs = ctx.files.tools + ctx.files.srcs, outs = outputs) |
| 11 | + can_path_map = can_path_map and expanded == a |
| 12 | + args.add_all(split_args(expanded)) |
| 13 | + envs = {} |
| 14 | + for k, v in ctx.attr.env.items(): |
| 15 | +- envs[k] = expand_variables(ctx, ctx.expand_location(v, targets = ctx.attr.srcs), inputs = ctx.files.srcs, outs = outputs, attribute_name = "env") |
| 16 | ++ envs[k] = expand_variables(ctx, ctx.expand_location(v, targets = ctx.attr.tools + ctx.attr.srcs), inputs = ctx.files.tools + ctx.files.srcs, outs = outputs, attribute_name = "env") |
| 17 | + can_path_map = can_path_map and envs[k] == v |
| 18 | + |
| 19 | + stamp = maybe_stamp(ctx) |
| 20 | +@@ -72,6 +72,7 @@ Possible fixes: |
| 21 | + outputs = outputs, |
| 22 | + inputs = inputs, |
| 23 | + executable = ctx.executable.tool, |
| 24 | ++ tools = ctx.files.tools, |
| 25 | + arguments = [args], |
| 26 | + resource_set = resource_set(ctx.attr), |
| 27 | + mnemonic = ctx.attr.mnemonic if ctx.attr.mnemonic else None, |
| 28 | +@@ -95,6 +96,10 @@ _run_binary = rule( |
| 29 | + mandatory = True, |
| 30 | + cfg = "exec", |
| 31 | + ), |
| 32 | ++ "tools": attr.label_list( |
| 33 | ++ allow_files = True, |
| 34 | ++ cfg = "exec", |
| 35 | ++ ), |
| 36 | + "env": attr.string_dict(), |
| 37 | + "srcs": attr.label_list( |
| 38 | + allow_files = True, |
| 39 | +@@ -122,6 +127,7 @@ def run_binary( |
| 40 | + execution_requirements = None, |
| 41 | + use_default_shell_env = False, |
| 42 | + stamp = 0, |
| 43 | ++ tools = [], |
| 44 | + **kwargs): |
| 45 | + """Runs a binary as a build action. |
| 46 | + |
| 47 | +@@ -215,12 +221,19 @@ def run_binary( |
| 48 | + |
| 49 | + These files can be read and parsed by the action, for example to pass some values to a linker. |
| 50 | + |
| 51 | ++ tools: A list of tool dependencies for this action. |
| 52 | ++ |
| 53 | ++ These are treated similarly to srcs, except that they are built in |
| 54 | ++ the exec configuration. Any code that will be executed as part of |
| 55 | ++ the action should generally be listed here instead of in srcs. |
| 56 | ++ |
| 57 | + **kwargs: Additional arguments |
| 58 | + """ |
| 59 | + _run_binary( |
| 60 | + name = name, |
| 61 | + tool = tool, |
| 62 | + srcs = srcs, |
| 63 | ++ tools = tools, |
| 64 | + args = args, |
| 65 | + env = env, |
| 66 | + outs = outs, |
0 commit comments