Skip to content

Commit d3fb047

Browse files
sluongngcopybara-github
authored andcommitted
RemoteExecutionService: Action.Command to set output_paths
This is a follow-up to #18198 Make Bazel compatible with newer version of Remote Api by setting output_paths along-side output_directories and output_files. The latter 2 are deprecated in newer REAPI specification. Closes #18202. PiperOrigin-RevId: 527560509 Change-Id: I14c80d69aa9a5e9bf29a8c5694412ecd58ea17bf
1 parent c6a8c08 commit d3fb047

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,18 +225,22 @@ static Command buildCommand(
225225
Command.Builder command = Command.newBuilder();
226226
ArrayList<String> outputFiles = new ArrayList<>();
227227
ArrayList<String> outputDirectories = new ArrayList<>();
228+
ArrayList<String> outputPaths = new ArrayList<>();
228229
for (ActionInput output : outputs) {
229230
String pathString = decodeBytestringUtf8(remotePathResolver.localPathToOutputPath(output));
230231
if (output.isDirectory()) {
231232
outputDirectories.add(pathString);
232233
} else {
233234
outputFiles.add(pathString);
234235
}
236+
outputPaths.add(pathString);
235237
}
236238
Collections.sort(outputFiles);
237239
Collections.sort(outputDirectories);
240+
Collections.sort(outputPaths);
238241
command.addAllOutputFiles(outputFiles);
239242
command.addAllOutputDirectories(outputDirectories);
243+
command.addAllOutputPaths(outputPaths);
240244

241245
if (platform != null) {
242246
command.setPlatform(platform);

src/test/java/com/google/devtools/build/lib/remote/RemoteExecutionServiceTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ public void buildRemoteAction_withRegularFileAsOutput() throws Exception {
193193
RemoteAction remoteAction = service.buildRemoteAction(spawn, context);
194194

195195
assertThat(remoteAction.getCommand().getOutputFilesList()).containsExactly(execPath.toString());
196+
assertThat(remoteAction.getCommand().getOutputPathsList()).containsExactly(execPath.toString());
196197
assertThat(remoteAction.getCommand().getOutputDirectoriesList()).isEmpty();
197198
}
198199

@@ -228,6 +229,7 @@ public void buildRemoteAction_withUnresolvedSymlinkAsOutput() throws Exception {
228229

229230
assertThat(remoteAction.getCommand().getOutputFilesList()).containsExactly("path/to/link");
230231
assertThat(remoteAction.getCommand().getOutputDirectoriesList()).isEmpty();
232+
assertThat(remoteAction.getCommand().getOutputPathsList()).containsExactly("path/to/link");
231233
}
232234

233235
@Test

src/test/java/com/google/devtools/build/lib/remote/RemoteSpawnRunnerWithGrpcRemoteExecutorTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ public int maxConcurrency() {
342342
.setValue("value")
343343
.build())
344344
.addAllOutputFiles(ImmutableList.of("bar", "foo"))
345+
.addAllOutputPaths(ImmutableList.of("bar", "foo"))
345346
.build();
346347
cmdDigest = DIGEST_UTIL.compute(command);
347348
channel.release();

0 commit comments

Comments
 (0)