Skip to content

Commit 111a53a

Browse files
iancha1992sluongng
andauthored
RemoteExecutionService: Action.Command to set output_paths (#18440)
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 Co-authored-by: Son Luong Ngoc <[email protected]>
1 parent 46c7dcf commit 111a53a

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
@@ -222,18 +222,22 @@ static Command buildCommand(
222222
Command.Builder command = Command.newBuilder();
223223
ArrayList<String> outputFiles = new ArrayList<>();
224224
ArrayList<String> outputDirectories = new ArrayList<>();
225+
ArrayList<String> outputPaths = new ArrayList<>();
225226
for (ActionInput output : outputs) {
226227
String pathString = decodeBytestringUtf8(remotePathResolver.localPathToOutputPath(output));
227228
if (output.isDirectory()) {
228229
outputDirectories.add(pathString);
229230
} else {
230231
outputFiles.add(pathString);
231232
}
233+
outputPaths.add(pathString);
232234
}
233235
Collections.sort(outputFiles);
234236
Collections.sort(outputDirectories);
237+
Collections.sort(outputPaths);
235238
command.addAllOutputFiles(outputFiles);
236239
command.addAllOutputDirectories(outputDirectories);
240+
command.addAllOutputPaths(outputPaths);
237241

238242
if (platform != null) {
239243
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
@@ -191,6 +191,7 @@ public void buildRemoteAction_withRegularFileAsOutput() throws Exception {
191191
RemoteAction remoteAction = service.buildRemoteAction(spawn, context);
192192

193193
assertThat(remoteAction.getCommand().getOutputFilesList()).containsExactly(execPath.toString());
194+
assertThat(remoteAction.getCommand().getOutputPathsList()).containsExactly(execPath.toString());
194195
assertThat(remoteAction.getCommand().getOutputDirectoriesList()).isEmpty();
195196
}
196197

@@ -226,6 +227,7 @@ public void buildRemoteAction_withUnresolvedSymlinkAsOutput() throws Exception {
226227

227228
assertThat(remoteAction.getCommand().getOutputFilesList()).containsExactly("path/to/link");
228229
assertThat(remoteAction.getCommand().getOutputDirectoriesList()).isEmpty();
230+
assertThat(remoteAction.getCommand().getOutputPathsList()).containsExactly("path/to/link");
229231
}
230232

231233
@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
@@ -350,6 +350,7 @@ public int maxConcurrency() {
350350
.setValue("value")
351351
.build())
352352
.addAllOutputFiles(ImmutableList.of("bar", "foo"))
353+
.addAllOutputPaths(ImmutableList.of("bar", "foo"))
353354
.build();
354355
cmdDigest = DIGEST_UTIL.compute(command);
355356
channel.release();

0 commit comments

Comments
 (0)