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-05-06 13:41:02 +0000
committerGravatar Lukacs Berki <lberki@google.com>2015-05-07 14:03:43 +0000
commit5a449cbb4aafbf3d75ce22966f8be9e761f8ab6d (patch)
tree875d8394195ef5a7ef39792f391e29958427a332 /src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java
parent2181bc445fa2d43caf192f4bf0d3513095e34dca (diff)
Track BUILD file changes on new_ repositories
I noticed, while writing http://bazel.io/docs/cpp.html#including-external-libraries-an-example, that the BUILD file didn't get reparsed when it changed. This fixes that. -- MOS_MIGRATED_REVID=92921670
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.java37
1 files changed, 37 insertions, 0 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 47405ee31a..c26252a198 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
@@ -13,6 +13,7 @@
// limitations under the License.
package com.google.devtools.build.lib.skyframe;
+import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.devtools.build.lib.packages.PackageIdentifier;
import com.google.devtools.build.lib.vfs.Path;
@@ -20,6 +21,8 @@ import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
+import java.util.Objects;
+
/**
* A value that represents a package lookup result.
*
@@ -55,6 +58,11 @@ abstract class PackageLookupValue implements SkyValue {
return new SuccessfulPackageLookupValue(root);
}
+ public static PackageLookupValue overlaidBuildFile(
+ Path root, Optional<FileValue> overlaidBuildFile) {
+ return new OverlaidPackageLookupValue(root, overlaidBuildFile);
+ }
+
public static PackageLookupValue workspace(Path root) {
return new WorkspacePackageLookupValue(root);
}
@@ -154,6 +162,35 @@ abstract class PackageLookupValue implements SkyValue {
}
}
+ /**
+ * A package under external/ that has a BUILD file that is not under external/.
+ *
+ * <p>This is kind of a hack to get around our assumption that external/ is immutable.</p>
+ */
+ private static class OverlaidPackageLookupValue extends SuccessfulPackageLookupValue {
+
+ private final Optional<FileValue> overlaidBuildFile;
+
+ public OverlaidPackageLookupValue(Path root, Optional<FileValue> overlaidBuildFile) {
+ super(root);
+ this.overlaidBuildFile = overlaidBuildFile;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof OverlaidPackageLookupValue)) {
+ return false;
+ }
+ OverlaidPackageLookupValue other = (OverlaidPackageLookupValue) obj;
+ return super.equals(other) && overlaidBuildFile.equals(other.overlaidBuildFile);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(super.hashCode(), overlaidBuildFile);
+ }
+ }
+
// 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 {