use of com.google.devtools.build.lib.analysis.RuleConfiguredTarget in project bazel by bazelbuild.
the class SkylarkIntegrationTest method testTransitiveInfoProviders.
@Test
public void testTransitiveInfoProviders() throws Exception {
scratch.file("test/skylark/extension.bzl", "def custom_rule_impl(ctx):", " attr1 = ctx.files.attr1", " ftb = depset(attr1)", " return struct(provider_key = ftb)", "", "custom_rule = rule(implementation = custom_rule_impl,", " attrs = {'attr1': attr.label_list(mandatory=True, allow_files=True)})");
scratch.file("test/skylark/BUILD", "load('/test/skylark/extension', 'custom_rule')", "", "custom_rule(name = 'cr', attr1 = [':a.txt'])");
RuleConfiguredTarget target = (RuleConfiguredTarget) getConfiguredTarget("//test/skylark:cr");
assertThat(ActionsTestUtil.baseArtifactNames(((SkylarkNestedSet) target.get("provider_key")).getSet(Artifact.class))).containsExactly("a.txt");
}
Aggregations