diff options
author | 2016-07-27 14:22:41 +0000 | |
---|---|---|
committer | 2016-07-28 18:36:28 -0400 | |
commit | 974bbd92080ec47ebeef8fb99c6178cbf3fe7e1e (patch) | |
tree | b81f4ed060dc932f1a88c7081fc29c3f8af66465 /src/main/java/com/google/devtools/build/lib/skyframe | |
parent | 040391a600603c4d4430603e89cd0ff8920228af (diff) |
Clean up DependencyResolver's interface for the dynamic config migration and for general readability.
Major changes:
- Remove the intermediate Attribute -> LabelAndConfiguration multimap (computed in resolveAttributes). Instead, feed discovered values directly into the final Attribute -> Dependency map via a new RuleResolver interface.
- Remove all references to LabelAndConfiguration. The configuration is always the owning rule's configuration except for two special cases: late-bound attributes with splits and late-bound attributes with LateBoundDefault.useHostConfiguration. The original interface made this very unclear and required a lot of awkward and sometimes incorrect logic. The new interface only involves configurations for the cases that actually need them.
- Remove an ugly hack caused by BuildConfiguration.evaluateTransition mixing poorly with LateBoundDefault.useHostConfiguration (https://github.com/bazelbuild/bazel/blo[]e172693c27f3efc95ed163e43a9f0a7a6fb4017/src/main/java/com/google/devtools/build/lib/analysis/DependencyResolver.java#L488).
- Remove a hack that applies split transitions twice because of BuildConfiguration.evaluateTransition mixing poorly with late-bound split attributes (https://github.com/bazelbuild/bazel/blo[]e172693c27f3efc95ed163e43a9f0a7a6fb4017/src/main/java/com/google/devtools/build/lib/analysis/DependencyResolver.java#L319). This happens to be innocent now but won't be when nested splits are possible.
- Solidifies the API contract for Attribute.LateBoundDefault.useHostConfiguration.
- Applies clearer naming and more consistent ordering to method parameters.
- Better documentation.
This is all also prep work for dynamic split transitions.
tl;dr: late-bound attributes are legitimately special. Treat them that way to make the rest of DependencyResolver cleaner and hack-free.
--
MOS_MIGRATED_REVID=128582618
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java index b0a8137c57..18fbe8ce74 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java @@ -710,14 +710,12 @@ final class ConfiguredTargetFunction implements SkyFunction { Map<Label, ConfigMatchingProvider> configConditions = new LinkedHashMap<>(); // Collect the labels of the configured targets we need to resolve. - ListMultimap<Attribute, LabelAndConfiguration> configLabelMap = ArrayListMultimap.create(); + ListMultimap<Attribute, Label> configLabelMap = ArrayListMultimap.create(); RawAttributeMapper attributeMap = RawAttributeMapper.of(((Rule) target)); for (Attribute a : ((Rule) target).getAttributes()) { for (Label configLabel : attributeMap.getConfigurabilityKeys(a.getName(), a.getType())) { if (!BuildType.Selector.isReservedLabel(configLabel)) { - configLabelMap.put(a, LabelAndConfiguration.of( - target.getLabel().resolveRepositoryRelative(configLabel), - ctgValue.getConfiguration())); + configLabelMap.put(a, target.getLabel().resolveRepositoryRelative(configLabel)); } } } |