Skip to content

Commit c58f0b8

Browse files
committed
Allow remote build with no-op scrubber
1 parent 5caacf1 commit c58f0b8

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

src/main/java/com/google/devtools/build/lib/remote/RemoteExecutionService.java

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ public boolean mayBeExecutedRemotely(Spawn spawn) {
346346
return remoteCache instanceof RemoteExecutionCache
347347
&& remoteExecutor != null
348348
&& Spawns.mayBeExecutedRemotely(spawn)
349-
&& !isScrubbedSpawn(spawn, scrubber);
349+
&& !hasScrubbedInput(spawn, scrubber);
350350
}
351351

352352
@VisibleForTesting
@@ -1635,8 +1635,29 @@ void report(Event evt) {
16351635
}
16361636
}
16371637

1638-
private static boolean isScrubbedSpawn(Spawn spawn, @Nullable Scrubber scrubber) {
1639-
return scrubber != null && scrubber.forSpawn(spawn) != null;
1638+
private static boolean hasScrubbedInput(Spawn spawn, @Nullable Scrubber scrubber) {
1639+
if (scrubber == null) {
1640+
return false;
1641+
}
1642+
SpawnScrubber spawnScrubber = scrubber.forSpawn(spawn);
1643+
if (spawnScrubber == null) {
1644+
return false;
1645+
}
1646+
if (!spawnScrubber.getSalt().isEmpty()) {
1647+
return true;
1648+
}
1649+
for (String arg : spawn.getArguments()) {
1650+
if (!arg.equals(spawnScrubber.transformArgument(arg))) {
1651+
return true;
1652+
}
1653+
}
1654+
var inputFiles = spawn.getInputFiles();
1655+
for (ActionInput inputFile : inputFiles.toList()) {
1656+
if (spawnScrubber.shouldOmitInput(inputFile.getExecPath())) {
1657+
return true;
1658+
}
1659+
}
1660+
return false;
16401661
}
16411662

16421663
/**

0 commit comments

Comments
 (0)