| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** The entry point to the compiler. Used to implement `bin/dwc.dart`. */ | 5 /** The entry point to the compiler. Used to implement `bin/dwc.dart`. */ |
| 6 library dwc; | 6 library dwc; |
| 7 | 7 |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 import 'package:logging/logging.dart' show Level; | 9 import 'package:logging/logging.dart' show Level; |
| 10 import 'src/compiler.dart'; | 10 import 'src/compiler.dart'; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 * Runs the web components compiler with the command-line options in [args]. | 55 * Runs the web components compiler with the command-line options in [args]. |
| 56 * See [CompilerOptions] for the definition of valid arguments. | 56 * See [CompilerOptions] for the definition of valid arguments. |
| 57 */ | 57 */ |
| 58 // TODO(jmesserly): fix this to return a proper exit code | 58 // TODO(jmesserly): fix this to return a proper exit code |
| 59 // TODO(justinfagnani): return messages in the result | 59 // TODO(justinfagnani): return messages in the result |
| 60 Future<CompilerResult> run(List<String> args) { | 60 Future<CompilerResult> run(List<String> args) { |
| 61 var options = CompilerOptions.parse(args); | 61 var options = CompilerOptions.parse(args); |
| 62 if (options == null) return new Future.immediate(new CompilerResult()); | 62 if (options == null) return new Future.immediate(new CompilerResult()); |
| 63 | 63 |
| 64 fileSystem = new ConsoleFileSystem(); | 64 fileSystem = new ConsoleFileSystem(); |
| 65 messages = new Messages(options: options); | 65 messages = new Messages(options: options, shouldPrint: true); |
| 66 | 66 |
| 67 return asyncTime('Total time spent on ${options.inputFile}', () { | 67 return asyncTime('Total time spent on ${options.inputFile}', () { |
| 68 var currentDir = new Directory.current().path; | 68 var currentDir = new Directory.current().path; |
| 69 var compiler = new Compiler(fileSystem, options, currentDir); | 69 var compiler = new Compiler(fileSystem, options, currentDir); |
| 70 var res; | 70 var res; |
| 71 return compiler.run() | 71 return compiler.run() |
| 72 .transform((_) => (res = new CompilerResult._(messages, compiler.output))) | 72 .transform((_) => (res = new CompilerResult._(messages, compiler.output))) |
| 73 .chain((_) => symlinkPubPackages(res, options)) | 73 .chain((_) => symlinkPubPackages(res, options)) |
| 74 .chain((_) => emitFiles(compiler.output, options.clean)) | 74 .chain((_) => emitFiles(compiler.output, options.clean)) |
| 75 .transform((_) => res); | 75 .transform((_) => res); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 null); | 175 null); |
| 176 } | 176 } |
| 177 return null; | 177 return null; |
| 178 }); | 178 }); |
| 179 } | 179 } |
| 180 | 180 |
| 181 | 181 |
| 182 // TODO(sigmund): this conversion from dart:io paths to internal paths should | 182 // TODO(sigmund): this conversion from dart:io paths to internal paths should |
| 183 // go away when dartbug.com/5818 is fixed. | 183 // go away when dartbug.com/5818 is fixed. |
| 184 Path _convert(fs.Path path) => new Path(path.toString()); | 184 Path _convert(fs.Path path) => new Path(path.toString()); |
| OLD | NEW |