From 9178bc24fa36ae58878ae67d214c1d4736fe464c Mon Sep 17 00:00:00 2001 From: Laurent Le Brun Date: Fri, 19 Jun 2015 16:00:34 +0000 Subject: Skylark: Test rules are implictly executable. -- MOS_MIGRATED_REVID=96407941 --- .../google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java') 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 _test (otherwise it cannot)."), + + "If True, the rule must end with _test (otherwise it cannot), " + + "and there must be an action that generates ctx.outputs.executable."), @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 attr 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") -- cgit v1.2.3