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

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

Issue 22393002: First CL for removing our dependency on the checked-in binary for building (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « tools/utils.py ('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 6
7 Future<String> getVersion(var options, var rootPath) { 7 Future<String> getVersion(var options, var rootPath) {
8 var os = Platform.operatingSystem; 8 var suffix = Platform.operatingSystem == 'windows' ? '.exe' : '';
9 var suffix = os == 'windows' ? '.exe' : ''; 9 var printVersionScript =
10 var checkedInBinary = 10 rootPath.append("tools").append("print_version.py").toNativePath();
11 rootPath.join(new Path('tools/testing/bin/$os/dart$suffix')); 11 return Process.run("python$suffix", [printVersionScript]).then((result) {
12 var versionPath = rootPath.append("tools").append("version.dart"); 12 if (result.exitCode != 0) {
13 return Process.run(checkedInBinary.toNativePath(), 13 throw "Could not generate version";
14 [versionPath.toNativePath()]) 14 }
15 .then((result) { 15 return result.stdout.trim();
16 if (result.exitCode != 0) { 16 });
17 throw "Could not generate version";
18 }
19 return result.stdout.trim();
20 });
21 } 17 }
22 18
23 Future<String> getSnapshotGenerationFile(var options, var args, var rootPath) { 19 Future<String> getSnapshotGenerationFile(var options, var args, var rootPath) {
24 var dart2js = rootPath.append(args["dart2js_main"]); 20 var dart2js = rootPath.append(args["dart2js_main"]);
25 var dartdoc = rootPath.append(args["dartdoc_main"]); 21 var dartdoc = rootPath.append(args["dartdoc_main"]);
26 22
27 return getVersion(options, rootPath).then((version) { 23 return getVersion(options, rootPath).then((version) {
28 var snapshotGenerationText = 24 var snapshotGenerationText =
29 """ 25 """
30 import '${dart2js}' as dart2jsMain; 26 import '${dart2js}' as dart2jsMain;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 88
93 var scriptFile = new File(new File(options.script).fullPathSync()); 89 var scriptFile = new File(new File(options.script).fullPathSync());
94 var path = new Path(scriptFile.directory.path); 90 var path = new Path(scriptFile.directory.path);
95 var rootPath = path.directoryPath.directoryPath; 91 var rootPath = path.directoryPath.directoryPath;
96 getSnapshotGenerationFile(options, args, rootPath).then((result) { 92 getSnapshotGenerationFile(options, args, rootPath).then((result) {
97 var wrapper = "${args['output_dir']}/utils_wrapper.dart"; 93 var wrapper = "${args['output_dir']}/utils_wrapper.dart";
98 writeSnapshotFile(wrapper, result); 94 writeSnapshotFile(wrapper, result);
99 createSnapshot(options, wrapper, args["package_root"]); 95 createSnapshot(options, wrapper, args["package_root"]);
100 }); 96 });
101 } 97 }
OLDNEW
« no previous file with comments | « tools/utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698