diff options
author | ccalvarin <ccalvarin@google.com> | 2017-08-18 16:21:32 +0200 |
---|---|---|
committer | Damien Martin-Guillerez <dmarting@google.com> | 2017-08-21 14:15:42 +0200 |
commit | 74a8c3e529f0c3ec9ab02db684e9d0ec4f71bf64 (patch) | |
tree | 0d9061d2b81e04724c55f22e74d2826c15d7a4df /src/tools/android/java/com/google/devtools/build/android/AarGeneratorAction.java | |
parent | e6d2077cab9eef14afc25e54ab6b0e583e0b3bf0 (diff) |
Switch android tools' use of options parser to a more concise form for the single options-base case.
This is to prepare the options parser from making options parser creation exceptions a caught exception. Since all of these classes already have a single options class and used parseAndExitUponError, this allows us to keep behavior consistent between the malformed options-base errors and the incorrect user-input errors.
All the other uses of the options parser in //src/tools already throw sufficiently broad exceptions to not need this.
RELNOTES: None
PiperOrigin-RevId: 165702786
Diffstat (limited to 'src/tools/android/java/com/google/devtools/build/android/AarGeneratorAction.java')
-rw-r--r-- | src/tools/android/java/com/google/devtools/build/android/AarGeneratorAction.java | 12 |
1 files changed, 6 insertions, 6 deletions
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 f074a0cd16..62ad8fe166 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,8 +27,8 @@ import com.google.devtools.build.android.Converters.UnvalidatedAndroidDataConver 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 java.io.BufferedOutputStream; import java.io.File; import java.io.IOException; @@ -67,7 +67,7 @@ public class AarGeneratorAction { private static final Logger logger = Logger.getLogger(AarGeneratorAction.class.getName()); /** Flag specifications for this action. */ - public static final class Options extends OptionsBase { + public static final class AarGeneratorOptions extends OptionsBase { @Option( name = "mainData", defaultValue = "null", @@ -137,9 +137,9 @@ public class AarGeneratorAction { public static void main(String[] args) { Stopwatch timer = Stopwatch.createStarted(); - OptionsParser optionsParser = OptionsParser.newOptionsParser(Options.class); - optionsParser.parseAndExitUponError(args); - Options options = optionsParser.getOptions(Options.class); + AarGeneratorOptions options = + Options.parseAndExitUponError(AarGeneratorOptions.class, /*allowResidue=*/ true, args) + .getOptions(); checkFlags(options); @@ -181,7 +181,7 @@ public class AarGeneratorAction { } @VisibleForTesting - static void checkFlags(Options options) throws IllegalArgumentException { + static void checkFlags(AarGeneratorOptions options) { List<String> nullFlags = new LinkedList<>(); if (options.manifest == null) { nullFlags.add("manifest"); |