Index: utils/compiler/create_snapshot.dart |
=================================================================== |
--- utils/compiler/create_snapshot.dart (revision 30136) |
+++ utils/compiler/create_snapshot.dart (working copy) |
@@ -42,6 +42,23 @@ |
}); |
} |
+Future<String> getDart2jsSnapshotGenerationFile(var args, var rootPath) { |
+ var dart2js = rootPath.resolve(args["dart2js_main"]); |
+ return getVersion(rootPath).then((version) { |
+ var snapshotGenerationText = |
+""" |
+import '${dart2js.toFilePath(windows: false)}' as dart2jsMain; |
+import 'dart:io'; |
+ |
+void main(List<String> arguments) { |
+ dart2jsMain.BUILD_ID = "$version"; |
+ dart2jsMain.main(arguments.skip(1).toList()); |
+} |
+"""; |
+ return snapshotGenerationText; |
+ }); |
+} |
+ |
void writeSnapshotFile(var path, var content) { |
File file = new File(path); |
var writer = file.openSync(mode: FileMode.WRITE); |
@@ -91,4 +108,11 @@ |
writeSnapshotFile(wrapper, result); |
createSnapshot(wrapper, args["package_root"]); |
}); |
+ |
+ getDart2jsSnapshotGenerationFile(args, rootPath).then((result) { |
+ var wrapper = "${args['output_dir']}/dart2js.dart"; |
+ writeSnapshotFile(wrapper, result); |
+ createSnapshot(wrapper, args["package_root"]); |
+ }); |
+ |
} |