Skip to content

Commit

Permalink
Rename ExecRequestUtils to PathToReplaceUtils
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 721777475
Change-Id: I41caab311020f85cd417912009ec1738b2bf6c86
  • Loading branch information
yuyue730 authored and copybara-github committed Jan 31, 2025
1 parent 7fe187e commit ad97203
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import com.google.protobuf.ByteString;

/** Helpers for constructing {@link ExecRequest}s. */
public class ExecRequestUtils {
public class PathToReplaceUtils {

/** Returns the common required {@link PathToReplace} list. */
public static ImmutableList<PathToReplace> getPathsToReplace(CommandEnvironment env) {
Expand All @@ -45,5 +45,5 @@ public static ByteString bytes(String string) {
return ByteString.copyFrom(string, ISO_8859_1);
}

private ExecRequestUtils() {}
private PathToReplaceUtils() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ private static ExecRequest.Builder execRequestBuilder(

private static ImmutableList<PathToReplace> getPathsToReplace(
CommandEnvironment env, String testLogDir, boolean isTestTarget) {
ImmutableList<PathToReplace> pathsToReplace = ExecRequestUtils.getPathsToReplace(env);
ImmutableList<PathToReplace> pathsToReplace = PathToReplaceUtils.getPathsToReplace(env);
if (isTestTarget) {
return ImmutableList.<PathToReplace>builder()
.addAll(pathsToReplace)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import com.google.devtools.build.lib.runtime.CommandEnvironment;
import com.google.devtools.build.lib.runtime.CommonCommandOptions;
import com.google.devtools.build.lib.runtime.commands.BuildCommand;
import com.google.devtools.build.lib.runtime.commands.ExecRequestUtils;
import com.google.devtools.build.lib.runtime.commands.PathToReplaceUtils;
import com.google.devtools.build.lib.server.CommandProtos.EnvironmentVariable;
import com.google.devtools.build.lib.server.CommandProtos.ExecRequest;
import com.google.devtools.build.lib.server.FailureDetails.FailureDetail;
Expand Down Expand Up @@ -357,18 +357,18 @@ private static ExecRequest createExecRequest(
CommandEnvironment env, Path workingDir, ImmutableList<String> cmdLine) {
return ExecRequest.newBuilder()
.setShouldExec(true)
.setWorkingDirectory(ExecRequestUtils.bytes(workingDir.getPathString()))
.addAllArgv(cmdLine.stream().map(ExecRequestUtils::bytes).collect(toImmutableList()))
.addAllPathToReplace(ExecRequestUtils.getPathsToReplace(env))
.setWorkingDirectory(PathToReplaceUtils.bytes(workingDir.getPathString()))
.addAllArgv(cmdLine.stream().map(PathToReplaceUtils::bytes).collect(toImmutableList()))
.addAllPathToReplace(PathToReplaceUtils.getPathsToReplace(env))
// TODO: b/333695932 - Shim for client run-support, remove once no longer needed.
.addEnvironmentVariable(
EnvironmentVariable.newBuilder()
.setName(ExecRequestUtils.bytes("BUILD_WORKING_DIRECTORY"))
.setValue(ExecRequestUtils.bytes(env.getWorkingDirectory().getPathString())))
.setName(PathToReplaceUtils.bytes("BUILD_WORKING_DIRECTORY"))
.setValue(PathToReplaceUtils.bytes(env.getWorkingDirectory().getPathString())))
.addEnvironmentVariable(
EnvironmentVariable.newBuilder()
.setName(ExecRequestUtils.bytes("BUILD_WORKSPACE_DIRECTORY"))
.setValue(ExecRequestUtils.bytes(env.getWorkspace().getPathString())))
.setName(PathToReplaceUtils.bytes("BUILD_WORKSPACE_DIRECTORY"))
.setValue(PathToReplaceUtils.bytes(env.getWorkspace().getPathString())))
.build();
}

Expand Down

0 comments on commit ad97203

Please sign in to comment.