Skip to content

Commit

Permalink
Remove useless explicit 'stat' call on the BUILD file in directories …
Browse files Browse the repository at this point in the history
…encountered during legacy globbing (note that we end up doing this stat anyway in the 'locator.getBuildFileForPackage' call). The old motivation for this is obsolete; we have incremental correctness from Skyframe.

--
MOS_MIGRATED_REVID=104982764
  • Loading branch information
haxorz authored and kchodorow committed Oct 9, 2015
1 parent ab0b0c5 commit 46f95c9
Showing 1 changed file with 0 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.google.devtools.build.lib.concurrent.ThreadSafety;
import com.google.devtools.build.lib.util.Pair;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.Symlinks;
import com.google.devtools.build.lib.vfs.UnixGlob;

import java.io.IOException;
Expand Down Expand Up @@ -114,28 +113,9 @@ public boolean apply(Path directory) {
if (directory.equals(packageDirectory)) {
return true;
}

PackageIdentifier subPackageId = PackageIdentifier.create(
packageId.getRepository(),
packageId.getPackageFragment().getRelative(directory.relativeTo(packageDirectory)));
UnixGlob.FilesystemCalls syscalls = GlobCache.this.syscalls.get();
if (syscalls != UnixGlob.DEFAULT_SYSCALLS) {
// This is needed because in case the BUILD file exists, we do not call readdir() on its
// directory. However, the package needs to be re-evaluated if the BUILD file is removed.
// Therefore, we add this BUILD file to our dependencies by statting it through the
// recording syscall object so that the BUILD file itself is added to the dependencies of
// this package.
//
// The stat() call issued by locator.getBuildFileForPackage() does not quite cut it
// because 1. it is cached so there may not be a stat() call at all and 2. even if there
// is, it does not go through the proxy in GlobCache.this.syscalls.
//
// Note that this does not cause any significant slowdown; the BUILD file cache will have
// already evaluated the very same stat, so we don't pay any I/O cost, only a cache
// lookup.
syscalls.statNullable(directory.getChild("BUILD"), Symlinks.FOLLOW);
}

return locator.getBuildFileForPackage(subPackageId) == null;
}
};
Expand Down

0 comments on commit 46f95c9

Please sign in to comment.