| 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; | 10 show exit, File, FileMode, Platform, RandomAccessFile; |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 (_) => passThrough('--trust-type-annotations')), | 269 (_) => passThrough('--trust-type-annotations')), |
| 270 new OptionHandler(r'--help|/\?|/h', (_) => wantHelp = true), | 270 new OptionHandler(r'--help|/\?|/h', (_) => wantHelp = true), |
| 271 new OptionHandler('--package-root=.+|-p.+', setPackageRoot), | 271 new OptionHandler('--package-root=.+|-p.+', setPackageRoot), |
| 272 new OptionHandler('--analyze-all', passThrough), | 272 new OptionHandler('--analyze-all', passThrough), |
| 273 new OptionHandler('--analyze-only', setAnalyzeOnly), | 273 new OptionHandler('--analyze-only', setAnalyzeOnly), |
| 274 new OptionHandler('--analyze-signatures-only', passThrough), | 274 new OptionHandler('--analyze-signatures-only', passThrough), |
| 275 new OptionHandler('--disable-native-live-type-analysis', passThrough), | 275 new OptionHandler('--disable-native-live-type-analysis', passThrough), |
| 276 new OptionHandler('--categories=.*', setCategories), | 276 new OptionHandler('--categories=.*', setCategories), |
| 277 new OptionHandler('--disable-type-inference', passThrough), | 277 new OptionHandler('--disable-type-inference', passThrough), |
| 278 new OptionHandler('--terse', passThrough), | 278 new OptionHandler('--terse', passThrough), |
| 279 new OptionHandler('--dump-info', passThrough), |
| 279 new OptionHandler('--disallow-unsafe-eval', | 280 new OptionHandler('--disallow-unsafe-eval', |
| 280 (_) => hasDisallowUnsafeEval = true), | 281 (_) => hasDisallowUnsafeEval = true), |
| 281 new OptionHandler('-D.+=.*', addInEnvironment), | 282 new OptionHandler('-D.+=.*', addInEnvironment), |
| 282 | 283 |
| 283 // The following two options must come last. | 284 // The following two options must come last. |
| 284 new OptionHandler('-.*', (String argument) { | 285 new OptionHandler('-.*', (String argument) { |
| 285 helpAndFail('Error: Unknown option "$argument".'); | 286 helpAndFail('Error: Unknown option "$argument".'); |
| 286 }), | 287 }), |
| 287 new OptionHandler('.*', (String argument) { | 288 new OptionHandler('.*', (String argument) { |
| 288 arguments.add(nativeToUriPath(argument)); | 289 arguments.add(nativeToUriPath(argument)); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 uri = out; | 354 uri = out; |
| 354 sourceMapFileName = | 355 sourceMapFileName = |
| 355 sourceMapOut.path.substring(sourceMapOut.path.lastIndexOf('/') + 1); | 356 sourceMapOut.path.substring(sourceMapOut.path.lastIndexOf('/') + 1); |
| 356 } else if (extension == 'precompiled.js') { | 357 } else if (extension == 'precompiled.js') { |
| 357 uri = computePrecompiledUri(); | 358 uri = computePrecompiledUri(); |
| 358 diagnosticHandler.info( | 359 diagnosticHandler.info( |
| 359 "File ($uri) is compatible with header" | 360 "File ($uri) is compatible with header" |
| 360 " \"Content-Security-Policy: script-src 'self'\""); | 361 " \"Content-Security-Policy: script-src 'self'\""); |
| 361 } else if (extension == 'js.map' || extension == 'dart.map') { | 362 } else if (extension == 'js.map' || extension == 'dart.map') { |
| 362 uri = sourceMapOut; | 363 uri = sourceMapOut; |
| 364 } else if (extension == 'info.html') { |
| 365 String outName = out.path.substring(out.path.lastIndexOf('/') + 1); |
| 366 uri = out.resolve('${outName}.$extension'); |
| 363 } else { | 367 } else { |
| 364 fail('Error: Unknown extension: $extension'); | 368 fail('Error: Unknown extension: $extension'); |
| 365 } | 369 } |
| 366 } else { | 370 } else { |
| 367 uri = out.resolve('$name.$extension'); | 371 uri = out.resolve('$name.$extension'); |
| 368 } | 372 } |
| 369 | 373 |
| 370 if (uri.scheme != 'file') { | 374 if (uri.scheme != 'file') { |
| 371 fail('Error: Unhandled scheme ${uri.scheme} in $uri.'); | 375 fail('Error: Unhandled scheme ${uri.scheme} in $uri.'); |
| 372 } | 376 } |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 --disable-native-live-type-analysis | 563 --disable-native-live-type-analysis |
| 560 Disable the optimization that removes unused native types from dart:html | 564 Disable the optimization that removes unused native types from dart:html |
| 561 and related libraries. | 565 and related libraries. |
| 562 | 566 |
| 563 --categories=<categories> | 567 --categories=<categories> |
| 564 A comma separated list of allowed library categories. The default | 568 A comma separated list of allowed library categories. The default |
| 565 is "Client". Possible categories can be seen by providing an | 569 is "Client". Possible categories can be seen by providing an |
| 566 unsupported category, for example, --categories=help. To enable | 570 unsupported category, for example, --categories=help. To enable |
| 567 all categories, use --categories=all. | 571 all categories, use --categories=all. |
| 568 | 572 |
| 573 --dump-info |
| 574 Generates an out.info.html file with information about the generated code. |
| 569 '''.trim()); | 575 '''.trim()); |
| 570 } | 576 } |
| 571 | 577 |
| 572 void helpAndExit(bool wantHelp, bool wantVersion, bool verbose) { | 578 void helpAndExit(bool wantHelp, bool wantVersion, bool verbose) { |
| 573 if (wantVersion) { | 579 if (wantVersion) { |
| 574 var version = (BUILD_ID == null) | 580 var version = (BUILD_ID == null) |
| 575 ? '<non-SDK build>' | 581 ? '<non-SDK build>' |
| 576 : BUILD_ID; | 582 : BUILD_ID; |
| 577 print('Dart-to-JavaScript compiler (dart2js) version: $version'); | 583 print('Dart-to-JavaScript compiler (dart2js) version: $version'); |
| 578 } | 584 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 } | 622 } |
| 617 } | 623 } |
| 618 | 624 |
| 619 try { | 625 try { |
| 620 return compilerMain(arguments).catchError(onError); | 626 return compilerMain(arguments).catchError(onError); |
| 621 } catch (exception, trace) { | 627 } catch (exception, trace) { |
| 622 onError(exception, trace); | 628 onError(exception, trace); |
| 623 return new Future.value(); | 629 return new Future.value(); |
| 624 } | 630 } |
| 625 } | 631 } |
| OLD | NEW |