diff options
author | 2018-04-26 06:50:30 -0700 | |
---|---|---|
committer | 2018-04-26 06:52:03 -0700 | |
commit | d26d0ca3510dbd9da624bcccb160fca0d9621568 (patch) | |
tree | 7bc86036b1d2c2f2039d4c36bf2b3f996e10fdae /src/main | |
parent | 753f0f64bc6f42f318c56dc5e063409601011529 (diff) |
Automated rollback of commit c5c6ef83936cf90fd11038a84637e691beb47288.
*** Reason for rollback ***
b/78577719
*** Original change description ***
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...
***
RELNOTES: None
PiperOrigin-RevId: 194389749
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java | 22 |
1 files changed, 15 insertions, 7 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 244c0ed1e7..9c91ece4a3 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,6 +46,7 @@ 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; @@ -1288,19 +1289,26 @@ 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) - // 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()) + .addCommandLine(CustomCommandLine.builder().addPrefixedExecPath("@", paramFile).build()) .build(ruleContext)); } |