From e965f1eaf3949c6f43219b933c30b5fd0e5a6c14 Mon Sep 17 00:00:00 2001 From: Son Luong Ngoc Date: Mon, 24 Apr 2023 21:58:05 +0200 Subject: [PATCH] RemoteExecutionService: Action.Command to set output_paths This is a follow-up to https://github.com/bazelbuild/bazel/pull/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. --- .../devtools/build/lib/remote/RemoteExecutionService.java | 2 ++ .../devtools/build/lib/remote/RemoteExecutionServiceTest.java | 2 ++ .../lib/remote/RemoteSpawnRunnerWithGrpcRemoteExecutorTest.java | 1 + 3 files changed, 5 insertions(+) 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 e3cd49323bac26..205d8f95f45425 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 @@ -236,7 +236,9 @@ static Command buildCommand( Collections.sort(outputFiles); Collections.sort(outputDirectories); command.addAllOutputFiles(outputFiles); + command.addAllOutputPaths(outputFiles); command.addAllOutputDirectories(outputDirectories); + command.addAllOutputPaths(outputDirectories); if (platform != null) { command.setPlatform(platform); diff --git a/src/test/java/com/google/devtools/build/lib/remote/RemoteExecutionServiceTest.java b/src/test/java/com/google/devtools/build/lib/remote/RemoteExecutionServiceTest.java index 3f15557ffc6b16..8cac5f3c305933 100644 --- a/src/test/java/com/google/devtools/build/lib/remote/RemoteExecutionServiceTest.java +++ b/src/test/java/com/google/devtools/build/lib/remote/RemoteExecutionServiceTest.java @@ -193,6 +193,7 @@ public void buildRemoteAction_withRegularFileAsOutput() throws Exception { RemoteAction remoteAction = service.buildRemoteAction(spawn, context); assertThat(remoteAction.getCommand().getOutputFilesList()).containsExactly(execPath.toString()); + assertThat(remoteAction.getCommand().getOutputPathsList()).containsExactly(execPath.toString()); assertThat(remoteAction.getCommand().getOutputDirectoriesList()).isEmpty(); } @@ -228,6 +229,7 @@ public void buildRemoteAction_withUnresolvedSymlinkAsOutput() throws Exception { assertThat(remoteAction.getCommand().getOutputFilesList()).containsExactly("path/to/link"); assertThat(remoteAction.getCommand().getOutputDirectoriesList()).isEmpty(); + assertThat(remoteAction.getCommand().getOutputPathsList()).containsExactly("path/to/link"); } @Test diff --git a/src/test/java/com/google/devtools/build/lib/remote/RemoteSpawnRunnerWithGrpcRemoteExecutorTest.java b/src/test/java/com/google/devtools/build/lib/remote/RemoteSpawnRunnerWithGrpcRemoteExecutorTest.java index 7088859f7653da..11a14cba5a7ff2 100644 --- a/src/test/java/com/google/devtools/build/lib/remote/RemoteSpawnRunnerWithGrpcRemoteExecutorTest.java +++ b/src/test/java/com/google/devtools/build/lib/remote/RemoteSpawnRunnerWithGrpcRemoteExecutorTest.java @@ -342,6 +342,7 @@ public int maxConcurrency() { .setValue("value") .build()) .addAllOutputFiles(ImmutableList.of("bar", "foo")) + .addAllOutputPaths(ImmutableList.of("bar", "foo")) .build(); cmdDigest = DIGEST_UTIL.compute(command); channel.release();