Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import 'dart:io'; | 5 import 'dart:io'; |
| 6 | 6 |
| 7 Future<String> getVersion(var options, var rootPath) { | 7 Future<String> getVersion(var options, var rootPath) { |
| 8 var suffix = Platform.operatingSystem == 'windows' ? '.exe' : ''; | 8 var suffix = Platform.operatingSystem == 'windows' ? '.exe' : ''; |
| 9 var printVersionScript = rootPath.resolve("tools/print_version.py"); | 9 var printVersionScript = rootPath.resolve("tools/print_version.py"); |
| 10 return Process.run("python$suffix", | 10 return Process.run("python$suffix", |
| 11 [printVersionScript.toFilePath()]).then((result) { | 11 [printVersionScript.toFilePath()]).then((result) { |
| 12 if (result.exitCode != 0) { | 12 if (result.exitCode != 0) { |
| 13 throw "Could not generate version"; | 13 throw "Could not generate version"; |
| 14 } | 14 } |
| 15 return result.stdout.trim(); | 15 return result.stdout.trim(); |
| 16 }); | 16 }); |
| 17 } | 17 } |
| 18 | 18 |
| 19 Future<String> getSnapshotGenerationFile(var options, var args, var rootPath) { | 19 Future<String> getSnapshotGenerationFile(var options, var args, var rootPath) { |
| 20 var dart2js = rootPath.resolve(args["dart2js_main"]); | 20 var dart2js = rootPath.resolve(args["dart2js_main"]); |
| 21 var dartdoc = rootPath.resolve(args["dartdoc_main"]); | 21 var dartdoc = rootPath.resolve(args["dartdoc_main"]); |
| 22 return getVersion(options, rootPath).then((version) { | 22 return getVersion(options, rootPath).then((version) { |
| 23 var snapshotGenerationText = | 23 var snapshotGenerationText = |
| 24 """ | 24 """ |
| 25 import '${dart2js.toFilePath()}' as dart2jsMain; | 25 import '${dart2js.toFilePath(windows: false)}' as dart2jsMain; |
|
ahe
2013/08/15 12:14:07
This still isn't right. dart2js is already a URI,
| |
| 26 import '${dartdoc.toFilePath()}' as dartdocMain; | 26 import '${dartdoc.toFilePath(windows: false)}' as dartdocMain; |
| 27 import 'dart:io'; | 27 import 'dart:io'; |
| 28 | 28 |
| 29 void main() { | 29 void main() { |
| 30 Options options = new Options(); | 30 Options options = new Options(); |
| 31 if (options.arguments.length < 1) throw "No tool given as argument"; | 31 if (options.arguments.length < 1) throw "No tool given as argument"; |
| 32 String tool = options.arguments.removeAt(0); | 32 String tool = options.arguments.removeAt(0); |
| 33 if (tool == "dart2js") { | 33 if (tool == "dart2js") { |
| 34 dart2jsMain.BUILD_ID = "$version"; | 34 dart2jsMain.BUILD_ID = "$version"; |
| 35 dart2jsMain.mainWithErrorHandler(options); | 35 dart2jsMain.mainWithErrorHandler(options); |
| 36 } else if (tool == "dartdoc") { | 36 } else if (tool == "dartdoc") { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 | 87 |
| 88 var scriptFile = new Uri.file(new File(options.script).fullPathSync()); | 88 var scriptFile = new Uri.file(new File(options.script).fullPathSync()); |
| 89 var path = scriptFile.resolve("."); | 89 var path = scriptFile.resolve("."); |
| 90 var rootPath = path.resolve("../.."); | 90 var rootPath = path.resolve("../.."); |
| 91 getSnapshotGenerationFile(options, args, rootPath).then((result) { | 91 getSnapshotGenerationFile(options, args, rootPath).then((result) { |
| 92 var wrapper = "${args['output_dir']}/utils_wrapper.dart"; | 92 var wrapper = "${args['output_dir']}/utils_wrapper.dart"; |
| 93 writeSnapshotFile(wrapper, result); | 93 writeSnapshotFile(wrapper, result); |
| 94 createSnapshot(options, wrapper, args["package_root"]); | 94 createSnapshot(options, wrapper, args["package_root"]); |
| 95 }); | 95 }); |
| 96 } | 96 } |
| OLD | NEW |