diff options
author | 2017-07-14 10:07:50 +0200 | |
---|---|---|
committer | 2017-07-14 10:53:33 +0200 | |
commit | 0d31014a178eef578ea4f0db4607fe723b96154c (patch) | |
tree | 6a21969e1f55afe81e6b8991656c21dc839a1112 /src/main/java/com | |
parent | b89b7ee3f1f8497f7e86fd90b2e0df95b7631b46 (diff) |
Sorting the Action output files.
PiperOrigin-RevId: 161925075
Diffstat (limited to 'src/main/java/com')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/remote/CachedLocalSpawnRunner.java | 9 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java | 9 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/remote/CachedLocalSpawnRunner.java b/src/main/java/com/google/devtools/build/lib/remote/CachedLocalSpawnRunner.java index 95a34042c3..8b0376a4b7 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/CachedLocalSpawnRunner.java +++ b/src/main/java/com/google/devtools/build/lib/remote/CachedLocalSpawnRunner.java @@ -40,6 +40,7 @@ import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.List; import java.util.SortedMap; import java.util.TreeSet; @@ -138,11 +139,13 @@ final class CachedLocalSpawnRunner implements SpawnRunner { Action.Builder action = Action.newBuilder(); action.setCommandDigest(command); action.setInputRootDigest(inputRoot); - // Somewhat ugly: we rely on the stable order of outputs here for remote action caching. + ArrayList<String> outputPaths = new ArrayList<>(); for (ActionInput output : outputs) { - // TODO: output directories should be handled here, when they are supported. - action.addOutputFiles(output.getExecPathString()); + outputPaths.add(output.getExecPathString()); } + Collections.sort(outputPaths); + // TODO: output directories should be handled here, when they are supported. + action.addAllOutputFiles(outputPaths); if (platform != null) { action.setPlatform(platform); } diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java index 7ba5e5edf7..7a50e1cd3f 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java +++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java @@ -39,6 +39,7 @@ import com.google.protobuf.Duration; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.List; import java.util.SortedMap; import java.util.TreeSet; @@ -159,11 +160,13 @@ final class RemoteSpawnRunner implements SpawnRunner { Action.Builder action = Action.newBuilder(); action.setCommandDigest(command); action.setInputRootDigest(inputRoot); - // Somewhat ugly: we rely on the stable order of outputs here for remote action caching. + ArrayList<String> outputPaths = new ArrayList<>(); for (ActionInput output : outputs) { - // TODO: output directories should be handled here, when they are supported. - action.addOutputFiles(output.getExecPathString()); + outputPaths.add(output.getExecPathString()); } + Collections.sort(outputPaths); + // TODO: output directories should be handled here, when they are supported. + action.addAllOutputFiles(outputPaths); if (platform != null) { action.setPlatform(platform); } |