diff options
Diffstat (limited to 'src/test')
3 files changed, 31 insertions, 2 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java b/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java index 571fe2345a..efdd13dcd7 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java @@ -1917,7 +1917,7 @@ public abstract class BuildViewTestCase extends FoundationTestCase { RawAttributeMapper attr = RawAttributeMapper.of(associatedRule); - String path = Iterables.getOnlyElement(outputFunction.getImplicitOutputs(attr)); + String path = Iterables.getOnlyElement(outputFunction.getImplicitOutputs(eventCollector, attr)); return view.getArtifactFactory() .getDerivedArtifact( diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkIntegrationTest.java b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkIntegrationTest.java index 8b2770a90a..8039563a44 100644 --- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkIntegrationTest.java +++ b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkIntegrationTest.java @@ -915,6 +915,35 @@ public class SkylarkIntegrationTest extends BuildViewTestCase { } @Test + public void testRuleClassImplicitOutputFunctionPrints() throws Exception { + scratch.file( + "test/skylark/extension.bzl", + "def custom_rule_impl(ctx):", + " print('implementation', ctx.label)", + " files = [ctx.outputs.o]", + " ctx.actions.run_shell(", + " outputs = files,", + " command = 'echo')", + "", + "def output_func(name):", + " print('output function', name)", + " return {'o': name + '.txt'}", + "", + "custom_rule = rule(implementation = custom_rule_impl,", + " outputs = output_func)"); + + scratch.file( + "test/skylark/BUILD", + "load('/test/skylark/extension', 'custom_rule')", + "", + "custom_rule(name = 'cr')"); + + getConfiguredTarget("//test/skylark:cr"); + assertContainsEvent("output function cr"); + assertContainsEvent("implementation //test/skylark:cr"); + } + + @Test public void testRuleClassNonMandatoryEmptyOutputs() throws Exception { scratch.file( "test/skylark/extension.bzl", diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java index 0371315830..d947562206 100644 --- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java +++ b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java @@ -701,7 +701,7 @@ public class SkylarkRuleClassFunctionsTest extends SkylarkTestCase { "r1 = rule(impl, outputs = {'a': 'a.txt'})"); RuleClass c = ((SkylarkRuleFunction) lookup("r1")).getRuleClass(); ImplicitOutputsFunction function = c.getDefaultImplicitOutputsFunction(); - assertThat(function.getImplicitOutputs(null)).containsExactly("a.txt"); + assertThat(function.getImplicitOutputs(ev.getEventHandler(), null)).containsExactly("a.txt"); } @Test |