diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteExecutionService.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteExecutionService.java index 31d78973c40fe7..08482339a4cb55 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/RemoteExecutionService.java +++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteExecutionService.java @@ -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 @@ -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; } /**