| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /// Tracks the shape of the import/export graph and dependencies between files. | 5 /// Tracks the shape of the import/export graph and dependencies between files. |
| 6 library dev_compiler.src.dependency_graph; | 6 library dev_compiler.src.dependency_graph; |
| 7 | 7 |
| 8 import 'dart:collection' show HashSet, HashMap; | 8 import 'dart:collection' show HashSet, HashMap; |
| 9 | 9 |
| 10 import 'package:analyzer/analyzer.dart' show parseDirectives; | 10 import 'package:analyzer/analyzer.dart' show parseDirectives; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 class SourceGraph { | 37 class SourceGraph { |
| 38 /// All nodes in the source graph. Used to get a canonical representation for | 38 /// All nodes in the source graph. Used to get a canonical representation for |
| 39 /// any node. | 39 /// any node. |
| 40 final Map<Uri, SourceNode> nodes = {}; | 40 final Map<Uri, SourceNode> nodes = {}; |
| 41 | 41 |
| 42 /// Resources included by default on any application. | 42 /// Resources included by default on any application. |
| 43 final runtimeDeps = new Set<ResourceSourceNode>(); | 43 final runtimeDeps = new Set<ResourceSourceNode>(); |
| 44 | 44 |
| 45 /// Analyzer used to resolve source files. | 45 /// Analyzer used to resolve source files. |
| 46 final AnalysisContext _context; | 46 final AnalysisContext _context; |
| 47 final CheckerReporter _reporter; | 47 final CompilerReporter _reporter; |
| 48 final CompilerOptions _options; | 48 final CompilerOptions _options; |
| 49 | 49 |
| 50 SourceGraph(this._context, this._reporter, this._options) { | 50 SourceGraph(this._context, this._reporter, this._options) { |
| 51 var dir = _options.runtimeDir; | 51 var dir = _options.runtimeDir; |
| 52 if (dir == null) { | 52 if (dir == null) { |
| 53 _log.severe('Runtime dir could not be determined automatically, ' | 53 _log.severe('Runtime dir could not be determined automatically, ' |
| 54 'please specify the --runtime-dir flag on the command line.'); | 54 'please specify the --runtime-dir flag on the command line.'); |
| 55 return; | 55 return; |
| 56 } | 56 } |
| 57 var prefix = path.absolute(dir); | 57 var prefix = path.absolute(dir); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 71 if (extension == '.html') { | 71 if (extension == '.html') { |
| 72 return new HtmlSourceNode(this, uri, source); | 72 return new HtmlSourceNode(this, uri, source); |
| 73 } else if (extension == '.dart' || uriString.startsWith('dart:')) { | 73 } else if (extension == '.dart' || uriString.startsWith('dart:')) { |
| 74 return new DartSourceNode(this, uri, source); | 74 return new DartSourceNode(this, uri, source); |
| 75 } else { | 75 } else { |
| 76 return new ResourceSourceNode(this, uri, source); | 76 return new ResourceSourceNode(this, uri, source); |
| 77 } | 77 } |
| 78 }); | 78 }); |
| 79 } | 79 } |
| 80 | 80 |
| 81 List<String> get resources => _options.resources; | 81 List<String> get resources => _options.sourceOptions.resources; |
| 82 } | 82 } |
| 83 | 83 |
| 84 /// A node in the import graph representing a source file. | 84 /// A node in the import graph representing a source file. |
| 85 abstract class SourceNode { | 85 abstract class SourceNode { |
| 86 final SourceGraph graph; | 86 final SourceGraph graph; |
| 87 | 87 |
| 88 /// Resolved URI for this node. | 88 /// Resolved URI for this node. |
| 89 final Uri uri; | 89 final Uri uri; |
| 90 | 90 |
| 91 /// Resolved source from the analyzer. We let the analyzer internally track | 91 /// Resolved source from the analyzer. We let the analyzer internally track |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 'dart.convert', | 524 'dart.convert', |
| 525 // _foreign_helper is not included, as it only defines the JS builtin that | 525 // _foreign_helper is not included, as it only defines the JS builtin that |
| 526 // the compiler handles at compile time. | 526 // the compiler handles at compile time. |
| 527 ]; | 527 ]; |
| 528 | 528 |
| 529 /// Runtime files added to applications when running in server mode. | 529 /// Runtime files added to applications when running in server mode. |
| 530 final runtimeFilesForServerMode = new List<String>.from(defaultRuntimeFiles) | 530 final runtimeFilesForServerMode = new List<String>.from(defaultRuntimeFiles) |
| 531 ..addAll(const ['messages_widget.js', 'messages.css']); | 531 ..addAll(const ['messages_widget.js', 'messages.css']); |
| 532 | 532 |
| 533 final _log = new Logger('dev_compiler.dependency_graph'); | 533 final _log = new Logger('dev_compiler.dependency_graph'); |
| OLD | NEW |