aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar tomlu <tomlu@google.com>2017-08-22 22:20:36 +0200
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2017-08-23 13:29:08 +0200
commit8a8126a8774d8dbd01e50ee2675398db14d1cd42 (patch)
tree5460b55c290308fe53714166cb1bc9d528d8cf42
parentb3b86a09cfbe669a2a07a4a55d0f533125a64c21 (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: 166104375
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java b/src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java
index 095d1d8f43..a996d8c4a7 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java
@@ -392,7 +392,6 @@ public final class DexArchiveAspect extends NativeAspectClass implements Configu
ruleContext.registerAction(
new SpawnAction.Builder()
.setExecutable(ruleContext.getExecutablePrerequisite(desugarPrereqName, Mode.HOST))
- .addArgument("@" + paramFile.getExecPathString())
.addInput(jar)
.addInput(paramFile)
.addInputs(bootclasspath)
@@ -400,6 +399,7 @@ public final class DexArchiveAspect extends NativeAspectClass implements Configu
.addOutput(result)
.setMnemonic("Desugar")
.setProgressMessage("Desugaring %s for Android", jar.prettyPrint())
+ .setCommandLine(CustomCommandLine.builder().addPrefixedExecPath("@", paramFile).build())
.build(ruleContext));
return result;
}
@@ -444,14 +444,15 @@ public final class DexArchiveAspect extends NativeAspectClass implements Configu
new SpawnAction.Builder()
.setExecutable(ruleContext.getExecutablePrerequisite(dexbuilderPrereq, Mode.HOST))
// WorkerSpawnStrategy expects the last argument to be @paramfile
- .addArgument("@" + paramFile.getExecPathString())
.addInput(jar)
.addInput(paramFile)
.addOutput(dexArchive)
.setMnemonic("DexBuilder")
.setExecutionInfo(ExecutionRequirements.WORKER_MODE_ENABLED)
.setProgressMessage(
- "Dexing %s with applicable dexopts %s", jar.prettyPrint(), incrementalDexopts);
+ "Dexing %s with applicable dexopts %s", jar.prettyPrint(), incrementalDexopts)
+ .setCommandLine(
+ CustomCommandLine.builder().addPrefixedExecPath("@", paramFile).build());
ruleContext.registerAction(dexbuilder.build(ruleContext));
return dexArchive;
}