| 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 library css; | 5 library css; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:path/path.dart' as path; | 9 import 'package:path/path.dart' as path; |
| 10 import 'package:source_maps/span.dart' show SourceFile; | 10 import 'package:source_maps/span.dart' show SourceFile; |
| 11 | 11 |
| 12 import 'parser.dart'; | 12 import 'parser.dart'; |
| 13 import 'visitor.dart'; | 13 import 'visitor.dart'; |
| 14 import 'src/messages.dart'; | 14 import 'src/messages.dart'; |
| 15 import 'src/options.dart'; | 15 import 'src/options.dart'; |
| 16 | 16 |
| 17 void main() { | 17 void main(List<String> arguments) { |
| 18 // TODO(jmesserly): fix this to return a proper exit code | 18 // TODO(jmesserly): fix this to return a proper exit code |
| 19 var options = PreprocessorOptions.parse(new Options().arguments); | 19 var options = PreprocessorOptions.parse(arguments); |
| 20 if (options == null) return; | 20 if (options == null) return; |
| 21 | 21 |
| 22 messages = new Messages(options: options); | 22 messages = new Messages(options: options); |
| 23 | 23 |
| 24 _time('Total time spent on ${options.inputFile}', () { | 24 _time('Total time spent on ${options.inputFile}', () { |
| 25 _compile(options.inputFile, options.verbose); | 25 _compile(options.inputFile, options.verbose); |
| 26 }, true); | 26 }, true); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void _compile(String inputPath, bool verbose) { | 29 void _compile(String inputPath, bool verbose) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 void _printMessage(String message, int duration) { | 72 void _printMessage(String message, int duration) { |
| 73 var buf = new StringBuffer(); | 73 var buf = new StringBuffer(); |
| 74 buf.write(message); | 74 buf.write(message); |
| 75 for (int i = message.length; i < 60; i++) buf.write(' '); | 75 for (int i = message.length; i < 60; i++) buf.write(' '); |
| 76 buf.write(' -- '); | 76 buf.write(' -- '); |
| 77 if (duration < 10) buf.write(' '); | 77 if (duration < 10) buf.write(' '); |
| 78 if (duration < 100) buf.write(' '); | 78 if (duration < 100) buf.write(' '); |
| 79 buf..write(duration)..write(' ms'); | 79 buf..write(duration)..write(' ms'); |
| 80 print(buf.toString()); | 80 print(buf.toString()); |
| 81 } | 81 } |
| OLD | NEW |