aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
diff options
context:
space:
mode:
authorGravatar tomlu <tomlu@google.com>2018-04-24 17:24:24 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-04-24 17:26:07 -0700
commitc5c6ef83936cf90fd11038a84637e691beb47288 (patch)
treecc72ee213e65ada176700a300c9c6d5381ce011f /src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
parent95db4159d6fc39de2f2cf5a0bf23bde807e3d6ec (diff)
Change action construction to use built-in param file support.
We want to be able to control how and when param files are used, and manual construction of param files prevents this. It should also be less code overall. For this CL, when param files are used is unchanged, their format and encoding is unchanged. The flag name is also unchanged, except in some cases it was changed from (eg.) "--flagfile foo" to "--flagfile=foo". However, the name of the param file is now derived from the primary output of the action (instead of manually controlled). RELNOTES: None PiperOrigin-RevId: 194171911
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
index 9c91ece4a3..244c0ed1e7 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
@@ -46,7 +46,6 @@ import com.google.devtools.build.lib.analysis.Runfiles;
import com.google.devtools.build.lib.analysis.RunfilesProvider;
import com.google.devtools.build.lib.analysis.actions.CustomCommandLine;
import com.google.devtools.build.lib.analysis.actions.CustomCommandLine.VectorArg;
-import com.google.devtools.build.lib.analysis.actions.ParameterFileWriteAction;
import com.google.devtools.build.lib.analysis.actions.SpawnAction;
import com.google.devtools.build.lib.analysis.actions.SpawnAction.Builder;
import com.google.devtools.build.lib.analysis.actions.SpawnActionTemplate;
@@ -1289,26 +1288,19 @@ public abstract class AndroidBinary implements RuleConfiguredTargetFactory {
.addExecPath("--output", outputZip)
.add("--no_duplicates") // safety: expect distinct entry names in all inputs
.build();
- // Must use params file as otherwise expanding the input tree artifact doesn't work
- Artifact paramFile =
- ruleContext.getDerivedArtifact(
- ParameterFile.derivePath(outputZip.getRootRelativePath()), outputZip.getRoot());
- ruleContext.registerAction(
- new ParameterFileWriteAction(
- ruleContext.getActionOwner(),
- ImmutableList.of(inputTree),
- paramFile,
- args,
- ParameterFile.ParameterFileType.SHELL_QUOTED,
- ISO_8859_1));
ruleContext.registerAction(
singleJarSpawnActionBuilder(ruleContext)
.setMnemonic("MergeDexZips")
.setProgressMessage("Merging dex shards for %s", ruleContext.getLabel())
.addInput(inputTree)
- .addInput(paramFile)
.addOutput(outputZip)
- .addCommandLine(CustomCommandLine.builder().addPrefixedExecPath("@", paramFile).build())
+ // Must use params file as otherwise expanding the input tree artifact doesn't work
+ .addCommandLine(
+ args,
+ ParamFileInfo.builder(ParameterFile.ParameterFileType.SHELL_QUOTED)
+ .setCharset(ISO_8859_1)
+ .setUseAlways(true)
+ .build())
.build(ruleContext));
}