From d7311e0ddaf66857d5d7f332a6fad58e0bf7becb Mon Sep 17 00:00:00 2001 From: Mark Schaller Date: Tue, 7 Jul 2015 16:36:09 +0000 Subject: Activate interleaved package and transitive target loading Hooks up the recently introduced interleaved loading functions to normal graph loading. -- MOS_MIGRATED_REVID=97679451 --- .../lib/skyframe/PrepareDepsOfPatternsValue.java | 56 +++++++++++----------- 1 file changed, 29 insertions(+), 27 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsValue.java') diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsValue.java index eac1b89e22..ec9435b651 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsValue.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsValue.java @@ -13,10 +13,11 @@ // limitations under the License. package com.google.devtools.build.lib.skyframe; +import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe; -import com.google.devtools.build.lib.pkgcache.FilteringPolicy; +import com.google.devtools.build.lib.skyframe.TargetPatternValue.TargetPatternKey; import com.google.devtools.build.skyframe.SkyKey; import com.google.devtools.build.skyframe.SkyValue; @@ -24,53 +25,55 @@ import java.io.Serializable; import java.util.Objects; /** - * The value returned by {@link PrepareDepsOfPatternsFunction}. Because that function is - * invoked only for its side effect (i.e. ensuring the graph contains targets matching the - * pattern sequence and their transitive dependencies), this value carries no information. + * The value returned by {@link PrepareDepsOfPatternsFunction}. Although that function is + * invoked primarily for its side effect (i.e. ensuring the graph contains targets matching the + * pattern sequence and their transitive dependencies), this value contains the + * {@link TargetPatternKey} arguments of the {@link PrepareDepsOfPatternFunction}s evaluated in + * service of it. * - *

Because the returned value is always the same object, this value and the - * {@link PrepareDepsOfPatternsFunction} which computes it are incompatible with change pruning. It - * should only be requested by consumers who do not require reevaluation when - * {@link PrepareDepsOfPatternsFunction} is reevaluated. Safe consumers include, e.g., top-level - * consumers, and other functions which invoke {@link PrepareDepsOfPatternsFunction} solely for its - * side-effects. + *

Because the returned value may remain the same when the side-effects of this function + * evaluation change, this value and the {@link PrepareDepsOfPatternsFunction} which computes it + * are incompatible with change pruning. It should only be requested by consumers who do not + * require reevaluation when {@link PrepareDepsOfPatternsFunction} is reevaluated. Safe consumers + * include, e.g., top-level consumers, and other functions which invoke {@link + * PrepareDepsOfPatternsFunction} solely for its side-effects and which do not behave differently + * depending on those side-effects. */ @Immutable @ThreadSafe public final class PrepareDepsOfPatternsValue implements SkyValue { - public static final PrepareDepsOfPatternsValue INSTANCE = new PrepareDepsOfPatternsValue(); - private PrepareDepsOfPatternsValue() { + private final ImmutableList targetPatternKeys; + + PrepareDepsOfPatternsValue(ImmutableList targetPatternKeys) { + this.targetPatternKeys = targetPatternKeys; + } + + public ImmutableList getTargetPatternKeys() { + return targetPatternKeys; } @ThreadSafe - public static SkyKey key(ImmutableList patterns, FilteringPolicy policy, String offset) { + public static SkyKey key(ImmutableList patterns, String offset) { return new SkyKey(SkyFunctions.PREPARE_DEPS_OF_PATTERNS, - new TargetPatternSequence(patterns, policy, offset)); + new TargetPatternSequence(patterns, offset)); } /** The argument value for {@link SkyKey}s of {@link PrepareDepsOfPatternsFunction}. */ @ThreadSafe public static class TargetPatternSequence implements Serializable { private final ImmutableList patterns; - private final FilteringPolicy policy; private final String offset; - private TargetPatternSequence(ImmutableList patterns, FilteringPolicy policy, - String offset) { - this.patterns = patterns; - this.policy = policy; - this.offset = offset; + private TargetPatternSequence(ImmutableList patterns, String offset) { + this.patterns = Preconditions.checkNotNull(patterns); + this.offset = Preconditions.checkNotNull(offset); } public ImmutableList getPatterns() { return patterns; } - public FilteringPolicy getPolicy() { - return policy; - } - public String getOffset() { return offset; } @@ -84,13 +87,12 @@ public final class PrepareDepsOfPatternsValue implements SkyValue { return false; } TargetPatternSequence that = (TargetPatternSequence) o; - return offset.equals(that.offset) && patterns.equals(that.patterns) - && policy.equals(that.policy); + return Objects.equals(offset, that.offset) && Objects.equals(patterns, that.patterns); } @Override public int hashCode() { - return Objects.hash(patterns, policy, offset); + return Objects.hash(patterns, offset); } } } -- cgit v1.2.3