private String compilationLevel = CompilationLevel.SIMPLE_OPTIMIZATIONS.toString();
public void compile(List<File> filesToCompile, String destFileName){
File destFile = prepareDestFile(destFileName);
Compiler compiler = new Compiler();
Result results = compiler.compile(getExterns(), getInputs(filesToCompile), getCompilerOptions());
logger.debug(results.debugLog);
for(JSError error : results.errors){
logger.error("Closure Minifier Error: " + error.sourceName + " Description: " + error.description);
}
for(JSError warning : results.warnings){
logger.info("Closure Minifier Warning: " + warning.sourceName + " Description: " + warning.description);
}
if (results.success) {
try {
Files.write(compiler.toSource(), destFile, Charsets.UTF_8);
} catch (IOException e) {
throw new ClosureException("Failed to write minified file to " + destFile, e);
}
}else{
throw new ClosureException("Closure Compiler Failed - See error messages on System.err");