diff options
author | Janak Ramakrishnan <janakr@google.com> | 2015-12-08 18:42:16 +0000 |
---|---|---|
committer | David Chen <dzc@google.com> | 2015-12-08 22:26:35 +0000 |
commit | 834310692f46defa99d9e9ca87194853c9f8a773 (patch) | |
tree | 09a87fc92f5a4fc6cfceaa6358e9b608a8a0c8a6 /src/main/java/com/google/devtools/build/lib/skyframe/ExternalFilesHelper.java | |
parent | a5d8d090b8803a166c285f377a2328dcb7aff85f (diff) |
Follow-up on f9fdc8dfced8b2b14561720623126a91e04b22cb -- reinstate short-circuit check when all package paths have good diff information and no external files have been seen.
--
MOS_MIGRATED_REVID=109703164
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.java | 15 |
1 files changed, 8 insertions, 7 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 100858aaab..f21e4ca0c9 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 @@ -27,6 +27,10 @@ public class ExternalFilesHelper { private final AtomicReference<PathPackageLocator> pkgLocator; private final ExternalFileAction externalFileAction; + // This variable is set to true from multiple threads, but only read once, in the main thread. + // So volatility or an AtomicBoolean is not needed. + private boolean externalFileSeen = false; + /** * @param pkgLocator an {@link AtomicReference} to a {@link PathPackageLocator} used to * determine what files are internal. @@ -50,15 +54,11 @@ public class ExternalFilesHelper { ERROR_OUT, } - private enum FileType { - // A file inside the package roots or in an external repository. - INTERNAL_FILE, - - // A file outside the package roots about which we may make no other assumptions. - EXTERNAL_MUTABLE_FILE, + boolean isExternalFileSeen() { + return externalFileSeen; } - public static boolean isInternal(RootedPath rootedPath, PathPackageLocator packageLocator) { + static boolean isInternal(RootedPath rootedPath, PathPackageLocator packageLocator) { // TODO(bazel-team): This is inefficient when there are a lot of package roots or there are a // lot of external directories. Consider either explicitly preventing this case or using a more // efficient approach here (e.g. use a trie for determining if a file is under an external @@ -77,6 +77,7 @@ public class ExternalFilesHelper { return; } + externalFileSeen = true; if (externalFileAction == ExternalFileAction.DEPEND_ON_EXTERNAL_PKG) { // For files outside the package roots, add a dependency on the //external package so that if // the WORKSPACE file changes, the File/DirectoryStateValue will be re-evaluated. |