Migrate all users of OptionsParser.enableParamsFileSupport to use the ShellQuotedParamsFilePreProcessor. This covers all of the tools packaged in the ResourceProcessorBusyBox.
RELNOTES: None.
PiperOrigin-RevId: 172485486
diff --git a/src/main/java/com/google/devtools/common/options/LegacyParamsFilePreProcessor.java b/src/main/java/com/google/devtools/common/options/LegacyParamsFilePreProcessor.java
index 9e8eeb0..56a7d2c 100644
--- a/src/main/java/com/google/devtools/common/options/LegacyParamsFilePreProcessor.java
+++ b/src/main/java/com/google/devtools/common/options/LegacyParamsFilePreProcessor.java
@@ -27,7 +27,11 @@
* A {@link ParamsFilePreProcessor} that processes a parameter file using a custom format. This
* format assumes each parameter is separated by whitespace and allows arguments to use single and
* double quotes and quote and whitespace escaping.
+ *
+ * <p><em>NOTE:</em> This class is deprecated; use either {@link ShellQuotedParamsFilePreProcessor}
+ * or {@link UnquotedParamsFilePreProcessor} depending on the format of the provided params file.
*/
+@Deprecated
public class LegacyParamsFilePreProcessor extends ParamsFilePreProcessor {
public LegacyParamsFilePreProcessor(FileSystem fs) {
diff --git a/src/main/java/com/google/devtools/common/options/OptionsParser.java b/src/main/java/com/google/devtools/common/options/OptionsParser.java
index 48dc9f3..ba3e57a 100644
--- a/src/main/java/com/google/devtools/common/options/OptionsParser.java
+++ b/src/main/java/com/google/devtools/common/options/OptionsParser.java
@@ -25,7 +25,6 @@
import com.google.devtools.common.options.OptionDefinition.NotAnOptionException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
-import java.nio.file.FileSystem;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -204,11 +203,6 @@
this.impl.setAllowSingleDashLongOptions(allowSingleDashLongOptions);
}
- /** Enables the Parser to handle params files located inside the provided {@link FileSystem}. */
- public void enableParamsFileSupport(FileSystem fs) {
- enableParamsFileSupport(new LegacyParamsFilePreProcessor(fs));
- }
-
/**
* Enables the Parser to handle params files using the provided {@link ParamsFilePreProcessor}.
*/
diff --git a/src/test/java/com/google/devtools/common/options/OptionsParserTest.java b/src/test/java/com/google/devtools/common/options/OptionsParserTest.java
index 79ac532..7d3c244 100644
--- a/src/test/java/com/google/devtools/common/options/OptionsParserTest.java
+++ b/src/test/java/com/google/devtools/common/options/OptionsParserTest.java
@@ -244,7 +244,7 @@
StandardOpenOption.CREATE);
OptionsParser parser = newOptionsParser(ExampleFoo.class, ExampleBaz.class);
- parser.enableParamsFileSupport(FileSystems.getDefault());
+ parser.enableParamsFileSupport(new LegacyParamsFilePreProcessor(FileSystems.getDefault()));
parser.parse("@" + params);
ExampleFoo foo = parser.getOptions(ExampleFoo.class);
assertThat(foo.foo).isEqualTo("defaultFoo");
@@ -264,7 +264,7 @@
StandardOpenOption.CREATE);
OptionsParser parser = newOptionsParser(ExampleFoo.class, ExampleBaz.class);
- parser.enableParamsFileSupport(FileSystems.getDefault());
+ parser.enableParamsFileSupport(new LegacyParamsFilePreProcessor(FileSystems.getDefault()));
parser.parse("@" + params);
ExampleFoo foo = parser.getOptions(ExampleFoo.class);
assertThat(foo.foo).isEqualTo("defaultFoo");
@@ -283,7 +283,7 @@
StandardOpenOption.CREATE);
OptionsParser parser = newOptionsParser(ExampleFoo.class, ExampleBaz.class);
- parser.enableParamsFileSupport(FileSystems.getDefault());
+ parser.enableParamsFileSupport(new LegacyParamsFilePreProcessor(FileSystems.getDefault()));
parser.parse("@" + params);
ExampleFoo foo = parser.getOptions(ExampleFoo.class);
assertThat(foo.foo).isEmpty();
@@ -302,7 +302,7 @@
StandardOpenOption.CREATE);
OptionsParser parser = newOptionsParser(ExampleFoo.class, ExampleBaz.class);
- parser.enableParamsFileSupport(FileSystems.getDefault());
+ parser.enableParamsFileSupport(new LegacyParamsFilePreProcessor(FileSystems.getDefault()));
parser.parse("@" + params);
ExampleFoo foo = parser.getOptions(ExampleFoo.class);
assertThat(foo.foo).isEqualTo("defaultFoo");
@@ -326,7 +326,7 @@
StandardOpenOption.CREATE);
OptionsParser parser = newOptionsParser(ExampleFoo.class, ExampleBaz.class);
- parser.enableParamsFileSupport(FileSystems.getDefault());
+ parser.enableParamsFileSupport(new LegacyParamsFilePreProcessor(FileSystems.getDefault()));
parser.parse("@" + params);
ExampleFoo foo = parser.getOptions(ExampleFoo.class);
assertThat(foo.foo).isEqualTo("defaultFoo");
@@ -345,7 +345,7 @@
StandardOpenOption.CREATE);
OptionsParser parser = newOptionsParser(ExampleFoo.class, ExampleBaz.class);
- parser.enableParamsFileSupport(FileSystems.getDefault());
+ parser.enableParamsFileSupport(new LegacyParamsFilePreProcessor(FileSystems.getDefault()));
parser.parse("@" + params);
ExampleFoo foo = parser.getOptions(ExampleFoo.class);
assertThat(foo.foo).isEqualTo("\"fuzzy\nfoo\"");
@@ -364,7 +364,7 @@
StandardOpenOption.CREATE);
OptionsParser parser = newOptionsParser(ExampleFoo.class, ExampleBaz.class);
- parser.enableParamsFileSupport(FileSystems.getDefault());
+ parser.enableParamsFileSupport(new LegacyParamsFilePreProcessor(FileSystems.getDefault()));
parser.parse("@" + params);
ExampleFoo foo = parser.getOptions(ExampleFoo.class);
assertThat(foo.foo).isEqualTo("fuzzy\\ foo");
@@ -383,7 +383,7 @@
StandardOpenOption.CREATE);
OptionsParser parser = newOptionsParser(ExampleFoo.class, ExampleBaz.class);
- parser.enableParamsFileSupport(FileSystems.getDefault());
+ parser.enableParamsFileSupport(new LegacyParamsFilePreProcessor(FileSystems.getDefault()));
parser.parse("@" + params);
ExampleFoo foo = parser.getOptions(ExampleFoo.class);
assertThat(foo.foo).isEqualTo("\"fuzzy\\\"foo\"");
@@ -403,7 +403,7 @@
StandardOpenOption.CREATE);
OptionsParser parser = newOptionsParser(ExampleFoo.class, ExampleBaz.class);
- parser.enableParamsFileSupport(FileSystems.getDefault());
+ parser.enableParamsFileSupport(new LegacyParamsFilePreProcessor(FileSystems.getDefault()));
parser.parse("@" + params);
ExampleFoo foo = parser.getOptions(ExampleFoo.class);
assertThat(foo.foo).isEqualTo("fuzzy 'foo");
@@ -423,7 +423,7 @@
StandardOpenOption.CREATE);
OptionsParser parser = newOptionsParser(ExampleFoo.class, ExampleBaz.class);
- parser.enableParamsFileSupport(FileSystems.getDefault());
+ parser.enableParamsFileSupport(new LegacyParamsFilePreProcessor(FileSystems.getDefault()));
parser.parse("@" + params);
ExampleFoo foo = parser.getOptions(ExampleFoo.class);
assertThat(foo.foo).isEqualTo("'fuzzy 'foo");
@@ -442,7 +442,7 @@
StandardOpenOption.CREATE);
OptionsParser parser = newOptionsParser(ExampleFoo.class, ExampleBaz.class);
- parser.enableParamsFileSupport(FileSystems.getDefault());
+ parser.enableParamsFileSupport(new LegacyParamsFilePreProcessor(FileSystems.getDefault()));
try {
parser.parse("@" + params);
fail();
@@ -475,7 +475,7 @@
StandardOpenOption.CREATE);
OptionsParser parser = newOptionsParser(ExampleFoo.class, ExampleBaz.class);
- parser.enableParamsFileSupport(FileSystems.getDefault());
+ parser.enableParamsFileSupport(new LegacyParamsFilePreProcessor(FileSystems.getDefault()));
parser.parse("@" + params);
ExampleFoo foo = parser.getOptions(ExampleFoo.class);
assertThat(foo.foo).isEqualTo("hello\\\nworld");
@@ -496,7 +496,7 @@
StandardOpenOption.CREATE);
OptionsParser parser = newOptionsParser(ExampleFoo.class, ExampleBaz.class);
- parser.enableParamsFileSupport(FileSystems.getDefault());
+ parser.enableParamsFileSupport(new LegacyParamsFilePreProcessor(FileSystems.getDefault()));
parser.parse("@" + params);
ExampleBaz baz = parser.getOptions(ExampleBaz.class);
assertThat(baz.baz).isEqualTo("hello\nworld");
@@ -516,7 +516,7 @@
StandardOpenOption.CREATE);
OptionsParser parser = newOptionsParser(ExampleFoo.class, ExampleBaz.class);
- parser.enableParamsFileSupport(FileSystems.getDefault());
+ parser.enableParamsFileSupport(new LegacyParamsFilePreProcessor(FileSystems.getDefault()));
parser.parse("@" + params);
ExampleFoo foo = parser.getOptions(ExampleFoo.class);
assertThat(foo.foo).isEqualTo("defaultFoo");
@@ -528,7 +528,7 @@
@Test
public void parsingFailsWithMissingParamsFile() {
OptionsParser parser = newOptionsParser(ExampleFoo.class, ExampleBaz.class);
- parser.enableParamsFileSupport(FileSystems.getDefault());
+ parser.enableParamsFileSupport(new LegacyParamsFilePreProcessor(FileSystems.getDefault()));
List<String> unknownOpts = asList("@does/not/exist");
try {
parser.parse(unknownOpts);
diff --git a/src/tools/android/java/com/google/devtools/build/android/Aapt2ResourcePackagingAction.java b/src/tools/android/java/com/google/devtools/build/android/Aapt2ResourcePackagingAction.java
index 5242aae..0a71f82 100644
--- a/src/tools/android/java/com/google/devtools/build/android/Aapt2ResourcePackagingAction.java
+++ b/src/tools/android/java/com/google/devtools/build/android/Aapt2ResourcePackagingAction.java
@@ -28,6 +28,7 @@
import com.google.devtools.build.android.aapt2.ResourceLinker;
import com.google.devtools.build.android.aapt2.StaticLibrary;
import com.google.devtools.common.options.OptionsParser;
+import com.google.devtools.common.options.ShellQuotedParamsFilePreProcessor;
import java.io.Closeable;
import java.io.IOException;
import java.nio.file.FileSystems;
@@ -71,7 +72,8 @@
Profiler profiler = LoggingProfiler.createAndStart("setup");
OptionsParser optionsParser =
OptionsParser.newOptionsParser(Options.class, Aapt2ConfigOptions.class);
- optionsParser.enableParamsFileSupport(FileSystems.getDefault());
+ optionsParser.enableParamsFileSupport(
+ new ShellQuotedParamsFilePreProcessor(FileSystems.getDefault()));
optionsParser.parseAndExitUponError(args);
aaptConfigOptions = optionsParser.getOptions(Aapt2ConfigOptions.class);
options = optionsParser.getOptions(Options.class);
diff --git a/src/tools/android/java/com/google/devtools/build/android/Aapt2ResourceShrinkingAction.java b/src/tools/android/java/com/google/devtools/build/android/Aapt2ResourceShrinkingAction.java
index 2fbae70..fa06ec7f 100644
--- a/src/tools/android/java/com/google/devtools/build/android/Aapt2ResourceShrinkingAction.java
+++ b/src/tools/android/java/com/google/devtools/build/android/Aapt2ResourceShrinkingAction.java
@@ -26,8 +26,10 @@
import com.google.devtools.build.android.aapt2.ResourceLinker;
import com.google.devtools.build.android.aapt2.StaticLibrary;
import com.google.devtools.common.options.OptionsParser;
+import com.google.devtools.common.options.ShellQuotedParamsFilePreProcessor;
import java.io.Closeable;
import java.io.File;
+import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.util.concurrent.ExecutionException;
import java.util.function.Function;
@@ -57,6 +59,8 @@
// Parse arguments.
OptionsParser optionsParser =
OptionsParser.newOptionsParser(Options.class, Aapt2ConfigOptions.class);
+ optionsParser.enableParamsFileSupport(
+ new ShellQuotedParamsFilePreProcessor(FileSystems.getDefault()));
optionsParser.parseAndExitUponError(args);
Aapt2ConfigOptions aapt2ConfigOptions = optionsParser.getOptions(Aapt2ConfigOptions.class);
Options options = optionsParser.getOptions(Options.class);
diff --git a/src/tools/android/java/com/google/devtools/build/android/AarGeneratorAction.java b/src/tools/android/java/com/google/devtools/build/android/AarGeneratorAction.java
index 62ad8fe..6e57cc5 100644
--- a/src/tools/android/java/com/google/devtools/build/android/AarGeneratorAction.java
+++ b/src/tools/android/java/com/google/devtools/build/android/AarGeneratorAction.java
@@ -27,11 +27,13 @@
import com.google.devtools.common.options.Option;
import com.google.devtools.common.options.OptionDocumentationCategory;
import com.google.devtools.common.options.OptionEffectTag;
-import com.google.devtools.common.options.Options;
import com.google.devtools.common.options.OptionsBase;
+import com.google.devtools.common.options.OptionsParser;
+import com.google.devtools.common.options.ShellQuotedParamsFilePreProcessor;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.IOException;
+import java.nio.file.FileSystems;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -137,9 +139,11 @@
public static void main(String[] args) {
Stopwatch timer = Stopwatch.createStarted();
- AarGeneratorOptions options =
- Options.parseAndExitUponError(AarGeneratorOptions.class, /*allowResidue=*/ true, args)
- .getOptions();
+ OptionsParser optionsParser = OptionsParser.newOptionsParser(AarGeneratorOptions.class);
+ optionsParser.enableParamsFileSupport(
+ new ShellQuotedParamsFilePreProcessor(FileSystems.getDefault()));
+ optionsParser.parseAndExitUponError(args);
+ AarGeneratorOptions options = optionsParser.getOptions(AarGeneratorOptions.class);
checkFlags(options);
diff --git a/src/tools/android/java/com/google/devtools/build/android/AndroidResourceMergingAction.java b/src/tools/android/java/com/google/devtools/build/android/AndroidResourceMergingAction.java
index 78393dc..454f056 100644
--- a/src/tools/android/java/com/google/devtools/build/android/AndroidResourceMergingAction.java
+++ b/src/tools/android/java/com/google/devtools/build/android/AndroidResourceMergingAction.java
@@ -34,6 +34,7 @@
import com.google.devtools.common.options.OptionEffectTag;
import com.google.devtools.common.options.OptionsBase;
import com.google.devtools.common.options.OptionsParser;
+import com.google.devtools.common.options.ShellQuotedParamsFilePreProcessor;
import java.io.File;
import java.io.IOException;
import java.nio.file.FileSystems;
@@ -196,7 +197,8 @@
final Stopwatch timer = Stopwatch.createStarted();
OptionsParser optionsParser =
OptionsParser.newOptionsParser(Options.class, AaptConfigOptions.class);
- optionsParser.enableParamsFileSupport(FileSystems.getDefault());
+ optionsParser.enableParamsFileSupport(
+ new ShellQuotedParamsFilePreProcessor(FileSystems.getDefault()));
optionsParser.parseAndExitUponError(args);
AaptConfigOptions aaptConfigOptions = optionsParser.getOptions(AaptConfigOptions.class);
Options options = optionsParser.getOptions(Options.class);
diff --git a/src/tools/android/java/com/google/devtools/build/android/AndroidResourceParsingAction.java b/src/tools/android/java/com/google/devtools/build/android/AndroidResourceParsingAction.java
index 1cb366f..9b72728 100644
--- a/src/tools/android/java/com/google/devtools/build/android/AndroidResourceParsingAction.java
+++ b/src/tools/android/java/com/google/devtools/build/android/AndroidResourceParsingAction.java
@@ -23,6 +23,7 @@
import com.google.devtools.common.options.OptionEffectTag;
import com.google.devtools.common.options.OptionsBase;
import com.google.devtools.common.options.OptionsParser;
+import com.google.devtools.common.options.ShellQuotedParamsFilePreProcessor;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.util.concurrent.TimeUnit;
@@ -71,7 +72,8 @@
public static void main(String[] args) throws Exception {
OptionsParser optionsParser = OptionsParser.newOptionsParser(Options.class);
- optionsParser.enableParamsFileSupport(FileSystems.getDefault());
+ optionsParser.enableParamsFileSupport(
+ new ShellQuotedParamsFilePreProcessor(FileSystems.getDefault()));
optionsParser.parseAndExitUponError(args);
Options options = optionsParser.getOptions(Options.class);
diff --git a/src/tools/android/java/com/google/devtools/build/android/AndroidResourceProcessingAction.java b/src/tools/android/java/com/google/devtools/build/android/AndroidResourceProcessingAction.java
index 4ec9ebc..d492acb 100644
--- a/src/tools/android/java/com/google/devtools/build/android/AndroidResourceProcessingAction.java
+++ b/src/tools/android/java/com/google/devtools/build/android/AndroidResourceProcessingAction.java
@@ -43,6 +43,7 @@
import com.google.devtools.common.options.OptionEffectTag;
import com.google.devtools.common.options.OptionsBase;
import com.google.devtools.common.options.OptionsParser;
+import com.google.devtools.common.options.ShellQuotedParamsFilePreProcessor;
import com.google.devtools.common.options.TriState;
import java.io.IOException;
import java.io.InputStream;
@@ -354,7 +355,8 @@
final Stopwatch timer = Stopwatch.createStarted();
OptionsParser optionsParser = OptionsParser.newOptionsParser(
Options.class, AaptConfigOptions.class);
- optionsParser.enableParamsFileSupport(FileSystems.getDefault());
+ optionsParser.enableParamsFileSupport(
+ new ShellQuotedParamsFilePreProcessor(FileSystems.getDefault()));
optionsParser.parseAndExitUponError(args);
aaptConfigOptions = optionsParser.getOptions(AaptConfigOptions.class);
options = optionsParser.getOptions(Options.class);
diff --git a/src/tools/android/java/com/google/devtools/build/android/AndroidResourceValidatorAction.java b/src/tools/android/java/com/google/devtools/build/android/AndroidResourceValidatorAction.java
index 616eeb2..1ea0df1 100644
--- a/src/tools/android/java/com/google/devtools/build/android/AndroidResourceValidatorAction.java
+++ b/src/tools/android/java/com/google/devtools/build/android/AndroidResourceValidatorAction.java
@@ -27,6 +27,7 @@
import com.google.devtools.common.options.OptionEffectTag;
import com.google.devtools.common.options.OptionsBase;
import com.google.devtools.common.options.OptionsParser;
+import com.google.devtools.common.options.ShellQuotedParamsFilePreProcessor;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.IOException;
@@ -124,7 +125,8 @@
final Stopwatch timer = Stopwatch.createStarted();
OptionsParser optionsParser =
OptionsParser.newOptionsParser(Options.class, AaptConfigOptions.class);
- optionsParser.enableParamsFileSupport(FileSystems.getDefault());
+ optionsParser.enableParamsFileSupport(
+ new ShellQuotedParamsFilePreProcessor(FileSystems.getDefault()));
optionsParser.parseAndExitUponError(args);
AaptConfigOptions aaptConfigOptions = optionsParser.getOptions(AaptConfigOptions.class);
Options options = optionsParser.getOptions(Options.class);
diff --git a/src/tools/android/java/com/google/devtools/build/android/CompileLibraryResourcesAction.java b/src/tools/android/java/com/google/devtools/build/android/CompileLibraryResourcesAction.java
index 7c19745..3c91517 100644
--- a/src/tools/android/java/com/google/devtools/build/android/CompileLibraryResourcesAction.java
+++ b/src/tools/android/java/com/google/devtools/build/android/CompileLibraryResourcesAction.java
@@ -27,6 +27,7 @@
import com.google.devtools.common.options.OptionEffectTag;
import com.google.devtools.common.options.OptionsBase;
import com.google.devtools.common.options.OptionsParser;
+import com.google.devtools.common.options.ShellQuotedParamsFilePreProcessor;
import java.io.Closeable;
import java.nio.file.FileSystems;
import java.nio.file.Files;
@@ -125,7 +126,8 @@
public static void main(String[] args) throws Exception {
OptionsParser optionsParser = OptionsParser.newOptionsParser(Options.class);
- optionsParser.enableParamsFileSupport(FileSystems.getDefault());
+ optionsParser.enableParamsFileSupport(
+ new ShellQuotedParamsFilePreProcessor(FileSystems.getDefault()));
optionsParser.parseAndExitUponError(args);
Options options = optionsParser.getOptions(Options.class);
diff --git a/src/tools/android/java/com/google/devtools/build/android/GenerateRobolectricResourceSymbolsAction.java b/src/tools/android/java/com/google/devtools/build/android/GenerateRobolectricResourceSymbolsAction.java
index 2be63b0..3cd3d9c 100644
--- a/src/tools/android/java/com/google/devtools/build/android/GenerateRobolectricResourceSymbolsAction.java
+++ b/src/tools/android/java/com/google/devtools/build/android/GenerateRobolectricResourceSymbolsAction.java
@@ -30,6 +30,7 @@
import com.google.devtools.common.options.OptionEffectTag;
import com.google.devtools.common.options.OptionsBase;
import com.google.devtools.common.options.OptionsParser;
+import com.google.devtools.common.options.ShellQuotedParamsFilePreProcessor;
import java.io.Closeable;
import java.nio.file.FileSystems;
import java.nio.file.Files;
@@ -112,7 +113,8 @@
final Stopwatch timer = Stopwatch.createStarted();
OptionsParser optionsParser =
OptionsParser.newOptionsParser(Options.class, AaptConfigOptions.class);
- optionsParser.enableParamsFileSupport(FileSystems.getDefault());
+ optionsParser.enableParamsFileSupport(
+ new ShellQuotedParamsFilePreProcessor(FileSystems.getDefault()));
optionsParser.parseAndExitUponError(args);
AaptConfigOptions aaptConfigOptions = optionsParser.getOptions(AaptConfigOptions.class);
Options options = optionsParser.getOptions(Options.class);
diff --git a/src/tools/android/java/com/google/devtools/build/android/LibraryRClassGeneratorAction.java b/src/tools/android/java/com/google/devtools/build/android/LibraryRClassGeneratorAction.java
index fef8a94..9adc2fa 100644
--- a/src/tools/android/java/com/google/devtools/build/android/LibraryRClassGeneratorAction.java
+++ b/src/tools/android/java/com/google/devtools/build/android/LibraryRClassGeneratorAction.java
@@ -25,6 +25,7 @@
import com.google.devtools.common.options.OptionMetadataTag;
import com.google.devtools.common.options.OptionsBase;
import com.google.devtools.common.options.OptionsParser;
+import com.google.devtools.common.options.ShellQuotedParamsFilePreProcessor;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Path;
@@ -101,7 +102,8 @@
final Stopwatch timer = Stopwatch.createStarted();
OptionsParser optionsParser =
OptionsParser.newOptionsParser(Options.class, AaptConfigOptions.class);
- optionsParser.enableParamsFileSupport(FileSystems.getDefault());
+ optionsParser.enableParamsFileSupport(
+ new ShellQuotedParamsFilePreProcessor(FileSystems.getDefault()));
optionsParser.parseAndExitUponError(args);
AaptConfigOptions aaptConfigOptions = optionsParser.getOptions(AaptConfigOptions.class);
Options options = optionsParser.getOptions(Options.class);
diff --git a/src/tools/android/java/com/google/devtools/build/android/ManifestMergerAction.java b/src/tools/android/java/com/google/devtools/build/android/ManifestMergerAction.java
index 9a75d65..e7a3ac6 100644
--- a/src/tools/android/java/com/google/devtools/build/android/ManifestMergerAction.java
+++ b/src/tools/android/java/com/google/devtools/build/android/ManifestMergerAction.java
@@ -28,6 +28,7 @@
import com.google.devtools.common.options.OptionEffectTag;
import com.google.devtools.common.options.OptionsBase;
import com.google.devtools.common.options.OptionsParser;
+import com.google.devtools.common.options.ShellQuotedParamsFilePreProcessor;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
@@ -185,7 +186,8 @@
public static void main(String[] args) throws Exception {
OptionsParser optionsParser = OptionsParser.newOptionsParser(Options.class);
- optionsParser.enableParamsFileSupport(FileSystems.getDefault());
+ optionsParser.enableParamsFileSupport(
+ new ShellQuotedParamsFilePreProcessor(FileSystems.getDefault()));
optionsParser.parseAndExitUponError(args);
options = optionsParser.getOptions(Options.class);
diff --git a/src/tools/android/java/com/google/devtools/build/android/RClassGeneratorAction.java b/src/tools/android/java/com/google/devtools/build/android/RClassGeneratorAction.java
index daab1f4..3cf3a9d 100644
--- a/src/tools/android/java/com/google/devtools/build/android/RClassGeneratorAction.java
+++ b/src/tools/android/java/com/google/devtools/build/android/RClassGeneratorAction.java
@@ -30,6 +30,7 @@
import com.google.devtools.common.options.OptionMetadataTag;
import com.google.devtools.common.options.OptionsBase;
import com.google.devtools.common.options.OptionsParser;
+import com.google.devtools.common.options.ShellQuotedParamsFilePreProcessor;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -144,7 +145,8 @@
public static void main(String[] args) throws Exception {
final Stopwatch timer = Stopwatch.createStarted();
OptionsParser optionsParser = OptionsParser.newOptionsParser(Options.class);
- optionsParser.enableParamsFileSupport(FileSystems.getDefault());
+ optionsParser.enableParamsFileSupport(
+ new ShellQuotedParamsFilePreProcessor(FileSystems.getDefault()));
optionsParser.parseAndExitUponError(args);
Options options = optionsParser.getOptions(Options.class);
Preconditions.checkNotNull(options.classJarOutput);
diff --git a/src/tools/android/java/com/google/devtools/build/android/ResourceProcessorBusyBox.java b/src/tools/android/java/com/google/devtools/build/android/ResourceProcessorBusyBox.java
index 3175999..40de32f 100644
--- a/src/tools/android/java/com/google/devtools/build/android/ResourceProcessorBusyBox.java
+++ b/src/tools/android/java/com/google/devtools/build/android/ResourceProcessorBusyBox.java
@@ -20,6 +20,7 @@
import com.google.devtools.common.options.OptionEffectTag;
import com.google.devtools.common.options.OptionsBase;
import com.google.devtools.common.options.OptionsParser;
+import com.google.devtools.common.options.ShellQuotedParamsFilePreProcessor;
import java.nio.file.FileSystems;
/**
@@ -166,7 +167,8 @@
public static void main(String[] args) throws Exception {
OptionsParser optionsParser = OptionsParser.newOptionsParser(Options.class);
optionsParser.setAllowResidue(true);
- optionsParser.enableParamsFileSupport(FileSystems.getDefault());
+ optionsParser.enableParamsFileSupport(
+ new ShellQuotedParamsFilePreProcessor(FileSystems.getDefault()));
optionsParser.parse(args);
Options options = optionsParser.getOptions(Options.class);
options.tool.call(optionsParser.getResidue().toArray(new String[0]));
diff --git a/src/tools/android/java/com/google/devtools/build/android/ResourceShrinkerAction.java b/src/tools/android/java/com/google/devtools/build/android/ResourceShrinkerAction.java
index 8e0a599..ff38cac 100644
--- a/src/tools/android/java/com/google/devtools/build/android/ResourceShrinkerAction.java
+++ b/src/tools/android/java/com/google/devtools/build/android/ResourceShrinkerAction.java
@@ -35,9 +35,11 @@
import com.google.devtools.common.options.OptionMetadataTag;
import com.google.devtools.common.options.OptionsBase;
import com.google.devtools.common.options.OptionsParser;
+import com.google.devtools.common.options.ShellQuotedParamsFilePreProcessor;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.HashSet;
@@ -251,6 +253,8 @@
// Parse arguments.
OptionsParser optionsParser = OptionsParser.newOptionsParser(
Options.class, AaptConfigOptions.class);
+ optionsParser.enableParamsFileSupport(
+ new ShellQuotedParamsFilePreProcessor(FileSystems.getDefault()));
optionsParser.parseAndExitUponError(args);
aaptConfigOptions = optionsParser.getOptions(AaptConfigOptions.class);
options = optionsParser.getOptions(Options.class);
diff --git a/src/tools/android/java/com/google/devtools/build/android/ValidateAndLinkResourcesAction.java b/src/tools/android/java/com/google/devtools/build/android/ValidateAndLinkResourcesAction.java
index b572dd5..31f7741 100644
--- a/src/tools/android/java/com/google/devtools/build/android/ValidateAndLinkResourcesAction.java
+++ b/src/tools/android/java/com/google/devtools/build/android/ValidateAndLinkResourcesAction.java
@@ -24,6 +24,7 @@
import com.google.devtools.common.options.OptionEffectTag;
import com.google.devtools.common.options.OptionsBase;
import com.google.devtools.common.options.OptionsParser;
+import com.google.devtools.common.options.ShellQuotedParamsFilePreProcessor;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.util.List;
@@ -158,7 +159,8 @@
public static void main(String[] args) throws Exception {
final OptionsParser optionsParser =
OptionsParser.newOptionsParser(Options.class, Aapt2ConfigOptions.class);
- optionsParser.enableParamsFileSupport(FileSystems.getDefault());
+ optionsParser.enableParamsFileSupport(
+ new ShellQuotedParamsFilePreProcessor(FileSystems.getDefault()));
optionsParser.parse(args);
Options options = optionsParser.getOptions(Options.class);