diff options
author | Janak Ramakrishnan <janakr@google.com> | 2015-06-02 20:20:31 +0000 |
---|---|---|
committer | Kristina Chodorow <kchodorow@google.com> | 2015-06-03 13:49:00 +0000 |
commit | f7ff616b36a980e344d240066c909b8995a1ea37 (patch) | |
tree | 7c6f5904e7e15f831782ab2b9ee47b8cffb42e41 /src/main/java/com/google/devtools/build/lib/skyframe/RecursivePkgValue.java | |
parent | fb6e5e9ec2aec8fbff7531423137f07ff7b8359a (diff) |
Properly handle exceptions that RecursivePkgFunction can encounter, instead of silently swallowing them.
The old behavior was simply incorrect on --keep_going builds because it meant any directory with an uncaught error caused all of its ancestors to not have any values. It wasn't noticed because SkyframeTargetPatternEvaluator was overly permissive in the errors it expects.
We also use a singleton for the empty RecursivePkgValue which might have a negligible (beneficial) memory impact.
--
MOS_MIGRATED_REVID=95037551
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/RecursivePkgValue.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/RecursivePkgValue.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/RecursivePkgValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/RecursivePkgValue.java index 56ed0e504a..721ebc8f0c 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/RecursivePkgValue.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/RecursivePkgValue.java @@ -16,6 +16,8 @@ package com.google.devtools.build.lib.skyframe; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableSet; import com.google.devtools.build.lib.collect.nestedset.NestedSet; +import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; +import com.google.devtools.build.lib.collect.nestedset.Order; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe; import com.google.devtools.build.lib.vfs.PathFragment; @@ -32,14 +34,23 @@ import java.util.Objects; */ @Immutable @ThreadSafe -public class RecursivePkgValue implements SkyValue { +class RecursivePkgValue implements SkyValue { + static final RecursivePkgValue EMPTY = + new RecursivePkgValue(NestedSetBuilder.<String>emptySet(Order.STABLE_ORDER)); private final NestedSet<String> packages; - public RecursivePkgValue(NestedSet<String> packages) { + private RecursivePkgValue(NestedSet<String> packages) { this.packages = packages; } + static RecursivePkgValue create(NestedSetBuilder<String> packages) { + if (packages.isEmpty()) { + return EMPTY; + } + return new RecursivePkgValue(packages.build()); + } + /** * Create a transitive package lookup request. */ |