diff options
author | 2018-03-22 07:51:49 -0700 | |
---|---|---|
committer | 2018-03-22 07:53:30 -0700 | |
commit | bbae54f82a9649149545f702468added4af67d0e (patch) | |
tree | 9f70e547a1987f54723429d0466ec81b16332c11 /src/test/java/com/google/devtools/build/lib/rules/config/FeatureFlagSetterRule.java | |
parent | 6be45bbe62f6046eb2d8d46759f47ab4d0f58bad (diff) |
Forward deps artifacts from FeatureFlagSetterRule.
This is helpful for testing the behavior of rules underneath the flag setter without going around Bazel internals.
RELNOTES: None.
PiperOrigin-RevId: 190064449
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/rules/config/FeatureFlagSetterRule.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/rules/config/FeatureFlagSetterRule.java | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/config/FeatureFlagSetterRule.java b/src/test/java/com/google/devtools/build/lib/rules/config/FeatureFlagSetterRule.java index 4b466ae714..97ee6d78fa 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/config/FeatureFlagSetterRule.java +++ b/src/test/java/com/google/devtools/build/lib/rules/config/FeatureFlagSetterRule.java @@ -14,17 +14,16 @@ package com.google.devtools.build.lib.rules.config; -import static com.google.devtools.build.lib.collect.nestedset.Order.STABLE_ORDER; import static com.google.devtools.build.lib.packages.Attribute.attr; import static com.google.devtools.build.lib.packages.BuildType.LABEL; import static com.google.devtools.build.lib.packages.BuildType.LABEL_KEYED_STRING_DICT; import static com.google.devtools.build.lib.packages.BuildType.LABEL_LIST; import com.google.common.collect.ImmutableMap; -import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.MutableActionGraph.ActionConflictException; import com.google.devtools.build.lib.analysis.BaseRuleClasses; import com.google.devtools.build.lib.analysis.ConfiguredTarget; +import com.google.devtools.build.lib.analysis.PrerequisiteArtifacts; import com.google.devtools.build.lib.analysis.RuleConfiguredTargetBuilder; import com.google.devtools.build.lib.analysis.RuleConfiguredTargetFactory; import com.google.devtools.build.lib.analysis.RuleContext; @@ -35,11 +34,10 @@ import com.google.devtools.build.lib.analysis.TransitiveInfoCollection; import com.google.devtools.build.lib.analysis.config.ConfigMatchingProvider; import com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget.Mode; import com.google.devtools.build.lib.cmdline.Label; -import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; import com.google.devtools.build.lib.packages.RuleClass; import com.google.devtools.build.lib.packages.RuleClass.Builder; -/** Rule introducing a transition to set feature flags for dependencies. */ +/** Rule introducing a transition to set feature flags for itself and dependencies. */ public final class FeatureFlagSetterRule implements RuleDefinition, RuleConfiguredTargetFactory { @Override @@ -48,10 +46,7 @@ public final class FeatureFlagSetterRule implements RuleDefinition, RuleConfigur .requiresConfigurationFragments(ConfigFeatureFlagConfiguration.class) .cfg(new ConfigFeatureFlagTransitionFactory("flag_values")) .add(attr("deps", LABEL_LIST).allowedFileTypes()) - .add( - attr("exports_setting", LABEL) - .allowedRuleClasses("config_setting") - .allowedFileTypes()) + .add(attr("exports_setting", LABEL).allowedRuleClasses("config_setting").allowedFileTypes()) .add( attr("exports_flag", LABEL) .allowedRuleClasses("config_feature_flag") @@ -89,7 +84,7 @@ public final class FeatureFlagSetterRule implements RuleDefinition, RuleConfigur RuleConfiguredTargetBuilder builder = new RuleConfiguredTargetBuilder(ruleContext) - .setFilesToBuild(NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER)) + .setFilesToBuild(PrerequisiteArtifacts.nestedSet(ruleContext, "deps", Mode.TARGET)) .addProvider(RunfilesProvider.class, RunfilesProvider.EMPTY); if (exportedFlagProvider != null) { builder.addNativeDeclaredProvider(exportedFlagProvider); |