コード例 #1
0
ファイル: LibraryDeps.java プロジェクト: hyamamoto/dart
 private static LibraryDeps fromReaderEx(Reader reader) throws Exception {
   LibraryDeps deps = new LibraryDeps();
   BufferedReader buf = new BufferedReader(reader);
   // Check version.
   {
     String line = buf.readLine();
     if (!Objects.equal(line, VERSION)) {
       return deps;
     }
   }
   // Read units dependencies.
   String relPath;
   while (null != (relPath = buf.readLine())) {
     Source source = new Source();
     // Read flags.
     source.shouldRecompileOnAnyTopLevelChange = Boolean.parseBoolean(buf.readLine());
     // Read top symbols.
     {
       String line = buf.readLine();
       Iterable<String> topSymbols = Splitter.on(' ').omitEmptyStrings().split(line);
       Iterables.addAll(source.topSymbols, topSymbols);
     }
     // Read all symbols.
     {
       String line = buf.readLine();
       Iterable<String> allSymbols = Splitter.on(' ').omitEmptyStrings().split(line);
       Iterables.addAll(source.allSymbols, allSymbols);
     }
     // Read holes.
     {
       String line = buf.readLine();
       Iterable<String> holes = Splitter.on(' ').omitEmptyStrings().split(line);
       Iterables.addAll(source.holes, holes);
     }
     // Read dependencies.
     while (true) {
       String line = buf.readLine();
       // Blank line: next unit.
       if (line.length() == 0) {
         break;
       }
       // Parse line.
       String[] parts = line.split(" ");
       source.deps.add(new Dependency(new URI(parts[0]), parts[1], Long.parseLong(parts[2])));
     }
     // Remember dependencies for current unit.
     deps.sources.put(relPath, source);
   }
   return deps;
 }
コード例 #2
0
ファイル: LibraryDeps.java プロジェクト: hyamamoto/dart
 /** Update the library dependencies to reflect this unit's classes. */
 public void update(DartCompilerMainContext context, DartUnit unit) {
   Source source = new Source();
   DartSource unitSource = (DartSource) unit.getSourceInfo().getSource();
   String relPath = unitSource.getRelativePath();
   putSource(relPath, source);
   // Remember dependencies.
   LibraryDepsVisitor.exec(unit, source);
   // Fill Source with symbols.
   for (String name : unit.getDeclarationNames()) {
     source.addAllSymbol(name);
   }
   for (String name : unit.getTopDeclarationNames()) {
     source.addTopSymbol(name);
   }
   // Analyze errors and see if any of them should force recompilation.
   List<DartCompilationError> sourceErrors = context.getSourceErrors(unitSource);
   for (DartCompilationError error : sourceErrors) {
     if (error.getErrorCode().needsRecompilation()) {
       source.shouldRecompileOnAnyTopLevelChange = true;
       break;
     }
   }
 }