Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Unified Diff: lib/src/server/dependency_graph.dart

Issue 1235503010: fixes #219, able to compile multiple entry points (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/src/server/dependency_graph.dart
diff --git a/lib/src/dependency_graph.dart b/lib/src/server/dependency_graph.dart
similarity index 92%
rename from lib/src/dependency_graph.dart
rename to lib/src/server/dependency_graph.dart
index c2f75d6fdf2139b81e697317f798fc5db04713f1..dee7fa511018aef60a74434f68b7770f225054c8 100644
--- a/lib/src/dependency_graph.dart
+++ b/lib/src/server/dependency_graph.dart
@@ -28,9 +28,10 @@ import 'package:html/parser.dart' as html;
import 'package:logging/logging.dart' show Logger, Level;
import 'package:path/path.dart' as path;
-import 'info.dart';
-import 'options.dart';
-import 'report.dart';
+import 'package:dev_compiler/src/compiler.dart' show defaultRuntimeFiles;
+import 'package:dev_compiler/src/info.dart';
+import 'package:dev_compiler/src/options.dart';
+import 'package:dev_compiler/src/report.dart';
/// Holds references to all source nodes in the import graph. This is mainly
/// used as a level of indirection to ensure that each source has a canonical
@@ -56,8 +57,8 @@ class SourceGraph {
return;
}
var prefix = path.absolute(dir);
- var files = _options.serverMode
- ? runtimeFilesForServerMode(_options.widget)
+ var files = _options.serverMode && _options.widget
+ ? runtimeFilesForServerMode
: defaultRuntimeFiles;
for (var file in files) {
runtimeDeps.add(nodeFromUri(path.toUri(path.join(prefix, file))));
@@ -83,6 +84,10 @@ class SourceGraph {
List<String> get resources => _options.sourceOptions.resources;
}
+final runtimeFilesForServerMode = new List<String>.from(defaultRuntimeFiles)
+ ..add('messages_widget.js')
+ ..add('messages.css');
+
/// A node in the import graph representing a source file.
abstract class SourceNode {
final SourceGraph graph;
@@ -501,52 +506,4 @@ visitInPostOrder(SourceNode start, void action(SourceNode node),
bool _same(Set a, Set b) => a.length == b.length && a.containsAll(b);
-/// Runtime files added to all applications when running the compiler in the
-/// command line.
-final defaultRuntimeFiles = () {
- var files = [
- 'harmony_feature_check.js',
- 'dart_utils.js',
- 'dart_library.js',
- '_errors.js',
- '_types.js',
- '_rtti.js',
- '_classes.js',
- '_operations.js',
- 'dart_runtime.js',
- ];
- files.addAll(corelibOrder.map((l) => l.replaceAll('.', '/') + '.js'));
- return files;
-}();
-
-/// Curated order to minimize lazy classes needed by dart:core and its
-/// transitive SDK imports.
-const corelibOrder = const [
- 'dart.core',
- 'dart.collection',
- 'dart._internal',
- 'dart.math',
- 'dart._interceptors',
- 'dart.async',
- 'dart._foreign_helper',
- 'dart._js_embedded_names',
- 'dart._js_helper',
- 'dart.isolate',
- 'dart.typed_data',
- 'dart._native_typed_data',
- 'dart._isolate_helper',
- 'dart._js_primitives',
- 'dart.convert',
- 'dart.mirrors',
- 'dart._js_mirrors',
- 'dart.js'
- // _foreign_helper is not included, as it only defines the JS builtin that
- // the compiler handles at compile time.
-];
-
-/// Runtime files added to applications when running in server mode.
-List<String> runtimeFilesForServerMode([bool includeWidget = true]) =>
- new List<String>.from(defaultRuntimeFiles)
- ..addAll(includeWidget ? const ['messages_widget.js', 'messages.css'] : []);
-
final _log = new Logger('dev_compiler.dependency_graph');

Powered by Google App Engine
This is Rietveld 408576698