aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar tomlu <tomlu@google.com>2017-08-23 09:22:37 +0200
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2017-08-23 13:31:47 +0200
commit369d1a633e6ef60b673e8403917e8eef6ab5ec5a (patch)
treea09a01a0b513f7e6fdef62ea43ddaf0635c57379 /src
parentc01c30c92eea58cd1105986903ff090593a1bb61 (diff)
Use CustomCommandLine directly instead of via SpawnAction.Builder.
This change forces use of CustomCommandLine.Builder, which has a richer interface for constructing memory-efficient command lines. It will also permit surveying the code base for inefficient patterns using an IDE. This change was done by hand and split using Rosie to assist with rollbacks in case of bugs. Reviewers, please pay particular attention to: * Each all to addInputArgument/addOutputArgument should come with a corresponding matching pair to SpawnAction.Builder#addInput and CustomCommandLine.Builder#addExecPath (eg.). * The commandLine must be set on the SpawnAction using SpawnAction.Builder#setCommandLine. Note that most calls to addPrefixed("arg=", val) should be more idiomatically expressed as add("arg", val), but this involves changing tests and making sure that the command line tools can accept the format. PiperOrigin-RevId: 166167207
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java
index b48d800150..1aed86d599 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java
@@ -317,9 +317,12 @@ public class BazelPythonSemantics implements PythonSemantics {
.addOutput(zipFile)
.setExecutable(zipper)
.useDefaultShellEnvironment()
- .addArgument("cC")
- .addArgument(zipFile.getExecPathString())
- .addArgument("@" + paramFile.getExecPathString())
+ .setCommandLine(
+ CustomCommandLine.builder()
+ .add("cC")
+ .addExecPath(zipFile)
+ .addPrefixedExecPath("@", paramFile)
+ .build())
.setMnemonic("PythonZipper")
.build(ruleContext));
}