summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Bierhoff <kmb@google.com>2017-03-14 01:32:06 +0000
committerColin Cross <ccross@android.com>2017-03-14 10:39:12 -0700
commit52f7c03d041742e9a5aa5a00e26a4ef0c7de2848 (patch)
tree2c45d6edb438b1c1b50b05f53f29cefd64ed1227
parent3aa5e88028c7d2cc5fe3cc916d356eafd0cb3482 (diff)
downloaddesugar-52f7c03d041742e9a5aa5a00e26a4ef0c7de2848.tar.gz
Clean up android desugar tool's flags a bit
-- PiperOrigin-RevId: 150019741 MOS_MIGRATED_REVID=150019741 GitOrigin-RevId: ecc2ab1b3195cabd22730272c237a59b42f2e967 Change-Id: I232b84336865b02369d10575d816d8053bee3371
-rw-r--r--java/com/google/devtools/build/android/desugar/Desugar.java23
1 files changed, 12 insertions, 11 deletions
diff --git a/java/com/google/devtools/build/android/desugar/Desugar.java b/java/com/google/devtools/build/android/desugar/Desugar.java
index 21fd984..877d230 100644
--- a/java/com/google/devtools/build/android/desugar/Desugar.java
+++ b/java/com/google/devtools/build/android/desugar/Desugar.java
@@ -58,7 +58,7 @@ class Desugar {
category = "input",
converter = ExistingPathConverter.class,
abbrev = 'i',
- help = "Input Jar with classes to desugar."
+ help = "Input Jar with classes to desugar (required)."
)
public Path inputJar;
@@ -78,18 +78,15 @@ class Desugar {
defaultValue = "",
category = "input",
converter = ExistingPathConverter.class,
- help =
- "Bootclasspath that was used to compile the --input Jar with, like javac's "
- + "-bootclasspath flag. If no bootclasspath is explicitly given then the tool's own "
- + "bootclasspath is used."
+ help = "Bootclasspath that was used to compile the --input Jar with, like javac's "
+ + "-bootclasspath flag (required)."
)
public List<Path> bootclasspath;
@Option(
name = "allow_empty_bootclasspath",
defaultValue = "false",
- category = "misc",
- help = "Don't use the tool's bootclasspath if no bootclasspath is given."
+ category = "undocumented"
)
public boolean allowEmptyBootclasspath;
@@ -99,7 +96,7 @@ class Desugar {
category = "output",
converter = PathConverter.class,
abbrev = 'o',
- help = "Output Jar to write desugared classes into."
+ help = "Output Jar to write desugared classes into (required)."
)
public Path outputJar;
@@ -132,6 +129,7 @@ class Desugar {
name = "core_library",
defaultValue = "false",
category = "undocumented",
+ implicitRequirements = "--allow_empty_bootclasspath",
help = "Enables rewriting to desugar java.* classes."
)
public boolean coreLibrary;
@@ -155,16 +153,19 @@ class Desugar {
}
OptionsParser optionsParser = OptionsParser.newOptionsParser(Options.class);
+ optionsParser.setAllowResidue(false);
optionsParser.parseAndExitUponError(args);
Options options = optionsParser.getOptions(Options.class);
+ checkState(options.inputJar != null, "--input is required");
+ checkState(options.outputJar != null, "--output is required");
+ checkState(!options.bootclasspath.isEmpty() || options.allowEmptyBootclasspath,
+ "Bootclasspath required to desugar %s", options.inputJar);
+
if (options.verbose) {
System.out.printf("Lambda classes will be written under %s%n", dumpDirectory);
}
- checkState(!options.bootclasspath.isEmpty() || options.allowEmptyBootclasspath,
- "Bootclasspath required to desugar %s", options.inputJar);
-
CoreLibraryRewriter rewriter =
new CoreLibraryRewriter(options.coreLibrary ? "__desugar__/" : "");