Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env dart | 1 #!/usr/bin/env dart |
| 2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
| 4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 /// Command line entry point for Dart Development Compiler (dartdevc). | 6 /// Command line entry point for Dart Development Compiler (dartdevc). |
| 7 /// | 7 /// |
| 8 /// Supported commands are | 8 /// Supported commands are |
| 9 /// * compile: builds a collection of dart libraries into a single JS module | 9 /// * compile: builds a collection of dart libraries into a single JS module |
| 10 /// | 10 /// |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 /// * We didn't have a file watcher API at first, | 31 /// * We didn't have a file watcher API at first, |
| 32 /// * We had no conventions about where compiled output should go (or even | 32 /// * We had no conventions about where compiled output should go (or even |
| 33 /// that we would be compiling at all, vs running on an in-browser Dart VM), | 33 /// that we would be compiling at all, vs running on an in-browser Dart VM), |
| 34 /// * We wanted a good first impression with our simple examples, so we used | 34 /// * We wanted a good first impression with our simple examples, so we used |
| 35 /// local file servers, and users have an expectation of it now, even though | 35 /// local file servers, and users have an expectation of it now, even though |
| 36 /// it doesn't scale to typical apps that need their own real servers. | 36 /// it doesn't scale to typical apps that need their own real servers. |
| 37 | 37 |
| 38 import 'dart:io'; | 38 import 'dart:io'; |
| 39 import 'package:args/command_runner.dart'; | 39 import 'package:args/command_runner.dart'; |
| 40 import 'package:dev_compiler/src/compiler/command.dart'; | 40 import 'package:dev_compiler/src/compiler/command.dart'; |
| 41 import 'commands/global_compile.dart'; | |
|
Jennifer Messerly
2016/04/18 21:45:45
if we're going to keep this command or something l
| |
| 41 | 42 |
| 42 main(List<String> args) async { | 43 main(List<String> args) async { |
| 43 args = _preprocessArgs(args); | 44 args = _preprocessArgs(args); |
| 44 | 45 |
| 45 var runner = new CommandRunner('dartdevc', 'Dart Development Compiler'); | 46 var runner = new CommandRunner('dartdevc', 'Dart Development Compiler'); |
| 46 runner.addCommand(new CompileCommand()); | 47 runner.addCommand(new CompileCommand()); |
| 48 runner.addCommand(new GlobalCommand()); | |
| 47 try { | 49 try { |
| 48 await runner.run(args); | 50 await runner.run(args); |
| 49 } catch (e, s) { | 51 } catch (e, s) { |
| 50 exit(handleError(e, s, args)); | 52 exit(handleError(e, s, args)); |
| 51 } | 53 } |
| 52 } | 54 } |
| 53 | 55 |
| 54 /// If the final arg is `@file_path` then read in all the lines of that file | 56 /// If the final arg is `@file_path` then read in all the lines of that file |
| 55 /// and add those as args. | 57 /// and add those as args. |
| 56 /// | 58 /// |
| 57 /// Bazel actions that support workers must provide all their per-WorkRequest | 59 /// Bazel actions that support workers must provide all their per-WorkRequest |
| 58 /// arguments in a file like this instead of as normal args. | 60 /// arguments in a file like this instead of as normal args. |
| 59 List<String> _preprocessArgs(List<String> args) { | 61 List<String> _preprocessArgs(List<String> args) { |
| 60 if (args.isNotEmpty && args.last.startsWith('@')) { | 62 if (args.isNotEmpty && args.last.startsWith('@')) { |
| 61 return new List.from(args) | 63 return new List.from(args) |
| 62 ..addAll(new File(args.last.substring(1)).readAsLinesSync()); | 64 ..addAll(new File(args.last.substring(1)).readAsLinesSync()); |
| 63 } else { | 65 } else { |
| 64 return args; | 66 return args; |
| 65 } | 67 } |
| 66 } | 68 } |
| OLD | NEW |