summaryrefslogtreecommitdiffstats
path: root/jack
diff options
context:
space:
mode:
authorYohann Roussel <yroussel@google.com>2015-02-18 18:05:28 +0100
committerYohann Roussel <yroussel@google.com>2015-02-23 15:58:05 +0100
commitc6300f79c97f5cde80aaa0d7b6e349ed691a1e67 (patch)
treeed1359a11e5da0644d878fc0407d88acfa9a2b91 /jack
parentce88704011043a35a81d6cb8fe38e1c2577a2223 (diff)
downloadtoolchain_jack-c6300f79c97f5cde80aaa0d7b6e349ed691a1e67.tar.gz
toolchain_jack-c6300f79c97f5cde80aaa0d7b6e349ed691a1e67.tar.bz2
toolchain_jack-c6300f79c97f5cde80aaa0d7b6e349ed691a1e67.zip
Print command line help from Args4J
And get rid of help.txt Change-Id: I233ad6d7771223edd508a78dc3f5390f5ee14ceb
Diffstat (limited to 'jack')
-rw-r--r--jack/rsc/help.txt27
-rw-r--r--jack/src/com/android/jack/CommandLine.java25
-rw-r--r--jack/src/com/android/jack/Options.java70
3 files changed, 53 insertions, 69 deletions
diff --git a/jack/rsc/help.txt b/jack/rsc/help.txt
deleted file mode 100644
index 836c0b5f..00000000
--- a/jack/rsc/help.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-Usage: java -jar jack.jar <options> <source files>
-
-Options:
- -cp (--classpath) PATH : set classpath
- --import FILE : import the given file into the output (repeatable)
- --import-meta DIRECTORY
- : import the given directory into the output as meta-files
- (repeatable)
- --import-resource DIRECTORY
- : import the given directory into the output as resource files
- (repeatable)
- --output-dex DIRECTORY : output dex files and resources to the folder
- --output-jack FILE : output jack library file
- --config-jarjar FILE : use a jarjar rules file (default: none)
- --config-proguard FILE : use a proguard flags file (default: none) (repeatable)
- -g : emit debug infos
- --multi-dex [none | native | legacy]
- : whether to split code into multiple dex files
- (default: none)
- --help : display help
- --help-properties : display properties list
- --version : display version
- --verbose [error | warning | info | debug]
- : set verbosity (default: warning)
- -D <name>=<value> : set value for the given property (repeatable)
-
-@FILE : read command line from file
diff --git a/jack/src/com/android/jack/CommandLine.java b/jack/src/com/android/jack/CommandLine.java
index b7fff105..fe231140 100644
--- a/jack/src/com/android/jack/CommandLine.java
+++ b/jack/src/com/android/jack/CommandLine.java
@@ -31,10 +31,10 @@ import com.android.sched.util.config.category.DefaultCategory;
import com.android.sched.util.config.expression.BooleanExpression;
import com.android.sched.util.config.id.PropertyId;
import com.android.sched.util.log.LoggerFactory;
-import com.android.sched.util.stream.CharacterStreamSucker;
+
+import org.kohsuke.args4j.CmdLineParser;
import java.io.IOException;
-import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Collection;
@@ -151,22 +151,11 @@ public abstract class CommandLine {
}
protected static void printUsage(@Nonnull PrintStream printStream) {
- InputStream is = Main.class.getResourceAsStream("/help.txt");
- if (is == null) {
- throw new AssertionError();
- }
- CharacterStreamSucker css = new CharacterStreamSucker(is, printStream);
- try {
- css.suck();
- } catch (IOException e) {
- throw new AssertionError(e);
- } finally {
- try {
- is.close();
- } catch (IOException e) {
- // Ignore
- }
- }
+ CmdLineParser parser = new CmdLineParser(new Options());
+ printStream.println("Usage: <options> <source files>");
+ printStream.println();
+ printStream.println("Options:");
+ parser.printUsage(printStream);
}
public static void printHelpProperties (@Nonnull Options options) throws IOException {
diff --git a/jack/src/com/android/jack/Options.java b/jack/src/com/android/jack/Options.java
index 7028a8d7..3181d4c9 100644
--- a/jack/src/com/android/jack/Options.java
+++ b/jack/src/com/android/jack/Options.java
@@ -215,62 +215,80 @@ public class Options {
}
@Option(name = "--verbose", usage = "set verbosity (default: warning)",
- metaVar = "[error | warning | info | debug | trace]")
+ metaVar = "[error | warning | info | debug]")
protected VerbosityLevel verbose = VerbosityLevel.WARNING;
@Option(name = "--disable-automatic-full-rebuild")
protected boolean disableAutomaticFullRebuild = false;
- @Option(name = "--incremental-folder", usage = "Folder used for incremental data",
- metaVar = "FILE")
+ /**
+ * Folder used for incremental data.
+ */
+ @Option(name = "--incremental-folder", usage = "directory used for incremental data",
+ metaVar = "<DIRECTORY>")
protected File incrementalFolder = null;
- @Option(name = "--output-dex", usage = "output dex file(s) to this folder",
- metaVar = "DIRECTORY")
+ @Option(name = "--output-dex", usage = "output dex files and resources to the directory",
+ metaVar = "<DIRECTORY>")
protected File out = null;
- @Option(name = "--output-dex-zip", usage = "output to this zip file", metaVar = "FILE")
+ /**
+ * Output to this zip file.
+ */
+ @Option(name = "--output-dex-zip", metaVar = "<FILE>")
protected File outZip = null;
- @Option(name = "--output-jack-dir", usage = "output jack library to this folder",
- metaVar = "DIRECTORY")
+ /**
+ * Output jack library to this folder.
+ */
+ @Option(name = "--output-jack-dir",
+ metaVar = "<DIRECTORY>")
protected File libraryOutDir = null;
- @Option(name = "--output-jack", usage = "output jack library file", metaVar = "FILE")
+ @Option(name = "--output-jack", usage = "output jack library file", metaVar = "<FILE>")
protected File libraryOutZip = null;
- @Option(name = "--config-jarjar", usage = "use this jarjar rules file (default: none)",
- metaVar = "FILE")
+ @Option(name = "--config-jarjar", usage = "use a jarjar rules file (default: none)",
+ metaVar = "<FILE>")
protected File jarjarRulesFile = null;
@Option(name = "--import", usage = "import the given file into the output (repeatable)",
- metaVar = "FILE")
+ metaVar = "<FILE>")
protected List<File> importedLibraries = new ArrayList<File>();
@Option(name = "--import-resource",
usage = "import the given directory into the output as resource files (repeatable)",
- metaVar = "DIRECTORY")
+ metaVar = "<DIRECTORY>")
protected List<File> resImport = new ArrayList<File>();
@Option(name = "--import-meta",
usage = "import the given directory into the output as meta-files (repeatable)",
- metaVar = "DIRECTORY")
+ metaVar = "<DIRECTORY>")
protected List<File> metaImport = new ArrayList<File>();
- @Option(name = "--dx-legacy", usage = "keep generation close to dx (default: on)",
+ /**
+ * Keep generation close to dx.
+ */
+ @Option(name = "--dx-legacy",
handler = ExplicitBooleanOptionHandler.class, metaVar = "[on | off]")
protected boolean dxLegacy = true;
+ /**
+ * Keep generation compatible with older runtime.
+ */
@Option(name = "--runtime-legacy",
- usage = "keep generation compatible with older runtime (default: on)",
handler = ExplicitBooleanOptionHandler.class, metaVar = "[on | off]")
protected boolean runtimeLegacy = true;
- @Option(name = "--config-proguard", usage = "use these proguard flags file (default: none)",
- metaVar = "FILE")
+ @Option(name = "--config-proguard",
+ usage = "use a proguard flags file (default: none) (repeatable)",
+ metaVar = "<FILE>")
protected List<File> proguardFlagsFiles = null;
- @Option(name = "--sanity-checks", usage = "enable/disable compiler sanity checks (default: on)",
+ /**
+ * Enable/disable compiler sanity checks.
+ */
+ @Option(name = "--sanity-checks",
handler = ExplicitBooleanOptionHandler.class, metaVar = "[on | off]")
protected boolean sanityChecks = true;
@Nonnull
@@ -278,17 +296,21 @@ public class Options {
"jack.sanitychecks", "enable/disable compiler sanity checks")
.addDefaultValue(Boolean.TRUE);
- @Option(name = "--tracer-dir", usage = "enable tracer and output into this dir (.html)",
- metaVar = "DIRECTORY")
+ /**
+ * Enable tracer and output into this dir (.html).
+ */
+ @Option(name = "--tracer-dir",
+ metaVar = "<DIRECTORY>")
protected File tracerDir;
@Option(name = "--graph-file")
protected File graphFile;
- @Option(name = "-cp", aliases = "--classpath", usage = "classpath", metaVar = "PATH")
+ @Option(name = "-cp", aliases = "--classpath", usage = "set classpath", metaVar = "<PATH>")
protected String classpath = null;
- @Argument
+ // This is a trick to document @<FILE>, but it has no real link to ecjArguments
+ @Argument(usage = "read command line from file", metaVar = "@<FILE>")
protected List<String> ecjArguments;
@Nonnull
@@ -307,7 +329,7 @@ public class Options {
}
@Option(name = "--multi-dex",
- usage = "whether to split code into multiple dex (default: none)",
+ usage = "whether to split code into multiple dex files (default: none)",
metaVar = "[none | native | legacy]")
protected MultiDexKind multiDexKind = MultiDexKind.NONE;