本文整理汇总了Java中com.google.javascript.jscomp.MessageFormatter类的典型用法代码示例。如果您正苦于以下问题:Java MessageFormatter类的具体用法?Java MessageFormatter怎么用?Java MessageFormatter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessageFormatter类属于com.google.javascript.jscomp包,在下文中一共展示了MessageFormatter类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createCompiler
import com.google.javascript.jscomp.MessageFormatter; //导入依赖的package包/类
private Compiler createCompiler(CompilerOptions options) {
Compiler compiler = new Compiler();
MessageFormatter formatter =
options.errorFormat.toFormatter(compiler, false);
AntErrorManager errorManager = new AntErrorManager(formatter, this);
compiler.setErrorManager(errorManager);
return compiler;
}
开发者ID:andyjko,项目名称:feedlack,代码行数:9,代码来源:CompileTask.java
示例2: generateReport
import com.google.javascript.jscomp.MessageFormatter; //导入依赖的package包/类
@Override
public void generateReport() {
MessageFormatter formatter = new LightweightMessageFormatter(
Preconditions.checkNotNull(sourceExcerptProvider));
for (JSError error : errors) {
log.error(error.format(CheckLevel.ERROR, formatter));
}
for (JSError warning : warnings) {
log.warn(warning.format(CheckLevel.WARNING, formatter));
}
}
开发者ID:mikesamuel,项目名称:closure-maven-plugin,代码行数:12,代码来源:MavenLogJSErrorManager.java
示例3: build
import com.google.javascript.jscomp.MessageFormatter; //导入依赖的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
示例4: createCompiler
import com.google.javascript.jscomp.MessageFormatter; //导入依赖的package包/类
private Compiler createCompiler(CompilerOptions options) {
Compiler compiler = new Compiler();
MessageFormatter formatter =
options.getErrorFormat().toFormatter(compiler, false);
AntErrorManager errorManager = new AntErrorManager(formatter, this);
compiler.setErrorManager(errorManager);
return compiler;
}
开发者ID:google,项目名称:closure-compiler,代码行数:9,代码来源:CompileTask.java
示例5: format
import com.google.javascript.jscomp.MessageFormatter; //导入依赖的package包/类
private static String format(SourceExcerptProvider source, JSError[] errors, JSError[] warnings) {
StringBuilder sb = new StringBuilder().append("Transpilation failed:\n");
MessageFormatter formatter =
source != null
? ErrorFormat.SINGLELINE.toFormatter(source, false)
: ErrorFormat.SOURCELESS.toFormatter(source, false);
for (JSError error : errors) {
sb.append("\n").append(formatter.formatError(error));
}
for (JSError warning : warnings) {
sb.append("\n").append(formatter.formatError(warning));
}
return sb.toString();
}
开发者ID:google,项目名称:closure-compiler,代码行数:15,代码来源:TranspilationException.java
示例6: transform
import com.google.javascript.jscomp.MessageFormatter; //导入依赖的package包/类
@Override
public Source transform(Source input) {
CompileResult result = compilerSupplier.compile(input.path(), input.code());
if (result.errors.length > 0) {
// TODO(sdh): how to handle this? Currently we throw an ISE with the message,
// but this may not be the most appropriate option. It might make sense to
// add console.log() statements to any JS that comes out, particularly for
// warnings.
MessageFormatter formatter = ErrorFormat.SOURCELESS.toFormatter(null, false);
StringBuilder message =
new StringBuilder().append(getTranformationName()).append(" failed.\n");
for (JSError error : result.errors) {
message.append(formatter.formatError(error));
}
throw new IllegalStateException(message.toString());
}
if (!result.transformed) {
return input;
}
Source.Builder builder = input.toBuilder()
.setCode(result.source)
.setSourceMap(result.sourceMap);
if (getRuntime().isPresent()) {
builder.addRuntime(compilerSupplier.runtime(getRuntime().get()));
}
return builder.build();
}
开发者ID:google,项目名称:closure-compiler,代码行数:28,代码来源:CompilerBasedTransformer.java
示例7: AntErrorManager
import com.google.javascript.jscomp.MessageFormatter; //导入依赖的package包/类
public AntErrorManager(MessageFormatter formatter, Task task) {
this.formatter = formatter;
this.task = task;
}
开发者ID:andyjko,项目名称:feedlack,代码行数:5,代码来源:AntErrorManager.java
示例8: GentsErrorManager
import com.google.javascript.jscomp.MessageFormatter; //导入依赖的package包/类
GentsErrorManager(PrintStream stream, MessageFormatter formatter, boolean debug) {
super(formatter, stream);
this.debug = debug;
}
开发者ID:angular,项目名称:clutz,代码行数:5,代码来源:GentsErrorManager.java
示例9: ClutzErrorManager
import com.google.javascript.jscomp.MessageFormatter; //导入依赖的package包/类
ClutzErrorManager(PrintStream stream, MessageFormatter formatter, boolean debug) {
super(formatter, stream);
this.debug = debug;
}
开发者ID:angular,项目名称:clutz,代码行数:5,代码来源:ClutzErrorManager.java
注:本文中的com.google.javascript.jscomp.MessageFormatter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论