use of com.google.javascript.jscomp.DiagnosticGroup in project closure-compiler by google.
the class CompileTask method createCompilerOptions.
private CompilerOptions createCompilerOptions() {
CompilerOptions options = new CompilerOptions();
this.compilationLevel.setOptionsForCompilationLevel(options);
if (this.debugOptions) {
this.compilationLevel.setDebugOptionsForCompilationLevel(options);
}
options.setEnvironment(this.environment);
options.setPrettyPrint(this.prettyPrint);
options.setPrintInputDelimiter(this.printInputDelimiter);
options.setPreferSingleQuotes(this.preferSingleQuotes);
options.setGenerateExports(this.generateExports);
options.setLanguageIn(this.languageIn);
options.setLanguageOut(this.languageOut);
options.setOutputCharset(this.outputEncoding);
this.warningLevel.setOptionsForWarningLevel(options);
options.setManageClosureDependencies(manageDependencies);
convertEntryPointParameters(options);
options.setTrustedStrings(true);
options.setAngularPass(angularPass);
if (replaceProperties) {
convertPropertiesMap(options);
}
convertDefineParameters(options);
for (Warning warning : warnings) {
CheckLevel level = warning.getLevel();
String groupName = warning.getGroup();
DiagnosticGroup group = new DiagnosticGroups().forName(groupName);
if (group == null) {
throw new BuildException("Unrecognized 'warning' option value (" + groupName + ")");
}
options.setWarningLevel(group, level);
}
if (!Strings.isNullOrEmpty(sourceMapFormat)) {
options.setSourceMapFormat(Format.valueOf(sourceMapFormat));
}
if (!Strings.isNullOrEmpty(sourceMapLocationMapping)) {
String[] tokens = sourceMapLocationMapping.split("\\|", -1);
LocationMapping lm = new LocationMapping(tokens[0], tokens[1]);
options.setSourceMapLocationMappings(Arrays.asList(lm));
}
options.setApplyInputSourceMaps(applyInputSourceMaps);
if (sourceMapOutputFile != null) {
File parentFile = sourceMapOutputFile.getParentFile();
if (parentFile.mkdirs()) {
log("Created missing parent directory " + parentFile, Project.MSG_DEBUG);
}
options.setSourceMapOutputPath(parentFile.getAbsolutePath());
}
return options;
}
Aggregations