use of com.google.devtools.build.lib.packages.RuleClass in project bazel by bazelbuild.
the class SkylarkRuleClassFunctionsTest method testRuleLabelDefaultValue.
@Test
public void testRuleLabelDefaultValue() throws Exception {
evalAndExport("def impl(ctx): return None\n" + "r1 = rule(impl, attrs = {'a1': " + "attr.label(default = Label('//foo:foo'), allow_files=True)})");
RuleClass c = ((RuleFunction) lookup("r1")).getRuleClass();
Attribute a = c.getAttributeByName("a1");
assertThat(a.getDefaultValueForTesting()).isInstanceOf(Label.class);
assertEquals("//foo:foo", a.getDefaultValueForTesting().toString());
}
use of com.google.devtools.build.lib.packages.RuleClass in project bazel by bazelbuild.
the class SkylarkRuleClassFunctionsTest method testOutputToGenfiles.
@Test
public void testOutputToGenfiles() throws Exception {
evalAndExport("def impl(ctx): pass", "r1 = rule(impl, output_to_genfiles=True)");
RuleClass c = ((RuleFunction) lookup("r1")).getRuleClass();
assertFalse(c.hasBinaryOutput());
}
use of com.google.devtools.build.lib.packages.RuleClass in project bazel by bazelbuild.
the class AbstractAttributeMapperTest method initializeRuleAndMapper.
@Before
public final void initializeRuleAndMapper() throws Exception {
rule = scratchRule("p", "myrule", "cc_binary(name = 'myrule',", " srcs = ['a', 'b', 'c'])");
RuleClass ruleClass = rule.getRuleClassObject();
mapper = new TestMapper(rule.getPackage(), ruleClass, rule.getLabel(), rule.getAttributeContainer());
}
Aggregations