Skip to content

Commit

Permalink
Allow remote build with no-op scrubber
Browse files Browse the repository at this point in the history
  • Loading branch information
bozaro committed Sep 27, 2024
1 parent 5caacf1 commit c58f0b8
Showing 1 changed file with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ public boolean mayBeExecutedRemotely(Spawn spawn) {
return remoteCache instanceof RemoteExecutionCache
&& remoteExecutor != null
&& Spawns.mayBeExecutedRemotely(spawn)
&& !isScrubbedSpawn(spawn, scrubber);
&& !hasScrubbedInput(spawn, scrubber);
}

@VisibleForTesting
Expand Down Expand Up @@ -1635,8 +1635,29 @@ void report(Event evt) {
}
}

private static boolean isScrubbedSpawn(Spawn spawn, @Nullable Scrubber scrubber) {
return scrubber != null && scrubber.forSpawn(spawn) != null;
private static boolean hasScrubbedInput(Spawn spawn, @Nullable Scrubber scrubber) {
if (scrubber == null) {
return false;
}
SpawnScrubber spawnScrubber = scrubber.forSpawn(spawn);
if (spawnScrubber == null) {
return false;
}
if (!spawnScrubber.getSalt().isEmpty()) {
return true;
}
for (String arg : spawn.getArguments()) {
if (!arg.equals(spawnScrubber.transformArgument(arg))) {
return true;
}
}
var inputFiles = spawn.getInputFiles();
for (ActionInput inputFile : inputFiles.toList()) {
if (spawnScrubber.shouldOmitInput(inputFile.getExecPath())) {
return true;
}
}
return false;
}

/**
Expand Down

0 comments on commit c58f0b8

Please sign in to comment.