aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com
diff options
context:
space:
mode:
authorGravatar Janak Ramakrishnan <janakr@google.com>2015-08-12 19:23:20 +0000
committerGravatar Florian Weikert <fwe@google.com>2015-08-13 14:01:30 +0000
commit97615f456b0b27003e8b236a0bb74011e484e551 (patch)
tree37bac973dd52903d0129f5f61f1d906bd2ff60d5 /src/main/java/com
parentdda04e2b656f58e89ef269c5de1785d6c680e293 (diff)
Remove incorrect preconditions checks when resolving artifacts.
-- MOS_MIGRATED_REVID=100501490
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java b/src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java
index d868816d49..300e382de8 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java
@@ -320,25 +320,19 @@ public class ArtifactFactory implements ArtifactResolver, ArtifactSerializer, Ar
@Nullable
private Root findSourceRoot(
- PathFragment execPath, PathFragment baseExecPath, @Nullable Root baseRoot) {
- Preconditions.checkState(
- baseExecPath == null
- || (execPath.startsWith(baseExecPath) && !execPath.equals(baseExecPath)),
- "%s %s %s",
- execPath,
- baseExecPath,
- baseRoot);
- // Probe the known packages to find the longest package prefix up until the base.
- for (PathFragment dir = execPath.getParentDirectory();
- !Objects.equals(dir, baseExecPath);
+ PathFragment execPath, @Nullable PathFragment baseExecPath, @Nullable Root baseRoot) {
+ // Probe the known packages to find the longest package prefix up until the base, or until the
+ // root directory if our execPath doesn't start with baseExecPath due to uplevel references.
+ PathFragment dir;
+ for (dir = execPath.getParentDirectory();
+ dir != null && !dir.equals(baseExecPath);
dir = dir.getParentDirectory()) {
- Preconditions.checkNotNull(dir, "%s %s %s", execPath, baseExecPath, baseRoot);
Root sourceRoot = packageRoots.get(PackageIdentifier.createInDefaultRepo(dir));
if (sourceRoot != null) {
return sourceRoot;
}
}
- return baseRoot;
+ return dir != null && dir.equals(baseExecPath) ? baseRoot : null;
}
@Override