| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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); |
| 58 var files = | 58 var files = _options.serverMode |
| 59 _options.serverMode ? runtimeFilesForServerMode : defaultRuntimeFiles; | 59 ? runtimeFilesForServerMode(_options.widget) |
| 60 : defaultRuntimeFiles; |
| 60 for (var file in files) { | 61 for (var file in files) { |
| 61 runtimeDeps.add(nodeFromUri(path.toUri(path.join(prefix, file)))); | 62 runtimeDeps.add(nodeFromUri(path.toUri(path.join(prefix, file)))); |
| 62 } | 63 } |
| 63 } | 64 } |
| 64 | 65 |
| 65 /// Node associated with a resolved [uri]. | 66 /// Node associated with a resolved [uri]. |
| 66 SourceNode nodeFromUri(Uri uri) { | 67 SourceNode nodeFromUri(Uri uri) { |
| 67 var uriString = Uri.encodeFull('$uri'); | 68 var uriString = Uri.encodeFull('$uri'); |
| 68 return nodes.putIfAbsent(uri, () { | 69 return nodes.putIfAbsent(uri, () { |
| 69 var source = _context.sourceFactory.forUri(uriString); | 70 var source = _context.sourceFactory.forUri(uriString); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 'dart._js_primitives', | 534 'dart._js_primitives', |
| 534 'dart.convert', | 535 'dart.convert', |
| 535 'dart.mirrors', | 536 'dart.mirrors', |
| 536 'dart._js_mirrors', | 537 'dart._js_mirrors', |
| 537 'dart.js' | 538 'dart.js' |
| 538 // _foreign_helper is not included, as it only defines the JS builtin that | 539 // _foreign_helper is not included, as it only defines the JS builtin that |
| 539 // the compiler handles at compile time. | 540 // the compiler handles at compile time. |
| 540 ]; | 541 ]; |
| 541 | 542 |
| 542 /// Runtime files added to applications when running in server mode. | 543 /// Runtime files added to applications when running in server mode. |
| 543 final runtimeFilesForServerMode = new List<String>.from(defaultRuntimeFiles) | 544 List<String> runtimeFilesForServerMode([bool includeWidget = true]) => |
| 544 ..addAll(const ['messages_widget.js', 'messages.css']); | 545 new List<String>.from(defaultRuntimeFiles) |
| 546 ..addAll(includeWidget ? const ['messages_widget.js', 'messages.css'] : []); |
| 545 | 547 |
| 546 final _log = new Logger('dev_compiler.dependency_graph'); | 548 final _log = new Logger('dev_compiler.dependency_graph'); |
| OLD | NEW |