} catch (ParseException e) {
printUsage(options);
return;
}
TeaVMTool tool = new TeaVMTool();
tool.setBytecodeLogging(commandLine.hasOption("logbytecode"));
if (commandLine.hasOption("d")) {
tool.setTargetDirectory(new File(commandLine.getOptionValue("d")));
}
if (commandLine.hasOption("f")) {
tool.setTargetFileName(commandLine.getOptionValue("f"));
}
if (commandLine.hasOption("m")) {
tool.setMinifying(true);
} else {
tool.setMinifying(false);
}
if (commandLine.hasOption("r")) {
switch (commandLine.getOptionValue("r")) {
case "separate":
tool.setRuntime(RuntimeCopyOperation.SEPARATE);
break;
case "merge":
tool.setRuntime(RuntimeCopyOperation.MERGED);
break;
case "none":
tool.setRuntime(RuntimeCopyOperation.NONE);
break;
default:
System.err.println("Wrong parameter for -r option specified");
printUsage(options);
return;
}
}
if (commandLine.hasOption("mainpage")) {
tool.setMainPageIncluded(true);
}
if (commandLine.hasOption('D')) {
tool.setDebugInformationGenerated(true);
}
if (commandLine.hasOption('S')) {
tool.setSourceMapsFileGenerated(true);
}
if (commandLine.hasOption('i')) {
tool.setIncremental(true);
}
if (commandLine.hasOption('c')) {
tool.setCacheDirectory(new File(commandLine.getOptionValue('c')));
} else {
tool.setCacheDirectory(new File(tool.getTargetDirectory(), "teavm-cache"));
}
args = commandLine.getArgs();
if (args.length > 1) {
System.err.println("Unexpected arguments");
printUsage(options);
return;
} else if (args.length == 1) {
tool.setMainClass(args[0]);
}
tool.setLog(new ConsoleTeaVMToolLog());
tool.getProperties().putAll(System.getProperties());
try {
tool.generate();
tool.checkForMissingItems();
} catch (Exception e) {
e.printStackTrace(System.err);
System.exit(-2);
}
}