本文整理汇总了Java中com.google.javascript.jscomp.DiagnosticGroup类的典型用法代码示例。如果您正苦于以下问题:Java DiagnosticGroup类的具体用法?Java DiagnosticGroup怎么用?Java DiagnosticGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DiagnosticGroup类属于com.google.javascript.jscomp包,在下文中一共展示了DiagnosticGroup类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: build
import com.google.javascript.jscomp.DiagnosticGroup; //导入依赖的package包/类
public static String build(Task task, List<File> inputs) {
List<SourceFile> externs;
try {
externs = CommandLineRunner.getDefaultExterns();
} catch (IOException e) {
throw new BuildException(e);
}
List<SourceFile> jsInputs = new ArrayList<SourceFile>();
for (File f : inputs) {
jsInputs.add(SourceFile.fromFile(f));
}
CompilerOptions options = new CompilerOptions();
CompilationLevel.ADVANCED_OPTIMIZATIONS
.setOptionsForCompilationLevel(options);
WarningLevel.VERBOSE.setOptionsForWarningLevel(options);
for (DiagnosticGroup dg : diagnosticGroups) {
options.setWarningLevel(dg, CheckLevel.ERROR);
}
options.setCodingConvention(new GoogleCodingConvention());
Compiler compiler = new Compiler();
MessageFormatter formatter =
options.errorFormat.toFormatter(compiler, false);
AntErrorManager errorManager = new AntErrorManager(formatter, task);
compiler.setErrorManager(errorManager);
Result r = compiler.compile(externs, jsInputs, options);
if (!r.success) {
return null;
}
String wrapped = "(function(){" + compiler.toSource() + "})();\n";
return wrapped;
}
开发者ID:google,项目名称:caja,代码行数:38,代码来源:ClosureCompiler.java
示例2: createCompilerOptions
import com.google.javascript.jscomp.DiagnosticGroup; //导入依赖的package包/类
private CompilerOptions createCompilerOptions() {
CompilerOptions options = new CompilerOptions();
this.compilationLevel.setOptionsForCompilationLevel(options);
if (this.debugOptions) {
this.compilationLevel.setDebugOptionsForCompilationLevel(options);
}
options.prettyPrint = this.prettyPrint;
options.printInputDelimiter = this.printInputDelimiter;
options.generateExports = this.generateExports;
options.setLanguageIn(this.languageIn);
this.warningLevel.setOptionsForWarningLevel(options);
options.setManageClosureDependencies(manageDependencies);
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);
}
return options;
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:37,代码来源:CompileTask.java
示例3: setWarningLevel
import com.google.javascript.jscomp.DiagnosticGroup; //导入依赖的package包/类
public void setWarningLevel(DiagnosticGroup type, CheckLevel level) {
compilerOptions.setWarningLevel(type, level);
}
开发者ID:GeoDienstenCentrum,项目名称:closure-compiler-maven-plugin,代码行数:4,代码来源:CompilerOptionsMojo.java
示例4: createCompilerOptions
import com.google.javascript.jscomp.DiagnosticGroup; //导入依赖的package包/类
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;
}
开发者ID:google,项目名称:closure-compiler,代码行数:64,代码来源:CompileTask.java
示例5: createCompilerOptions
import com.google.javascript.jscomp.DiagnosticGroup; //导入依赖的package包/类
private CompilerOptions createCompilerOptions() {
CompilerOptions options = new CompilerOptions();
this.compilationLevel.setOptionsForCompilationLevel(options);
if (this.debugOptions) {
this.compilationLevel.setDebugOptionsForCompilationLevel(options);
}
options.prettyPrint = this.prettyPrint;
options.printInputDelimiter = this.printInputDelimiter;
options.generateExports = this.generateExports;
options.setLanguageIn(this.languageIn);
options.setOutputCharset(this.outputEncoding);
this.warningLevel.setOptionsForWarningLevel(options);
options.setManageClosureDependencies(manageDependencies);
convertEntryPointParameters(options);
options.setTrustedStrings(true);
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.sourceMapFormat = Format.valueOf(sourceMapFormat);
}
if (sourceMapOutputFile != null) {
File parentFile = sourceMapOutputFile.getParentFile();
if (parentFile.mkdirs()) {
log("Created missing parent directory " + parentFile, Project.MSG_DEBUG);
}
options.sourceMapOutputPath = parentFile.getAbsolutePath();
}
return options;
}
开发者ID:nicks,项目名称:closure-compiler-old,代码行数:51,代码来源:CompileTask.java
示例6: visit
import com.google.javascript.jscomp.DiagnosticGroup; //导入依赖的package包/类
@Override
public void visit(Warning n, Object ctx) throws Exception {
super.visit(n, ctx);
if (n.getSeverity() != null && n.getType() != null) {
switch (n.getType()) {
case AGGRESSIVE_VAR_CHECK:
jsOptions
.setAggressiveVarCheck(mapSeverityType(n.getSeverity()));
break;
case BROKEN_REQUIRES_LEVEL:
jsOptions.setBrokenClosureRequiresLevel(mapSeverityType(n
.getSeverity()));
break;
case CHECK_GLOBAL_NAMES_LEVEL:
jsOptions.setCheckGlobalNamesLevel(mapSeverityType(n
.getSeverity()));
break;
case CHECK_GLOBAL_THIS_LEVEL:
jsOptions.setCheckGlobalThisLevel(mapSeverityType(n
.getSeverity()));
break;
// case CHECK_MISSING_GET_CSS_NAME_LEVEL:
// jsOptions.setCheckMissingGetCssNameLevel(mapSeverityType(n
// .getSeverity()));
// break;
case CHECK_MISSING_RETURN:
jsOptions
.setCheckMissingReturn(mapSeverityType(n.getSeverity()));
break;
case CHECK_REQUIRES:
jsOptions.setWarningLevel(
DiagnosticGroups.MISSING_REQUIRE,
mapSeverityType(n.getSeverity()));
break;
// case CHECK_UNREACHABLE_CODE:
// jsOptions.setCheckUnreachableCode(mapSeverityType(n
// .getSeverity()));
// break;
case REPORT_MISSING_OVERRIDE:
jsOptions.setReportMissingOverride(mapSeverityType(n
.getSeverity()));
break;
default:
DiagnosticGroup group = mapWarningType(n.getType());
CheckLevel level = mapSeverityType(n.getSeverity());
if (group != null && level != null) {
jsOptions.setWarningLevel(group, level);
}
break;
}
}
if (n.getSeverity() != null) {
n.getSeverity().accept(this, ctx);
}
if (n.getType() != null) {
n.getType().accept(this, ctx);
}
}
开发者ID:DigiArea,项目名称:closurefx-builder,代码行数:60,代码来源:Closurer.java
示例7: createCompilerOptions
import com.google.javascript.jscomp.DiagnosticGroup; //导入依赖的package包/类
private CompilerOptions createCompilerOptions() {
CompilerOptions options = new CompilerOptions();
this.compilationLevel.setOptionsForCompilationLevel(options);
if (this.debugOptions) {
this.compilationLevel.setDebugOptionsForCompilationLevel(options);
}
options.prettyPrint = this.prettyPrint;
options.printInputDelimiter = this.printInputDelimiter;
options.generateExports = this.generateExports;
options.setLanguageIn(this.languageIn);
this.warningLevel.setOptionsForWarningLevel(options);
options.setManageClosureDependencies(manageDependencies);
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.sourceMapFormat = Format.valueOf(sourceMapFormat);
}
if (sourceMapOutputFile != null) {
File parentFile = sourceMapOutputFile.getParentFile();
if (parentFile.mkdirs()) {
log("Created missing parent directory " + parentFile, Project.MSG_DEBUG);
}
options.sourceMapOutputPath = parentFile.getAbsolutePath();
}
return options;
}
开发者ID:Robbert,项目名称:closure-compiler-copy,代码行数:48,代码来源:CompileTask.java
注:本文中的com.google.javascript.jscomp.DiagnosticGroup类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论