diff options
author | 2015-08-11 23:04:20 +0000 | |
---|---|---|
committer | 2015-08-12 15:23:46 +0000 | |
commit | 77df35ecda687ea996fe5ead3c5d38d3bc2c59ed (patch) | |
tree | efcf9b7c1e7653c59abb2ad34015583868a594a5 /src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java | |
parent | b10ddbf94a5038819274afb963e0a90b67d76627 (diff) |
Add debugging info when resolving source artifacts.
--
MOS_MIGRATED_REVID=100427061
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java | 10 |
1 files changed, 10 insertions, 0 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 30ead6e517..d868816d49 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 @@ -297,6 +297,8 @@ public class ArtifactFactory implements ArtifactResolver, ArtifactSerializer, Ar relativePath, baseExecPath, baseRoot); + Preconditions.checkState( + relativePath.segmentCount() > 0, "%s %s %s", relativePath, baseExecPath, baseRoot); PathFragment execPath = baseExecPath == null ? relativePath : baseExecPath.getRelative(relativePath); execPath = execPath.normalize(); @@ -319,10 +321,18 @@ 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); dir = dir.getParentDirectory()) { + Preconditions.checkNotNull(dir, "%s %s %s", execPath, baseExecPath, baseRoot); Root sourceRoot = packageRoots.get(PackageIdentifier.createInDefaultRepo(dir)); if (sourceRoot != null) { return sourceRoot; |