aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/ExternalFilesHelper.java
diff options
context:
space:
mode:
authorGravatar Kristina Chodorow <kchodorow@google.com>2015-07-16 15:18:39 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2015-07-17 13:17:45 +0000
commit6009cf953643af157c395732e058e5af8657a833 (patch)
tree4f9d8e8bb37fb67f5978333f31cd655fae078058 /src/main/java/com/google/devtools/build/lib/skyframe/ExternalFilesHelper.java
parent0e544ff8eba6a9576e80a8daf9461b40b837bf05 (diff)
Invalidate external repository files when the WORKSPACE changes
Fixes #236. -- MOS_MIGRATED_REVID=98402890
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/ExternalFilesHelper.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ExternalFilesHelper.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ExternalFilesHelper.java b/src/main/java/com/google/devtools/build/lib/skyframe/ExternalFilesHelper.java
index 9363111e7b..745df2874b 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ExternalFilesHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ExternalFilesHelper.java
@@ -14,7 +14,9 @@
package com.google.devtools.build.lib.skyframe;
import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
+import com.google.devtools.build.lib.packages.ExternalPackage;
import com.google.devtools.build.lib.pkgcache.PathPackageLocator;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.RootedPath;
@@ -60,7 +62,7 @@ class ExternalFilesHelper {
// A file inside the package roots.
INTERNAL_FILE,
- // A file outside the package roots that we may pretend is immutable.
+ // A file outside the package roots that users of ExternalFilesHelper may pretend is immutable.
EXTERNAL_IMMUTABLE_FILE,
// A file outside the package roots about which we may make no other assumptions.
@@ -92,8 +94,10 @@ class ExternalFilesHelper {
* Potentially adds a dependency on build_id to env if this instance is configured
* with errorOnExternalFiles=false and rootedPath is an external mutable file.
* If errorOnExternalFiles=true and rootedPath is an external mutable file then
- * a FileOutsidePackageRootsException is thrown. This method is a no-op for any
- * rootedPaths that fall within the known package roots.
+ * a FileOutsidePackageRootsException is thrown. If the file is an external file that is
+ * referenced by the WORKSPACE, it gets a dependency on the //external package (and, thus,
+ * WORKSPACE file changes). This method is a no-op for any rootedPaths that fall within the known
+ * package roots.
*
* @param rootedPath
* @param env
@@ -127,6 +131,9 @@ class ExternalFilesHelper {
} else {
throw new FileOutsidePackageRootsException(rootedPath);
}
+ } else if (getFileType(rootedPath) == FileType.EXTERNAL_IMMUTABLE_FILE) {
+ Preconditions.checkNotNull(
+ env.getValue(PackageValue.key(ExternalPackage.PACKAGE_IDENTIFIER)));
}
}
}