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 'package:polymer/builder.dart'; | 5 import 'package:polymer/builder.dart'; |
6 import 'dart:io'; | 6 import 'dart:io'; |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 main() { | 9 main() { |
10 lint() | 10 lint() |
11 .then((_) => deploy()).then(compileToJs); | 11 .then((_) => deploy()).then(compileToJs); |
12 } | 12 } |
13 | 13 |
14 compileToJs(_) { | 14 compileToJs(_) { |
15 print("Running dart2js"); | 15 print("Running dart2js"); |
16 » var dart_path = Platform.executable; | 16 var dart_path = Platform.executable; |
17 » var bin_path = dart_path.substring(0, dart_path.lastIndexOf(Platform.pat
hSeparator)); | 17 var dart2js_path = 'dart2js'; |
18 » var dart2js_path = "$bin_path${Platform.pathSeparator}dart2js"; | 18 if (dart_path.lastIndexOf(Platform.pathSeparator) != -1) { |
| 19 var bin_path = dart_path.substring(0, dart_path.lastIndexOf(Platform.pathSep
arator)); |
| 20 dart2js_path = "$bin_path${Platform.pathSeparator}dart2js"; |
| 21 } |
19 var result = | 22 var result = |
20 Process.runSync(dart2js_path, | 23 Process.runSync(dart2js_path, |
21 [ '--minify', '-o', 'out/web/index.html_bootstrap.dart.js', | 24 [ '--minify', '-o', 'out/web/index.html_bootstrap.dart.js', |
22 'out/web/index.html_bootstrap.dart'], runInShell: true); | 25 'out/web/index.html_bootstrap.dart'], runInShell: true); |
23 print(result.stdout); | 26 print(result.stdout); |
24 print(result.stderr); | 27 print(result.stderr); |
25 if (result.exitCode != 0) { | 28 if (result.exitCode != 0) { |
26 print("Running dart2js failed."); | 29 print("Running dart2js failed."); |
27 exit(result.exitCode); | 30 exit(result.exitCode); |
28 } | 31 } |
29 print("Done"); | 32 print("Done"); |
30 } | 33 } |
OLD | NEW |