| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 import 'package:polymer/builder.dart'; | |
| 6 import 'dart:io'; | |
| 7 import 'dart:async'; | |
| 8 | |
| 9 main() { | |
| 10 lint() | |
| 11 .then((_) => deploy()).then(compileToJs); | |
| 12 } | |
| 13 | |
| 14 String findDart2JS() { | |
| 15 var dartPath = Platform.executable; | |
| 16 var lastIndex = dartPath.lastIndexOf(Platform.pathSeparator); | |
| 17 if (lastIndex != -1) { | |
| 18 var binPath = dartPath.substring(0, lastIndex); | |
| 19 return '$binPath${Platform.pathSeparator}dart2js'; | |
| 20 } | |
| 21 return 'dart2js'; | |
| 22 } | |
| 23 | |
| 24 void runDart2JS(String input, String output) { | |
| 25 var dart2js_path = findDart2JS(); | |
| 26 var result = | |
| 27 Process.runSync(dart2js_path, | |
| 28 [ '--minify', '-o', output, input], runInShell: true); | |
| 29 print(result.stdout); | |
| 30 print(result.stderr); | |
| 31 if (result.exitCode != 0) { | |
| 32 print("Running dart2js failed."); | |
| 33 exit(result.exitCode); | |
| 34 } | |
| 35 } | |
| 36 | |
| 37 compileToJs(_) { | |
| 38 print("Running dart2js"); | |
| 39 runDart2JS('out/web/index.html_bootstrap.dart', | |
| 40 'out/web/index.html_bootstrap.dart.js'); | |
| 41 runDart2JS('out/web/index_devtools.html_bootstrap.dart', | |
| 42 'out/web/index_devtools.html_bootstrap.dart.js'); | |
| 43 print("Done"); | |
| 44 } | |
| OLD | NEW |