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:convert' show UTF8, LineSplitter; | 9 import 'dart:convert' show UTF8, LineSplitter; |
10 import 'dart:io' | 10 import 'dart:io' |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
304 diagnosticHandler.showWarnings = false; | 304 diagnosticHandler.showWarnings = false; |
305 passThrough('--suppress-warnings'); | 305 passThrough('--suppress-warnings'); |
306 }), | 306 }), |
307 new OptionHandler('--fatal-warnings', passThrough), | 307 new OptionHandler('--fatal-warnings', passThrough), |
308 new OptionHandler('--suppress-hints', | 308 new OptionHandler('--suppress-hints', |
309 (_) => diagnosticHandler.showHints = false), | 309 (_) => diagnosticHandler.showHints = false), |
310 new OptionHandler( | 310 new OptionHandler( |
311 '--output-type=dart|--output-type=dart-multi|--output-type=js', | 311 '--output-type=dart|--output-type=dart-multi|--output-type=js', |
312 setOutputType), | 312 setOutputType), |
313 new OptionHandler('--use-cps-ir', passThrough), | 313 new OptionHandler('--use-cps-ir', passThrough), |
314 new OptionHandler('--use-frequency-naming', passThrough), | |
314 new OptionHandler('--verbose', setVerbose), | 315 new OptionHandler('--verbose', setVerbose), |
315 new OptionHandler('--version', (_) => wantVersion = true), | 316 new OptionHandler('--version', (_) => wantVersion = true), |
316 new OptionHandler('--library-root=.+', setLibraryRoot), | 317 new OptionHandler('--library-root=.+', setLibraryRoot), |
317 new OptionHandler('--out=.+|-o.*', setOutput, multipleArguments: true), | 318 new OptionHandler('--out=.+|-o.*', setOutput, multipleArguments: true), |
318 new OptionHandler('--allow-mock-compilation', passThrough), | 319 new OptionHandler('--allow-mock-compilation', passThrough), |
319 new OptionHandler('--minify|-m', implyCompilation), | 320 new OptionHandler('--minify|-m', implyCompilation), |
320 new OptionHandler('--preserve-uris', passThrough), | 321 new OptionHandler('--preserve-uris', passThrough), |
321 new OptionHandler('--force-strip=.*', setStrip), | 322 new OptionHandler('--force-strip=.*', setStrip), |
322 new OptionHandler('--disable-diagnostic-colors', | 323 new OptionHandler('--disable-diagnostic-colors', |
323 (_) => diagnosticHandler.enableColors = false), | 324 (_) => diagnosticHandler.enableColors = false), |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
399 "'--output-type=dart'."); | 400 "'--output-type=dart'."); |
400 } | 401 } |
401 if (arguments.isEmpty) { | 402 if (arguments.isEmpty) { |
402 helpAndFail('No Dart file specified.'); | 403 helpAndFail('No Dart file specified.'); |
403 } | 404 } |
404 if (arguments.length > 1) { | 405 if (arguments.length > 1) { |
405 var extra = arguments.sublist(1); | 406 var extra = arguments.sublist(1); |
406 helpAndFail('Extra arguments: ${extra.join(" ")}'); | 407 helpAndFail('Extra arguments: ${extra.join(" ")}'); |
407 } | 408 } |
408 | 409 |
409 if (checkedMode && trustTypeAnnotations) { | 410 if (checkedMode && trustTypeAnnotations) { |
sra1
2015/07/01 04:11:09
Maybe put a check like this that the experimental
herhut
2015/07/02 08:54:51
As I now use --no-frequency-based-minification, I
| |
410 helpAndFail("Option '--trust-type-annotations' may not be used in " | 411 helpAndFail("Option '--trust-type-annotations' may not be used in " |
411 "checked mode."); | 412 "checked mode."); |
412 } | 413 } |
413 | 414 |
414 if (packageRoot != null && packageConfig != null) { | 415 if (packageRoot != null && packageConfig != null) { |
415 helpAndFail("Cannot specify both '--package-root' and '--packages."); | 416 helpAndFail("Cannot specify both '--package-root' and '--packages."); |
416 } | 417 } |
417 | 418 |
418 if ((analyzeOnly || analyzeAll) && !optionsImplyCompilation.isEmpty) { | 419 if ((analyzeOnly || analyzeAll) && !optionsImplyCompilation.isEmpty) { |
419 if (!analyzeOnly) { | 420 if (!analyzeOnly) { |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
641 https://dart-lang.github.io/dump-info-visualizer/ | 642 https://dart-lang.github.io/dump-info-visualizer/ |
642 This feature is currently not supported in combination with the | 643 This feature is currently not supported in combination with the |
643 '--output-type=dart' option. | 644 '--output-type=dart' option. |
644 | 645 |
645 --generate-code-with-compile-time-errors | 646 --generate-code-with-compile-time-errors |
646 Generates output even if the program contains compile-time errors. Use the | 647 Generates output even if the program contains compile-time errors. Use the |
647 exit code to determine if compilation failed. | 648 exit code to determine if compilation failed. |
648 | 649 |
649 --use-cps-ir | 650 --use-cps-ir |
650 Experimental. Use the new CPS based backend for code generation. | 651 Experimental. Use the new CPS based backend for code generation. |
652 | |
653 --use-frequency-naming | |
654 Experimental. Use the new frequency based minifying namer. | |
651 '''.trim()); | 655 '''.trim()); |
652 } | 656 } |
653 | 657 |
654 void helpAndExit(bool wantHelp, bool wantVersion, bool verbose) { | 658 void helpAndExit(bool wantHelp, bool wantVersion, bool verbose) { |
655 if (wantVersion) { | 659 if (wantVersion) { |
656 var version = (BUILD_ID == null) | 660 var version = (BUILD_ID == null) |
657 ? '<non-SDK build>' | 661 ? '<non-SDK build>' |
658 : BUILD_ID; | 662 : BUILD_ID; |
659 print('Dart-to-JavaScript compiler (dart2js) version: $version'); | 663 print('Dart-to-JavaScript compiler (dart2js) version: $version'); |
660 } | 664 } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
755 } else if (exitCode == 253) { | 759 } else if (exitCode == 253) { |
756 print(">>> TEST CRASH"); | 760 print(">>> TEST CRASH"); |
757 } else { | 761 } else { |
758 print(">>> TEST FAIL"); | 762 print(">>> TEST FAIL"); |
759 } | 763 } |
760 stderr.writeln(">>> EOF STDERR"); | 764 stderr.writeln(">>> EOF STDERR"); |
761 subscription.resume(); | 765 subscription.resume(); |
762 }); | 766 }); |
763 }); | 767 }); |
764 } | 768 } |
OLD | NEW |