aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java
diff options
context:
space:
mode:
authorGravatar Kristina Chodorow <kchodorow@google.com>2015-03-27 18:41:33 +0000
committerGravatar Ulf Adams <ulfjack@google.com>2015-03-30 12:19:33 +0000
commit3eeb6e6d9db99ed0bf0cc45d05be01a52e2ee4c4 (patch)
tree9a04f204cf8e40622e0711a055e697a3f179844d /src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java
parent267b0a1d34e73fdfa0a5fb6c5cc8f89a3700708b (diff)
Fix WORKSPACE file lookup to look at all package paths
-- MOS_MIGRATED_REVID=89713328
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java
index c877d38263..47405ee31a 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java
@@ -25,7 +25,8 @@ import com.google.devtools.build.skyframe.SkyValue;
*
* <p>Package lookups will always produce a value. On success, the {@code #getRoot} returns the
* package path root under which the package resides and the package's BUILD file is guaranteed to
- * exist; on failure, {@code #getErrorReason} and {@code #getErrorMsg} describe why the package
+ * exist (unless this is looking up a WORKSPACE file, in which case the underlying file may or may
+ * not exist. On failure, {@code #getErrorReason} and {@code #getErrorMsg} describe why the package
* doesn't exist.
*
* <p>Implementation detail: we use inheritance here to optimize for memory usage.
@@ -54,6 +55,10 @@ abstract class PackageLookupValue implements SkyValue {
return new SuccessfulPackageLookupValue(root);
}
+ public static PackageLookupValue workspace(Path root) {
+ return new WorkspacePackageLookupValue(root);
+ }
+
public static PackageLookupValue noBuildFile() {
return NoBuildFilePackageLookupValue.INSTANCE;
}
@@ -70,6 +75,10 @@ abstract class PackageLookupValue implements SkyValue {
return DeletedPackageLookupValue.INSTANCE;
}
+ public boolean isExternalPackage() {
+ return false;
+ }
+
/**
* For a successful package lookup, returns the root (package path entry) that the package
* resides in.
@@ -145,6 +154,27 @@ abstract class PackageLookupValue implements SkyValue {
}
}
+ // TODO(kchodorow): fix these semantics. This class should not exist, WORKSPACE lookup should
+ // just return success/failure like a "normal" package.
+ private static class WorkspacePackageLookupValue extends SuccessfulPackageLookupValue {
+
+ private WorkspacePackageLookupValue(Path root) {
+ super(root);
+ }
+
+ // TODO(kchodorow): get rid of this, the semantics are wrong (successful package lookup should
+ // mean the package exists).
+ @Override
+ public boolean packageExists() {
+ return getRoot().exists();
+ }
+
+ @Override
+ public boolean isExternalPackage() {
+ return true;
+ }
+ }
+
private abstract static class UnsuccessfulPackageLookupValue extends PackageLookupValue {
@Override