aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib
diff options
context:
space:
mode:
authorGravatar Carmi Grushko <carmi@google.com>2016-12-09 20:42:29 +0000
committerGravatar John Cater <jcater@google.com>2016-12-12 20:35:05 +0000
commit905a29d0e61d5393f2b7646fae8e6b4a819e68f4 (patch)
treed45abc27c5da03ab346c1bb2f07a6200a3236185 /src/test/java/com/google/devtools/build/lib
parent7f2d9ccbdef6e5c5a23d8f80f36464bcf1d54475 (diff)
Names of extra-action protos now take into account aspect names.
That is, if an Aspect registered an action that an extra-action is shadowing, its name will be used when creating the extra-action's ID and name. Without this change, it's impossible to analyze extra-actions when there's more than one aspected rule that acts on the same rule (e.g., java_proto_library and java_lite_proto_library on the same proto_library). -- PiperOrigin-RevId: 141587608 MOS_MIGRATED_REVID=141587608
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib')
-rw-r--r--src/test/java/com/google/devtools/build/lib/analysis/AspectTest.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/AspectTest.java b/src/test/java/com/google/devtools/build/lib/analysis/AspectTest.java
index ae4f5337cf..2ad6952274 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/AspectTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/AspectTest.java
@@ -541,6 +541,47 @@ public class AspectTest extends AnalysisTestCase {
}
@Test
+ public void extraActionsFromDifferentAspectsDontConflict() throws Exception {
+ useConfiguration(
+ "--experimental_action_listener=//pkg1:listener",
+ "--experimental_extra_action_top_level_only");
+
+ scratch.file(
+ "x/BUILD",
+ "load(':extension.bzl', 'injector1', 'injector2', 'null_rule')",
+ "injector1(name='i1_a', deps=[':n'], param = 'a')",
+ "injector1(name='i1_b', deps=[':n'], param = 'b')",
+ "injector2(name='i2', deps=[':n'])",
+ "null_rule(name = 'n')");
+
+ scratch.file(
+ "x/extension.bzl",
+ "def _aspect_impl(target, ctx):",
+ " ctx.empty_action(mnemonic='Mnemonic')",
+ " return struct()",
+ "aspect1 = aspect(_aspect_impl, attr_aspects=['deps'], attrs =",
+ " {'param': attr.string(values = ['a', 'b'])})",
+ "aspect2 = aspect(_aspect_impl, attr_aspects=['deps'])",
+ "def _rule_impl(ctx):",
+ " return struct()",
+ "injector1 = rule(_rule_impl, attrs =",
+ " { 'deps' : attr.label_list(aspects = [aspect1]), 'param' : attr.string() })",
+ "injector2 = rule(_rule_impl, attrs = { 'deps' : attr.label_list(aspects = [aspect2]) })",
+ "null_rule = rule(_rule_impl, attrs = { 'deps' : attr.label_list() })"
+ );
+
+ scratch.file(
+ "pkg1/BUILD",
+ "extra_action(name='xa', cmd='echo dont-care')",
+ "action_listener(name='listener', mnemonics=['Mnemonic'], extra_actions=[':xa'])");
+
+ update("//x:i1_a", "//x:i1_b", "//x:i2");
+
+ // Implicitly check that update() didn't throw an exception because of two actions producing
+ // the same outputs.
+ }
+
+ @Test
public void aspectPropagatesToAllAttributesImplicit() throws Exception {
setRulesAvailableInTests(new TestAspects.BaseRule(),
new TestAspects.SimpleRule(),