OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 library templatetool; | 5 library templatetool; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 import 'template.dart'; | 8 import 'template.dart'; |
9 import '../lib/file_system.dart'; | 9 import '../lib/file_system.dart'; |
10 import '../lib/file_system_vm.dart'; | 10 import '../lib/file_system_vm.dart'; |
(...skipping 13 matching lines...) Expand all Loading... |
24 String GREEN_COLOR = '\u001b[32m'; | 24 String GREEN_COLOR = '\u001b[32m'; |
25 String NO_COLOR = '\u001b[0m'; | 25 String NO_COLOR = '\u001b[0m'; |
26 | 26 |
27 printStats(String phase, num elapsed, [String filename = '']) { | 27 printStats(String phase, num elapsed, [String filename = '']) { |
28 print('${phase} ${GREEN_COLOR}${filename}${NO_COLOR} in ${elapsed} msec.'); | 28 print('${phase} ${GREEN_COLOR}${filename}${NO_COLOR} in ${elapsed} msec.'); |
29 } | 29 } |
30 | 30 |
31 /** | 31 /** |
32 * Run from the `utils/css` directory. | 32 * Run from the `utils/css` directory. |
33 */ | 33 */ |
34 void main() { | 34 void main(List<String> optionArgs) { |
35 // argument 0 - sourcefile full path | 35 // argument 0 - sourcefile full path |
36 // argument 1 - outputfile full path | 36 // argument 1 - outputfile full path |
37 var optionArgs = new Options().arguments; | |
38 | |
39 String sourceFullFn = optionArgs[0]; | 37 String sourceFullFn = optionArgs[0]; |
40 String outputFullFn = optionArgs[1]; | 38 String outputFullFn = optionArgs[1]; |
41 | 39 |
42 String sourcePath; | 40 String sourcePath; |
43 String sourceFilename; | 41 String sourceFilename; |
44 int idxBeforeFilename = sourceFullFn.lastIndexOf('/'); | 42 int idxBeforeFilename = sourceFullFn.lastIndexOf('/'); |
45 if (idxBeforeFilename >= 0) { | 43 if (idxBeforeFilename >= 0) { |
46 sourcePath = sourceFullFn.substring(0, idxBeforeFilename + 1); | 44 sourcePath = sourceFullFn.substring(0, idxBeforeFilename + 1); |
47 sourceFilename = sourceFullFn.substring(idxBeforeFilename + 1); | 45 sourceFilename = sourceFullFn.substring(idxBeforeFilename + 1); |
48 } | 46 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 printStats("Parsed", parsedElapsed, sourceFullFn); | 98 printStats("Parsed", parsedElapsed, sourceFullFn); |
101 printStats("Codegen", codegenElapsed, sourceFullFn); | 99 printStats("Codegen", codegenElapsed, sourceFullFn); |
102 | 100 |
103 final outputElapsed = time(() { | 101 final outputElapsed = time(() { |
104 files.writeString(outputFullFn, code.toString()); | 102 files.writeString(outputFullFn, code.toString()); |
105 }); | 103 }); |
106 | 104 |
107 printStats("Wrote file", codegenElapsed, outputFullFn); | 105 printStats("Wrote file", codegenElapsed, outputFullFn); |
108 } | 106 } |
109 } | 107 } |
OLD | NEW |