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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 /// Runs the compiler worker loop. | 69 /// Runs the compiler worker loop. |
70 class _CompilerWorker extends AsyncWorkerLoop { | 70 class _CompilerWorker extends AsyncWorkerLoop { |
71 /// The original args supplied to the executable. | 71 /// The original args supplied to the executable. |
72 final List<String> _startupArgs; | 72 final List<String> _startupArgs; |
73 | 73 |
74 _CompilerWorker(this._startupArgs) : super(); | 74 _CompilerWorker(this._startupArgs) : super(); |
75 | 75 |
76 /// Performs each individual work request. | 76 /// Performs each individual work request. |
77 Future<WorkResponse> performRequest(WorkRequest request) async { | 77 Future<WorkResponse> performRequest(WorkRequest request) async { |
78 var args = new List.from(_startupArgs)..addAll(request.arguments); | 78 var args = _startupArgs.toList()..addAll(request.arguments); |
79 | 79 |
80 var output = new StringBuffer(); | 80 var output = new StringBuffer(); |
81 var exitCode = await _runCommand(args, messageHandler: output.writeln); | 81 var exitCode = await _runCommand(args, messageHandler: output.writeln); |
82 AnalysisEngine.instance.clearCaches(); | 82 AnalysisEngine.instance.clearCaches(); |
83 return new WorkResponse() | 83 return new WorkResponse() |
84 ..exitCode = exitCode | 84 ..exitCode = exitCode |
85 ..output = output.toString(); | 85 ..output = output.toString(); |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 /// Bazel actions that support workers must provide all their per-WorkRequest | 136 /// Bazel actions that support workers must provide all their per-WorkRequest |
137 /// arguments in a file like this instead of as normal args. | 137 /// arguments in a file like this instead of as normal args. |
138 List<String> _preprocessArgs(List<String> args) { | 138 List<String> _preprocessArgs(List<String> args) { |
139 args = new List.from(args); | 139 args = new List.from(args); |
140 if (args.isNotEmpty && args.last.startsWith('@')) { | 140 if (args.isNotEmpty && args.last.startsWith('@')) { |
141 var fileArg = args.removeLast(); | 141 var fileArg = args.removeLast(); |
142 args.addAll(new File(fileArg.substring(1)).readAsLinesSync()); | 142 args.addAll(new File(fileArg.substring(1)).readAsLinesSync()); |
143 } | 143 } |
144 return args; | 144 return args; |
145 } | 145 } |
OLD | NEW |