当前位置: 首页>>代码示例>>Java>>正文


Java PrintStreamErrorManager类代码示例

本文整理汇总了Java中com.google.javascript.jscomp.PrintStreamErrorManager的典型用法代码示例。如果您正苦于以下问题:Java PrintStreamErrorManager类的具体用法?Java PrintStreamErrorManager怎么用?Java PrintStreamErrorManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PrintStreamErrorManager类属于com.google.javascript.jscomp包,在下文中一共展示了PrintStreamErrorManager类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import com.google.javascript.jscomp.PrintStreamErrorManager; //导入依赖的package包/类
public static void main(String[] args) throws CmdLineException, IOException {
  Flags flags = new Flags();

  CmdLineParser parser = new CmdLineParser(flags);
  parser.setUsageWidth(79);
  parser.parseArgument(args);

  FileSystem fs = FileSystems.getDefault();
  Path closure = fs.getPath(flags.closure);
  Path output = fs.getPath(flags.output);

  ImmutableList<SourceFile> depsFile =
      ImmutableList.of(SourceFile.fromFile(closure.resolve("deps.js").toString()));
  List<SourceFile> sourceFiles =
      flags.inputs.stream().map(SourceFile::fromFile).collect(toList());

  PrintStreamErrorManager errorManager = new PrintStreamErrorManager(System.err);
  DepsGenerator generator =
      new DepsGenerator(
          depsFile,
          sourceFiles,
          DepsGenerator.InclusionStrategy.DO_NOT_DUPLICATE,
          closure.toAbsolutePath().toString(),
          errorManager,
          ModuleLoader.EMPTY);

  String calls = generator.computeDependencyCalls();
  if (errorManager.getErrorCount() > 0) {
    errorManager.generateReport();
    return;
  }

  try (BufferedWriter writer = Files.newBufferedWriter(output, UTF_8)) {
    writer.write(calls);
    writer.flush();
  }
}
 
开发者ID:jleyba,项目名称:js-dossier,代码行数:38,代码来源:WriteDeps.java

示例2: setUp

import com.google.javascript.jscomp.PrintStreamErrorManager; //导入依赖的package包/类
@Override
public void setUp() {
  errorManager = new PrintStreamErrorManager(System.err);
  parser = new JsFileParser(errorManager);
  parser.setShortcutMode(true);
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:7,代码来源:JsFileParserTest.java

示例3: setUp

import com.google.javascript.jscomp.PrintStreamErrorManager; //导入依赖的package包/类
@Override
public void setUp() {
  errorManager = new PrintStreamErrorManager(System.err);
  parser = new DepsFileParser(errorManager);
  parser.setShortcutMode(true);
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:7,代码来源:DepsFileParserTest.java

示例4: setUp

import com.google.javascript.jscomp.PrintStreamErrorManager; //导入依赖的package包/类
@Override
public void setUp() {
  errorManager = new PrintStreamErrorManager(System.err);
  parser = new TestParser(errorManager);
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:6,代码来源:JsFileLineParserTest.java

示例5: setUp

import com.google.javascript.jscomp.PrintStreamErrorManager; //导入依赖的package包/类
@Override
public void setUp() {
  errorManager = new PrintStreamErrorManager(System.err);
  parser = new JsFunctionParser(functions, errorManager);
  parser.setShortcutMode(true);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:7,代码来源:JsFunctionParserTest.java

示例6: setUp

import com.google.javascript.jscomp.PrintStreamErrorManager; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
  errorManager = new PrintStreamErrorManager(System.err);
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:5,代码来源:DepsGeneratorTest.java

示例7: processClosureSources

import com.google.javascript.jscomp.PrintStreamErrorManager; //导入依赖的package包/类
private static ImmutableSet<Path> processClosureSources(
    Collection<Path> sources, ImmutableSet<Path> deps, Path closureBase) throws IOException {

  Collection<SourceFile> depsFiles = deps.stream().map(toSourceFile()).collect(toList());
  Collection<SourceFile> sourceFiles = sources.stream().map(toSourceFile()).collect(toList());

  ErrorManager errorManager = new PrintStreamErrorManager(System.err);

  DepsGenerator generator =
      new DepsGenerator(
          depsFiles,
          sourceFiles,
          DepsGenerator.InclusionStrategy.ALWAYS,
          closureBase.toAbsolutePath().toString(),
          errorManager,
          ModuleLoader.EMPTY);

  String rawDeps = generator.computeDependencyCalls();
  errorManager.generateReport();
  if (rawDeps == null) {
    throw new RuntimeException("Encountered Closure dependency conflicts");
  }

  List<DependencyInfo> allDeps =
      new DepsFileParser(errorManager).parseFile("*generated-deps*", rawDeps);

  List<DependencyInfo> sourceDeps =
      allDeps.stream().filter(isInSources(sources, closureBase)).collect(toList());

  List<Path> sortedDeps =
      new ClosureSortedDependencies<>(allDeps)
          .getDependenciesOf(sourceDeps, true)
          .stream()
          .map(toPath(closureBase))
          .collect(toList());

  return ImmutableSet.<Path>builder()
      // Always include Closure's base.js first.
      .add(closureBase.resolve("base.js"))
      .addAll(sortedDeps)
      .build();
}
 
开发者ID:jleyba,项目名称:js-dossier,代码行数:43,代码来源:Config.java

示例8: main

import com.google.javascript.jscomp.PrintStreamErrorManager; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
  Flags flags = new Flags();

  CmdLineParser parser = new CmdLineParser(flags);
  parser.setUsageWidth(79);
  parser.parseArgument(args);

  FileSystem fs = FileSystems.getDefault();
  final Path closure = fs.getPath(flags.closure).toAbsolutePath();

  ErrorManager errorManager = new PrintStreamErrorManager(System.err);
  JsFileParser jsFileParser = new JsFileParser(errorManager);

  List<DependencyInfo> info = new ArrayList<>(flags.inputs.size());
  for (String path : flags.inputs) {
    Path absPath = fs.getPath(path).toAbsolutePath();
    Path closureRelativePath = closure.relativize(absPath);
    info.add(
        jsFileParser.parseFile(
            absPath.toString(),
            closureRelativePath.toString(),
            new String(Files.readAllBytes(absPath), UTF_8)));
  }

  List<DependencyInfo> allDeps = new LinkedList<>(info);
  allDeps.addAll(
      new DepsFileParser(errorManager).parseFile(closure.resolve("deps.js").toString()));

  List<String> compilerFlags =
      new ClosureSortedDependencies<>(allDeps)
          .getSortedDependenciesOf(info)
          .stream()
          .map(input -> closure.resolve(input.getPathRelativeToClosureBase()))
          .map(Path::toAbsolutePath)
          .map(Path::normalize)
          .map(path -> "--js=" + path)
          .collect(toList());
  compilerFlags.add("--js=" + closure.resolve("base.js"));
  compilerFlags.addAll(flags.flags);

  CommandLineRunner.main(compilerFlags.toArray(new String[compilerFlags.size()]));
}
 
开发者ID:jleyba,项目名称:js-dossier,代码行数:43,代码来源:Compile.java


注:本文中的com.google.javascript.jscomp.PrintStreamErrorManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。