Skip to content

Commit

Permalink
remote/exec: always mark files executable.
Browse files Browse the repository at this point in the history
The main motivation for this change is to act as a workaround for bazelbuild#4751. Additionally,
this reduces the number of stat() system calls significantly e.g. by 50% when building Bazel
(600K vs 1.2M).
  • Loading branch information
buchgr committed May 15, 2018
1 parent ff8162d commit 3e3b71a
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -362,23 +362,21 @@ private synchronized Directory getOrComputeDirectory(TreeNode node) throws IOExc
TreeNode child = entry.getChild();
if (child.isLeaf()) {
ActionInput input = child.getActionInput();
final Digest digest;
if (input instanceof VirtualActionInput) {
VirtualActionInput virtualInput = (VirtualActionInput) input;
Digest digest = digestUtil.compute(virtualInput);
digest = digestUtil.compute(virtualInput);
virtualInputDigestCache.put(virtualInput, digest);
// There may be multiple inputs with the same digest. In that case, we don't care which
// one we get back from the digestVirtualInputCache later.
digestVirtualInputCache.put(digest, virtualInput);
b.addFilesBuilder()
.setName(entry.getSegment())
.setDigest(digest)
.setIsExecutable(false);
} else {
b.addFilesBuilder()
.setName(entry.getSegment())
.setDigest(DigestUtil.getFromInputCache(input, inputFileCache))
.setIsExecutable(execRoot.getRelative(input.getExecPathString()).isExecutable());
digest = DigestUtil.getFromInputCache(input, inputFileCache);
}
b.addFilesBuilder()
.setName(entry.getSegment())
.setDigest(digest)
.setIsExecutable(true);
} else {
Digest childDigest = Preconditions.checkNotNull(treeNodeDigestCache.get(child));
if (child.getActionInput() != null) {
Expand Down

0 comments on commit 3e3b71a

Please sign in to comment.