Search in sources :

Example 11 with SkylarkList

use of com.google.devtools.build.lib.syntax.SkylarkList in project bazel by bazelbuild.

the class SkylarkRuleContextTest method assertArtifactList.

private void assertArtifactList(Object result, List<String> artifacts) {
    assertThat(result).isInstanceOf(SkylarkList.class);
    SkylarkList resultList = (SkylarkList) result;
    assertEquals(artifacts.size(), resultList.size());
    int i = 0;
    for (String artifact : artifacts) {
        assertEquals(artifact, ((Artifact) resultList.get(i++)).getFilename());
    }
}
Also used : SkylarkList(com.google.devtools.build.lib.syntax.SkylarkList)

Example 12 with SkylarkList

use of com.google.devtools.build.lib.syntax.SkylarkList in project bazel by bazelbuild.

the class SkylarkRuleContextTest method testFeatures.

@Test
public void testFeatures() throws Exception {
    SkylarkRuleContext ruleContext = createRuleContext("//foo:cc_with_features");
    Object result = evalRuleContextCode(ruleContext, "ruleContext.features");
    assertThat((SkylarkList<?>) result).containsExactly("cc_include_scanning", "f1", "f2");
}
Also used : SkylarkList(com.google.devtools.build.lib.syntax.SkylarkList) SkylarkClassObject(com.google.devtools.build.lib.packages.SkylarkClassObject) SkylarkRuleContext(com.google.devtools.build.lib.rules.SkylarkRuleContext) Test(org.junit.Test)

Aggregations

SkylarkList (com.google.devtools.build.lib.syntax.SkylarkList)12 Test (org.junit.Test)8 ConfiguredTarget (com.google.devtools.build.lib.analysis.ConfiguredTarget)6 AnalysisResult (com.google.devtools.build.lib.analysis.BuildView.AnalysisResult)5 SkylarkClassObject (com.google.devtools.build.lib.packages.SkylarkClassObject)3 Artifact (com.google.devtools.build.lib.actions.Artifact)2 SkylarkRuleContext (com.google.devtools.build.lib.rules.SkylarkRuleContext)2 ClassObject (com.google.devtools.build.lib.syntax.ClassObject)2 EvalException (com.google.devtools.build.lib.syntax.EvalException)2 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 FileConfiguredTarget (com.google.devtools.build.lib.analysis.FileConfiguredTarget)1 OutputGroupProvider (com.google.devtools.build.lib.analysis.OutputGroupProvider)1 RuleConfiguredTarget (com.google.devtools.build.lib.analysis.RuleConfiguredTarget)1 SkylarkProviders (com.google.devtools.build.lib.analysis.SkylarkProviders)1 Label (com.google.devtools.build.lib.cmdline.Label)1 Attribute (com.google.devtools.build.lib.packages.Attribute)1 AllowedValueSet (com.google.devtools.build.lib.packages.Attribute.AllowedValueSet)1 SkylarkComputedDefaultTemplate (com.google.devtools.build.lib.packages.Attribute.SkylarkComputedDefaultTemplate)1