diff options
author | 2017-02-01 00:04:40 +0000 | |
---|---|---|
committer | 2017-02-01 08:56:45 +0000 | |
commit | fa97703c1edf7a88cadefd6fbaafcfeb74d2f136 (patch) | |
tree | 513a9a7f513a85eab0e58cb1a24ddac32e16d679 /src/main/java/com/google/devtools/build | |
parent | bfd3ec5bdcbec16f1f055b3b5196c01fa7dc6fc2 (diff) |
allow skylark implicit output callbacks to use the rule name
Skylark implicit output callbacks could use any nonconfigurable
attribute of the rule except for "name". (As an implementation detail,
"name" is easy to overlook because it's a special case in rule
attribute map.) In practice, this isn't too much of a problem because
the return value of a skylark implicit output callback has %{}
substitutions applied to it, which do allow the rule name. However, it
is weird and inconsistent to prevent implicit output callbacks from
using the name.
--
Change-Id: I13149b2e9689ef8b8056c612a29df9da32e39bf3
Reviewed-on: https://cr.bazel.build/8251
PiperOrigin-RevId: 146178693
MOS_MIGRATED_REVID=146178693
Diffstat (limited to 'src/main/java/com/google/devtools/build')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/packages/ImplicitOutputsFunction.java | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/packages/ImplicitOutputsFunction.java b/src/main/java/com/google/devtools/build/lib/packages/ImplicitOutputsFunction.java index 8ddffdd764..89356a06f6 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/ImplicitOutputsFunction.java +++ b/src/main/java/com/google/devtools/build/lib/packages/ImplicitOutputsFunction.java @@ -94,6 +94,8 @@ public abstract class ImplicitOutputsFunction { attrValues.put(attrName, value == null ? Runtime.NONE : value); } } + // Add 'name' explicitly, since its value is not in the attribute map. + attrValues.put("name", map.getName()); ClassObject attrs = SkylarkClassObjectConstructor.STRUCT.create( attrValues, "Attribute '%s' either doesn't exist " |