diff options
author | 2016-11-16 19:13:52 +0000 | |
---|---|---|
committer | 2016-11-17 18:17:51 +0000 | |
commit | b09ea9435280745e294d03d735810a56efca337f (patch) | |
tree | 442ff22134ab6d7484b0db1bb7677672562145cf /src/test/java/com/google/devtools/build/lib/skylark | |
parent | b0de919d8657d5809d9ab8315d4665926087d0b4 (diff) |
Rollback of commit a3f5f576cd35798140ba3e81d03d919dd4ecb847.
*** Reason for rollback ***
Breaks targets in the depot:
[]
*** Original change description ***
output_group is not a real Skylark provider for aspects, as well as for rules.
--
MOS_MIGRATED_REVID=139354682
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/skylark')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/skylark/SkylarkAspectsTest.java | 79 |
1 files changed, 1 insertions, 78 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkAspectsTest.java b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkAspectsTest.java index 3e1a552875..d053f05adf 100644 --- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkAspectsTest.java +++ b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkAspectsTest.java @@ -259,6 +259,7 @@ public class SkylarkAspectsTest extends AnalysisTestCase { "", "MyAspect = aspect(", " implementation=_impl,", + " attr_aspects=['deps'],", ")"); scratch.file( "test/BUILD", @@ -293,50 +294,6 @@ public class SkylarkAspectsTest extends AnalysisTestCase { } @Test - public void testAspectWithOutputGroupsAsList() throws Exception { - scratch.file( - "test/aspect.bzl", - "def _impl(target, ctx):", - " g = target.output_group('_hidden_top_level" + INTERNAL_SUFFIX + "')", - " return struct(output_groups = { 'my_result' : [ f for f in g] })", - "", - "MyAspect = aspect(", - " implementation=_impl,", - ")"); - scratch.file( - "test/BUILD", - "java_library(", - " name = 'xxx',", - " srcs = ['A.java'],", - ")"); - - AnalysisResult analysisResult = - update(ImmutableList.of("test/aspect.bzl%MyAspect"), "//test:xxx"); - assertThat( - transform( - analysisResult.getTargetsToBuild(), - new Function<ConfiguredTarget, String>() { - @Nullable - @Override - public String apply(ConfiguredTarget configuredTarget) { - return configuredTarget.getLabel().toString(); - } - })) - .containsExactly("//test:xxx"); - AspectValue aspectValue = analysisResult.getAspects().iterator().next(); - OutputGroupProvider outputGroupProvider = - aspectValue.getConfiguredAspect().getProvider(OutputGroupProvider.class); - assertThat(outputGroupProvider).isNotNull(); - NestedSet<Artifact> names = outputGroupProvider.getOutputGroup("my_result"); - assertThat(names).isNotEmpty(); - NestedSet<Artifact> expectedSet = getConfiguredTarget("//test:xxx") - .getProvider(OutputGroupProvider.class) - .getOutputGroup(OutputGroupProvider.HIDDEN_TOP_LEVEL); - assertThat(names).containsExactlyElementsIn(expectedSet); - } - - - @Test public void testAspectsFromSkylarkRules() throws Exception { scratch.file( "test/aspect.bzl", @@ -643,40 +600,6 @@ public class SkylarkAspectsTest extends AnalysisTestCase { } @Test - public void duplicateGroupsFormAspects() throws Exception { - scratch.file( - "test/aspect.bzl", - "def _a1_impl(target, ctx):", - " f = ctx.new_file('f.txt')", - " ctx.file_action(f, 'f')", - " return struct(output_groups = { 'a1_group' : set([f]) })", - "", - "a1 = aspect(implementation=_a1_impl, attr_aspects = ['dep'])", - "def _rule_impl(ctx):", - " pass", - "my_rule1 = rule(_rule_impl, attrs = { 'dep' : attr.label(aspects = [a1]) })", - "def _a2_impl(target, ctx):", - " f = ctx.new_file('f.txt')", - " ctx.file_action(f, 'f')", - " return struct(output_groups = { 'a2_group' : set([f]) })", - "", - "a2 = aspect(implementation=_a2_impl, attr_aspects = ['dep'])", - "my_rule2 = rule(_rule_impl, attrs = { 'dep' : attr.label(aspects = [a2]) })" - ); - scratch.file( - "test/BUILD", - "load(':aspect.bzl', 'my_rule1', 'my_rule2')", - "my_rule1(name = 'base')", - "my_rule1(name = 'xxx', dep = ':base')", - "my_rule2(name = 'yyy', dep = ':xxx')" - ); - - // no error. - update("//test:yyy"); - } - - - @Test public void duplicateSkylarkProviders() throws Exception { scratch.file( "test/aspect.bzl", |