aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules
diff options
context:
space:
mode:
authorGravatar tomlu <tomlu@google.com>2017-08-22 03:17:35 +0200
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2017-08-22 09:15:29 +0200
commit78ce3d14a0e1d45c4602ce09b6b6c0fa290383bc (patch)
tree0b20f2c36f837c6e013c4732ec197d9c775a5f6e /src/main/java/com/google/devtools/build/lib/rules
parent01f659d7cf2bad3d55b139354759d4f3098f55e4 (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: 166003829
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidDevice.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidDevice.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidDevice.java
index 2845148329..344d41b9e8 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidDevice.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidDevice.java
@@ -36,6 +36,7 @@ import com.google.devtools.build.lib.analysis.Runfiles;
import com.google.devtools.build.lib.analysis.RunfilesProvider;
import com.google.devtools.build.lib.analysis.RunfilesSupport;
import com.google.devtools.build.lib.analysis.TransitiveInfoCollection;
+import com.google.devtools.build.lib.analysis.actions.CustomCommandLine;
import com.google.devtools.build.lib.analysis.actions.SpawnAction;
import com.google.devtools.build.lib.analysis.actions.TemplateExpansionAction;
import com.google.devtools.build.lib.analysis.actions.TemplateExpansionAction.Substitution;
@@ -327,11 +328,12 @@ public class AndroidDevice implements RuleConfiguredTargetFactory {
"--android_sdk_path=" + sdkPath.getExecPathString(),
"--platform_apks=" + Artifact.joinExecPaths(",", platformApks));
+ CustomCommandLine.Builder commandLine = CustomCommandLine.builder();
if (defaultProperties.isPresent()) {
spawnBuilder.addInput(defaultProperties.get());
- spawnBuilder.addArgument(
- "--default_properties_file=" + defaultProperties.get().getExecPathString());
+ commandLine.addPrefixedExecPath("--default_properties_file=", defaultProperties.get());
}
+ spawnBuilder.setCommandLine(commandLine.build());
ruleContext.registerAction(spawnBuilder.build(ruleContext));
}