From 369d1a633e6ef60b673e8403917e8eef6ab5ec5a Mon Sep 17 00:00:00 2001 From: tomlu Date: Wed, 23 Aug 2017 09:22:37 +0200 Subject: 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 --- .../build/lib/bazel/rules/python/BazelPythonSemantics.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') 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)); } -- cgit v1.2.3