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 dart2js.cmdline; | 5 library dart2js.cmdline; |
6 | 6 |
7 import 'dart:async' | 7 import 'dart:async' |
8 show Future, EventSink; | 8 show Future, EventSink; |
9 import 'dart:io' | 9 import 'dart:io' |
10 show exit, File, FileMode, Platform, RandomAccessFile, FileSystemException, | 10 show exit, File, FileMode, Platform, RandomAccessFile, FileSystemException, |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } else { | 148 } else { |
149 path = extractParameter(arguments.current); | 149 path = extractParameter(arguments.current); |
150 } | 150 } |
151 explicitOut = true; | 151 explicitOut = true; |
152 out = currentDirectory.resolve(nativeToUriPath(path)); | 152 out = currentDirectory.resolve(nativeToUriPath(path)); |
153 sourceMapOut = Uri.parse('$out.map'); | 153 sourceMapOut = Uri.parse('$out.map'); |
154 } | 154 } |
155 | 155 |
156 setOutputType(String argument) { | 156 setOutputType(String argument) { |
157 optionsImplyCompilation.add(argument); | 157 optionsImplyCompilation.add(argument); |
158 if (argument == '--output-type=dart') { | 158 if (argument == '--output-type=dart' || |
| 159 argument == '--output-type=dart-multi') { |
159 outputLanguage = OUTPUT_LANGUAGE_DART; | 160 outputLanguage = OUTPUT_LANGUAGE_DART; |
160 if (!explicitOut) { | 161 if (!explicitOut) { |
161 out = currentDirectory.resolve('out.dart'); | 162 out = currentDirectory.resolve('out.dart'); |
162 sourceMapOut = currentDirectory.resolve('out.dart.map'); | 163 sourceMapOut = currentDirectory.resolve('out.dart.map'); |
163 } | 164 } |
164 } | 165 } |
165 passThrough(argument); | 166 passThrough(argument); |
166 } | 167 } |
167 | 168 |
168 String getDepsOutput(Map<String, SourceFile> sourceFiles) { | 169 String getDepsOutput(Map<String, SourceFile> sourceFiles) { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 List<String> arguments = <String>[]; | 273 List<String> arguments = <String>[]; |
273 List<OptionHandler> handlers = <OptionHandler>[ | 274 List<OptionHandler> handlers = <OptionHandler>[ |
274 new OptionHandler('-[chvm?]+', handleShortOptions), | 275 new OptionHandler('-[chvm?]+', handleShortOptions), |
275 new OptionHandler('--throw-on-error(?:=[0-9]+)?', handleThrowOnError), | 276 new OptionHandler('--throw-on-error(?:=[0-9]+)?', handleThrowOnError), |
276 new OptionHandler('--suppress-warnings', (_) { | 277 new OptionHandler('--suppress-warnings', (_) { |
277 diagnosticHandler.showWarnings = false; | 278 diagnosticHandler.showWarnings = false; |
278 passThrough('--suppress-warnings'); | 279 passThrough('--suppress-warnings'); |
279 }), | 280 }), |
280 new OptionHandler('--suppress-hints', | 281 new OptionHandler('--suppress-hints', |
281 (_) => diagnosticHandler.showHints = false), | 282 (_) => diagnosticHandler.showHints = false), |
282 new OptionHandler('--output-type=dart|--output-type=js', setOutputType), | 283 new OptionHandler( |
| 284 '--output-type=dart|--output-type=dart-multi|--output-type=js', |
| 285 setOutputType), |
283 new OptionHandler('--verbose', setVerbose), | 286 new OptionHandler('--verbose', setVerbose), |
284 new OptionHandler('--version', (_) => wantVersion = true), | 287 new OptionHandler('--version', (_) => wantVersion = true), |
285 new OptionHandler('--library-root=.+', setLibraryRoot), | 288 new OptionHandler('--library-root=.+', setLibraryRoot), |
286 new OptionHandler('--out=.+|-o.*', setOutput, multipleArguments: true), | 289 new OptionHandler('--out=.+|-o.*', setOutput, multipleArguments: true), |
287 new OptionHandler('--allow-mock-compilation', passThrough), | 290 new OptionHandler('--allow-mock-compilation', passThrough), |
288 new OptionHandler('--minify|-m', implyCompilation), | 291 new OptionHandler('--minify|-m', implyCompilation), |
289 new OptionHandler('--force-strip=.*', setStrip), | 292 new OptionHandler('--force-strip=.*', setStrip), |
290 new OptionHandler('--disable-diagnostic-colors', | 293 new OptionHandler('--disable-diagnostic-colors', |
291 (_) => diagnosticHandler.enableColors = false), | 294 (_) => diagnosticHandler.enableColors = false), |
292 new OptionHandler('--enable-diagnostic-colors', | 295 new OptionHandler('--enable-diagnostic-colors', |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 } else { | 734 } else { |
732 print(">>> TEST FAIL"); | 735 print(">>> TEST FAIL"); |
733 } | 736 } |
734 stderr.writeln(">>> EOF STDERR"); | 737 stderr.writeln(">>> EOF STDERR"); |
735 runJob(); | 738 runJob(); |
736 }); | 739 }); |
737 } | 740 } |
738 | 741 |
739 runJob(); | 742 runJob(); |
740 } | 743 } |
OLD | NEW |