Regression test for breakage caused by Fails before fix.
@@ -166,6 +166,24 @@ public class BuildViewTest extends BuildViewTestBase {
assertThat(action.getClass()).isSameInstanceAs(FailAction.class);
}
+ @Test
+ public void testGetArtifactOwnerInStarlark() throws Exception {
+ scratch.file(
+ "foo/rule.bzl",
+ "def _impl(ctx):",
+ " f = ctx.actions.declare_file('rule_output')",
+ " print('f owner is ' + str(f.owner))",
+ " ctx.actions.write(",
+ " output = f,",
+ " content = 'foo',",
+ " )",
+ "gen = rule(implementation = _impl)");
+ scratch.file("foo/BUILD", "load(':rule.bzl', 'gen')", "gen(name = 'a')");
+
+ update("//foo:a");
+ assertContainsEvent("DEBUG /workspace/foo/rule.bzl:3:3: f owner is //foo:a");
+ }
+
@Test
public void testSyntaxErrorInDepPackage() throws Exception {
// Check that a loading error in a dependency is properly reported.
