diff options
author | 2015-06-19 16:00:34 +0000 | |
---|---|---|
committer | 2015-06-23 08:58:03 +0000 | |
commit | 9178bc24fa36ae58878ae67d214c1d4736fe464c (patch) | |
tree | 9fe19460d6aaff242ac8e429d9035b7c21b3280a /src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java | |
parent | 2aecb77180144db1d47e886f332644302c3ef811 (diff) |
Skylark: Test rules are implictly executable.
--
MOS_MIGRATED_REVID=96407941
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java b/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java index 457bbfb149..b0ffbc6892 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java +++ b/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java @@ -190,7 +190,8 @@ public class SkylarkRuleClassFunctions { optionalPositionals = { @Param(name = "test", type = Boolean.class, defaultValue = "False", doc = "Whether this rule is a test rule. " - + "If True, the rule must end with <code>_test</code> (otherwise it cannot)."), + + "If True, the rule must end with <code>_test</code> (otherwise it cannot), " + + "and there must be an action that generates <code>ctx.outputs.executable</code>."), @Param(name = "attrs", type = Map.class, noneable = true, defaultValue = "None", doc = "dictionary to declare all the attributes of the rule. It maps from an attribute name " + "to an attribute object (see <a href=\"#modules.attr\">attr</a> module). " @@ -215,6 +216,7 @@ public class SkylarkRuleClassFunctions { doc = "If true, the files will be generated in the genfiles directory instead of the " + "bin directory. This is used for compatibility with existing rules.")}, useAst = true, useEnvironment = true) + @SuppressWarnings("unused") // used via reflection. private static final BuiltinFunction rule = new BuiltinFunction("rule") { @SuppressWarnings({"rawtypes", "unchecked"}) // castMap produces // an Attribute.Builder instead of a Attribute.Builder<?> but it's OK. @@ -240,7 +242,7 @@ public class SkylarkRuleClassFunctions { builder.addOrOverrideAttribute(attrBuilder.build(attrName)); } } - if (executable) { + if (executable || test) { builder.addOrOverrideAttribute( attr("$is_executable", BOOLEAN).value(true) .nonconfigurable("Called from RunCommand.isExecutable, which takes a Target") |