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

Unified Diff: utils/compiler/create_snapshot.dart

Issue 50633004: Remove uses of dart:io Options in dart2js and dartdoc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use arguments instead of args. Created 7 years, 2 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
« no previous file with comments | « sdk/lib/_internal/dartdoc/bin/dartdoc.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/compiler/create_snapshot.dart
diff --git a/utils/compiler/create_snapshot.dart b/utils/compiler/create_snapshot.dart
index 37920a3e3bf16e19123538c1fd69223cc750ee9e..3b6cbfd2d87079626becd75d97f50bbe03e07528 100644
--- a/utils/compiler/create_snapshot.dart
+++ b/utils/compiler/create_snapshot.dart
@@ -4,7 +4,7 @@
import 'dart:io';
-Future<String> getVersion(var options, var rootPath) {
+Future<String> getVersion(var rootPath) {
var suffix = Platform.operatingSystem == 'windows' ? '.exe' : '';
var printVersionScript = rootPath.resolve("tools/print_version.py");
return Process.run("python$suffix",
@@ -16,25 +16,24 @@ Future<String> getVersion(var options, var rootPath) {
});
}
-Future<String> getSnapshotGenerationFile(var options, var args, var rootPath) {
+Future<String> getSnapshotGenerationFile(var args, var rootPath) {
var dart2js = rootPath.resolve(args["dart2js_main"]);
var dartdoc = rootPath.resolve(args["dartdoc_main"]);
- return getVersion(options, rootPath).then((version) {
+ return getVersion(rootPath).then((version) {
var snapshotGenerationText =
"""
import '${dart2js.toFilePath(windows: false)}' as dart2jsMain;
import '${dartdoc.toFilePath(windows: false)}' as dartdocMain;
import 'dart:io';
-void main() {
- Options options = new Options();
- if (options.arguments.length < 1) throw "No tool given as argument";
- String tool = options.arguments.removeAt(0);
+void main(List<String> arguments) {
+ if (arguments.length < 1) throw "No tool given as argument";
+ String tool = arguments[0];
if (tool == "dart2js") {
dart2jsMain.BUILD_ID = "$version";
- dart2jsMain.mainWithErrorHandler(options);
+ dart2jsMain.main(arguments.skip(1).toList());
} else if (tool == "dartdoc") {
- dartdocMain.mainWithOptions(options);
+ dartdocMain.main(arguments.skip(1).toList());
}
}
@@ -50,8 +49,8 @@ void writeSnapshotFile(var path, var content) {
writer.close();
}
-Future createSnapshot(var options, var dart_file, var packageRoot) {
- return Process.run(options.executable,
+Future createSnapshot(var dart_file, var packageRoot) {
+ return Process.run(Platform.executable,
["--package-root=$packageRoot",
"--snapshot=$dart_file.snapshot",
dart_file])
@@ -67,12 +66,11 @@ Future createSnapshot(var options, var dart_file, var packageRoot) {
* --output_dir=val The full path to the output_dir.
* --dart2js_main=val The path to the dart2js main script releative to root.
*/
-void main() {
- Options options = new Options();
+void main(List<String> arguments) {
var validArguments = ["--output_dir", "--dart2js_main", "--dartdoc_main",
"--package_root"];
var args = {};
- for (var argument in options.arguments) {
+ for (var argument in arguments) {
var argumentSplit = argument.split("=");
if (argumentSplit.length != 2) throw "Invalid argument $argument, no =";
if (!validArguments.contains(argumentSplit[0])) {
@@ -85,12 +83,12 @@ void main() {
if (!args.containsKey("output_dir")) throw "Please specify output_dir";
if (!args.containsKey("package_root")) throw "Please specify package_root";
- var scriptFile = new Uri.file(new File(options.script).fullPathSync());
+ var scriptFile = new Uri.file(new File(Platform.script).fullPathSync());
var path = scriptFile.resolve(".");
var rootPath = path.resolve("../..");
- getSnapshotGenerationFile(options, args, rootPath).then((result) {
+ getSnapshotGenerationFile(args, rootPath).then((result) {
var wrapper = "${args['output_dir']}/utils_wrapper.dart";
writeSnapshotFile(wrapper, result);
- createSnapshot(options, wrapper, args["package_root"]);
+ createSnapshot(wrapper, args["package_root"]);
});
}
« no previous file with comments | « sdk/lib/_internal/dartdoc/bin/dartdoc.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698