com.google.javascript.jscomp.WarningLevel Java Examples
The following examples show how to use
com.google.javascript.jscomp.WarningLevel.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CompileTask.java From astor with GNU General Public License v2.0 | 8 votes |
public CompileTask() { this.languageIn = CompilerOptions.LanguageMode.ECMASCRIPT3; this.warningLevel = WarningLevel.DEFAULT; this.debugOptions = false; this.compilationLevel = CompilationLevel.SIMPLE_OPTIMIZATIONS; this.customExternsOnly = false; this.manageDependencies = false; this.prettyPrint = false; this.printInputDelimiter = false; this.generateExports = false; this.replaceProperties = false; this.forceRecompile = false; this.replacePropertiesPrefix = "closure.define."; this.defineParams = Lists.newLinkedList(); this.externFileLists = Lists.newLinkedList(); this.sourceFileLists = Lists.newLinkedList(); this.sourcePaths = Lists.newLinkedList(); this.warnings = Lists.newLinkedList(); }
Example #2
Source File: ClosureCompiler.java From caja with Apache License 2.0 | 5 votes |
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; }
Example #3
Source File: CompileTask.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Set the warning level. * @param value The warning level by string name. (default, quiet, verbose). */ public void setWarning(String value) { if ("default".equalsIgnoreCase(value)) { this.warningLevel = WarningLevel.DEFAULT; } else if ("quiet".equalsIgnoreCase(value)) { this.warningLevel = WarningLevel.QUIET; } else if ("verbose".equalsIgnoreCase(value)) { this.warningLevel = WarningLevel.VERBOSE; } else { throw new BuildException( "Unrecognized 'warning' option value (" + value + ")"); } }
Example #4
Source File: ClosureJavaScriptCompressor.java From htmlcompressor with Apache License 2.0 | 2 votes |
/** * Returns <code>WarningLevel</code> used by the Closure compiler * * @return <code>WarningLevel</code> used by the Closure compiler */ public WarningLevel getWarningLevel() { return warningLevel; }
Example #5
Source File: ClosureJavaScriptCompressor.java From htmlcompressor with Apache License 2.0 | 2 votes |
/** * Indicates the amount of information you want from the compiler about possible problems in your code. * * @param warningLevel <code>WarningLevel</code> to use * * @see <a href="http://code.google.com/closure/compiler/docs/api-ref.html"> */ public void setWarningLevel(WarningLevel warningLevel) { this.warningLevel = warningLevel; }