//
// Setup the configuration data
CompilerConfiguration configuration = new CompilerConfiguration();
if( cli.hasOption("classpath") )
{
configuration.setClasspath( cli.getOptionValue("classpath") );
}
if( cli.hasOption('d') )
{
configuration.setTargetDirectory( cli.getOptionValue('d') );
}
if (cli.hasOption("encoding")) {
configuration.setSourceEncoding(cli.getOptionValue("encoding"));
}
displayStackTraceOnError = cli.hasOption('e');
// joint compilation parameters
jointCompilation = cli.hasOption('j');
if (jointCompilation) {
Map compilerOptions = new HashMap();
String[] opts = cli.getOptionValues("J");
compilerOptions.put("namedValues", opts);
opts = cli.getOptionValues("F");
compilerOptions.put("flags", opts);
configuration.setJointCompilationOptions(compilerOptions);
}
//
// Load the file name list
String[] filenames = cli.getArgs();
if( filenames.length == 0 )
{
displayHelp(options);
return;
}
int errors = checkFiles( filenames );
//
// Create and start the compiler
if( errors == 0 )
{
if (jointCompilation) {
File tmpDir = createTempDir();
configuration.getJointCompilationOptions().put("stubDir",tmpDir);
}
FileSystemCompiler compiler = new FileSystemCompiler(configuration);
compiler.compile( filenames );
}
}