Skip to content

Commit

Permalink
Add an option to create a jar file containing the index file
Browse files Browse the repository at this point in the history
  • Loading branch information
goldmann authored and n1hility committed Apr 3, 2013
1 parent cdf950c commit 7748fdf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/org/jboss/jandex/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class Main {
private boolean modify;
private boolean verbose;
private boolean dump;
private boolean jarFile;
private File outputFile;
private File source;

Expand Down Expand Up @@ -68,7 +69,7 @@ private void execute(String[] args) {

long start = System.currentTimeMillis();
Indexer indexer = new Indexer();
Result result = (source.isDirectory()) ? indexDirectory(source, indexer) : JarIndexer.createJarIndex(source, indexer,modify,false,verbose);
Result result = (source.isDirectory()) ? indexDirectory(source, indexer) : JarIndexer.createJarIndex(source, indexer,modify,jarFile,verbose);
double time = (System.currentTimeMillis() - start) / 1000.00;
System.out.printf("Wrote %s in %.4f seconds (%d classes, %d annotations, %d instances, %d bytes)\n", result.getName(), time, result.getClasses(), result.getAnnotations(), result.getInstances(), result.getBytes());
} catch (Exception e) {
Expand Down Expand Up @@ -166,6 +167,7 @@ private static void printUsage() {
System.out.println(" -v verbose output");
System.out.println(" -m modify directory or jar instead of creating an external index file");
System.out.println(" -o name the external index file file-name");
System.out.println(" -j export the index file to a jar file");
System.out.println(" -d dump the index file index-file-name");
System.out.println("\nThe default behavior, with no options specified, is to autogenerate an external index file");
}
Expand Down Expand Up @@ -200,6 +202,10 @@ private void parseOptions(String[] args) {
verbose = true;
optionCount++;
break;
case 'j':
jarFile = true;
optionCount++;
break;
case 'o':
if (i >= args.length)
throw new IllegalArgumentException("-o reuires an output file name");
Expand Down

0 comments on commit 7748fdf

Please sign in to comment.