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

Side by Side Diff: utils/compiler/create_snapshot.dart

Issue 23054008: Remove the Path class from dart:io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor fixes Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« sdk/lib/io/http_impl.dart ('K') | « utils/compiler/compiler.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import "package:path/path.dart";
ahe 2013/08/14 16:14:09 I'm going to be very unreasonable and ask you to n
Søren Gjesse 2013/08/15 09:07:12 Removed, and changed this file to use the Uri clas
ahe 2013/08/15 09:29:00 Hopefully, that is temporary.
6 7
7 Future<String> getVersion(var options, var rootPath) { 8 Future<String> getVersion(var options, var rootPath) {
8 var suffix = Platform.operatingSystem == 'windows' ? '.exe' : ''; 9 var suffix = Platform.operatingSystem == 'windows' ? '.exe' : '';
9 var printVersionScript = 10 var printVersionScript = join(rootPath, "tools", "print_version.py");
10 rootPath.append("tools").append("print_version.py").toNativePath();
11 return Process.run("python$suffix", [printVersionScript]).then((result) { 11 return Process.run("python$suffix", [printVersionScript]).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.append(args["dart2js_main"]); 20 var dart2js = join(rootPath, args["dart2js_main"]);
21 var dartdoc = rootPath.append(args["dartdoc_main"]); 21 var dartdoc = join(rootPath, args["dartdoc_main"]);
22 22
23 return getVersion(options, rootPath).then((version) { 23 return getVersion(options, rootPath).then((version) {
24 var snapshotGenerationText = 24 var snapshotGenerationText =
25 """ 25 """
26 import '${dart2js}' as dart2jsMain; 26 import '${dart2js}' as dart2jsMain;
27 import '${dartdoc}' as dartdocMain; 27 import '${dartdoc}' as dartdocMain;
28 import 'dart:io'; 28 import 'dart:io';
29 29
30 void main() { 30 void main() {
31 Options options = new Options(); 31 Options options = new Options();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 if (!validArguments.contains(argumentSplit[0])) { 79 if (!validArguments.contains(argumentSplit[0])) {
80 throw "Invalid argument $argument"; 80 throw "Invalid argument $argument";
81 } 81 }
82 args[argumentSplit[0].substring(2)] = argumentSplit[1]; 82 args[argumentSplit[0].substring(2)] = argumentSplit[1];
83 } 83 }
84 if (!args.containsKey("dart2js_main")) throw "Please specify dart2js_main"; 84 if (!args.containsKey("dart2js_main")) throw "Please specify dart2js_main";
85 if (!args.containsKey("dartdoc_main")) throw "Please specify dartdoc_main"; 85 if (!args.containsKey("dartdoc_main")) throw "Please specify dartdoc_main";
86 if (!args.containsKey("output_dir")) throw "Please specify output_dir"; 86 if (!args.containsKey("output_dir")) throw "Please specify output_dir";
87 if (!args.containsKey("package_root")) throw "Please specify package_root"; 87 if (!args.containsKey("package_root")) throw "Please specify package_root";
88 88
89 var scriptFile = new File(new File(options.script).fullPathSync()); 89 var scriptFile = new File(options.script).fullPathSync();
90 var path = new Path(scriptFile.directory.path); 90 var path = dirname(scriptFile);
91 var rootPath = path.directoryPath.directoryPath; 91 var rootPath = dirname(dirname(path));
92 getSnapshotGenerationFile(options, args, rootPath).then((result) { 92 getSnapshotGenerationFile(options, args, rootPath).then((result) {
93 var wrapper = "${args['output_dir']}/utils_wrapper.dart"; 93 var wrapper = "${args['output_dir']}/utils_wrapper.dart";
94 writeSnapshotFile(wrapper, result); 94 writeSnapshotFile(wrapper, result);
95 createSnapshot(options, wrapper, args["package_root"]); 95 createSnapshot(options, wrapper, args["package_root"]);
96 }); 96 });
97 } 97 }
OLDNEW
« sdk/lib/io/http_impl.dart ('K') | « utils/compiler/compiler.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698