aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/DirectoryListingStateFunction.java
diff options
context:
space:
mode:
authorGravatar Michajlo Matijkiw <michajlo@google.com>2015-03-31 23:41:02 +0000
committerGravatar Han-Wen Nienhuys <hanwen@google.com>2015-04-01 13:43:06 +0000
commitdb110946b07a7ac65785dc8a3d4ae6e25eaa8fb9 (patch)
tree68f36f810f5bfda2429f241b0feff7162f39f0be /src/main/java/com/google/devtools/build/lib/skyframe/DirectoryListingStateFunction.java
parent0b6fdcd2fe959984e3e386ff758aafc0ba88ace9 (diff)
optionally error on files outside of known roots
The goal of this change is to provide a means for disallowing files outside of declared, known locations in order to better enforce the hermeticy and in turn reproducability of builds. Previously when encountering these files (typically via external symlinks) we would add a dependency on build_id, now we can optionally fail the build. -- MOS_MIGRATED_REVID=90015665
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/DirectoryListingStateFunction.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/DirectoryListingStateFunction.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/DirectoryListingStateFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/DirectoryListingStateFunction.java
index 6e47a2d54b..b5a87a84ef 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/DirectoryListingStateFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/DirectoryListingStateFunction.java
@@ -39,12 +39,15 @@ public class DirectoryListingStateFunction implements SkyFunction {
public SkyValue compute(SkyKey skyKey, Environment env)
throws DirectoryListingStateFunctionException {
RootedPath dirRootedPath = (RootedPath) skyKey.argument();
- externalFilesHelper.maybeAddDepOnBuildId(dirRootedPath, env);
- if (env.valuesMissing()) {
- return null;
- }
+
try {
+ externalFilesHelper.maybeHandleExternalFile(dirRootedPath, env);
+ if (env.valuesMissing()) {
+ return null;
+ }
return DirectoryListingStateValue.create(dirRootedPath);
+ } catch (FileOutsidePackageRootsException e) {
+ throw new DirectoryListingStateFunctionException(e);
} catch (IOException e) {
throw new DirectoryListingStateFunctionException(e);
}
@@ -64,5 +67,9 @@ public class DirectoryListingStateFunction implements SkyFunction {
public DirectoryListingStateFunctionException(IOException e) {
super(e, Transience.TRANSIENT);
}
+
+ public DirectoryListingStateFunctionException(FileOutsidePackageRootsException e) {
+ super(e, Transience.PERSISTENT);
+ }
}
}