Index: lib/devc.dart |
diff --git a/lib/devc.dart b/lib/devc.dart |
index f2f548e0fdbbdf514074618643367c9c83d9a536..86c936e2b95d4988f8647b56ee98f51f83ca6a92 100644 |
--- a/lib/devc.dart |
+++ b/lib/devc.dart |
@@ -51,7 +51,6 @@ class Compiler { |
List<LibraryInfo> _libraries = <LibraryInfo>[]; |
final List<CodeGenerator> _generators; |
bool _failure = false; |
- bool _devCompilerRuntimeCopied = false; |
factory Compiler(CompilerOptions options, |
[TypeResolver resolver, CheckerReporter reporter]) { |
@@ -99,6 +98,8 @@ class Compiler { |
_buildHtmlFile(node); |
} else if (node is DartSourceNode) { |
_buildDartLibrary(node); |
+ } else if (node is JavaScriptSourceNode) { |
+ _buildJavaScriptFile(node); |
} else { |
assert(false); // should not get a build request on PartSourceNode |
} |
@@ -119,19 +120,18 @@ class Compiler { |
String outputFile = path.join(_options.outputDir, filename); |
new File(outputFile).writeAsStringSync(output); |
- if (_options.outputDart || _devCompilerRuntimeCopied) return; |
- // Copy the dev_compiler runtime (implicit dependency for js codegen) |
- // TODO(sigmund): split this out as a separate node in our dependency graph |
- // (https://github.com/dart-lang/dev_compiler/issues/85). |
- var runtimeDir = path.join( |
- path.dirname(path.dirname(Platform.script.path)), 'lib/runtime/'); |
- var runtimeOutput = path.join(_options.outputDir, 'dev_compiler/runtime/'); |
- new Directory(runtimeOutput).createSync(recursive: true); |
- new File(path.join(runtimeDir, 'harmony_feature_check.js')) |
- .copy(path.join(runtimeOutput, 'harmony_feature_check.js')); |
- new File(path.join(runtimeDir, 'dart_runtime.js')) |
- .copy(path.join(runtimeOutput, 'dart_runtime.js')); |
- _devCompilerRuntimeCopied = true; |
+ if (_options.outputDart) return; |
+ } |
+ |
+ void _buildJavaScriptFile(JavaScriptSourceNode node) { |
+ // JavaScriptSourceNodes are pieces of the dev_compiler runtime which are |
Jennifer Messerly
2015/03/09 16:12:41
Is this necessarily the case? What about other .js
Siggi Cherem (dart-lang)
2015/03/09 17:31:39
True, good point. I'll adjust the comment. FYI in
|
+ // dependencies added for js codegen. |
+ if (_options.outputDart) return; |
+ assert(node.uri.scheme == 'package'); |
+ var filepath = path.join(_options.outputDir, node.uri.path); |
+ var dir = path.dirname(filepath); |
+ new Directory(dir).createSync(recursive: true); |
+ new File(filepath).writeAsStringSync(node.source.contents.data); |
} |
bool _isEntry(DartSourceNode node) { |