diff options
author | ulfjack <ulfjack@google.com> | 2017-04-20 13:45:25 +0200 |
---|---|---|
committer | Klaus Aehlig <aehlig@google.com> | 2017-04-20 15:39:11 +0200 |
commit | 8989e19ab957a18f4937531dd55b5c30b207e6df (patch) | |
tree | aa9c24c56059ae4b33fb484b7499b68d16127eaa /src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternFunction.java | |
parent | de48d7d8cf0fe3d87e348e74e10506d160495428 (diff) |
Rewrite repository lookup to return a failed value rather than throw
We need to lookup repositories as part of converting exec paths to artifacts,
which in turn is needed for action cache lookups. These lookups should not
cause a Skyframe exit, so we must not throw an exception here, unless the
error makes it impossible to continue. Instead, we need to leave the decision
whether to error out or not to the caller.
Note that we may unnecessarily fetch a remote repository in order to do the
action cache lookup, even if the action no longer depends on the input file,
although this should only be possible for C++ compile actions. It's possible
that there's another bug in the C++ compile action key computation that also
contributes.
This change also makes it so that the post-resolution action cache code
ignores any errors wrt. repository lookup rather than throwing. If any of the
paths could not be found, then the action cache lookup fails and we re-execute
the corresponding action, which is exactly what should happen.
Fixes #2759.
PiperOrigin-RevId: 153696243
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternFunction.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternFunction.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternFunction.java index 3b4b768793..a4a3b1bda8 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternFunction.java @@ -244,6 +244,11 @@ public class PrepareDepsOfPatternFunction implements SkyFunction { throw new MissingDepException(); } + if (!repositoryValue.repositoryExists()) { + // This shouldn't be possible; we're given a repository, so we assume that the caller has + // already checked for its existence. + throw new IllegalStateException(String.format("No such repository '%s'", repository)); + } roots.add(repositoryValue.getPath()); } |