Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/dart2js.dart

Issue 90713003: Dart2js option to dump info about compilation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 new OptionHandler(r'--help|/\?|/h', (_) => wantHelp = true), 275 new OptionHandler(r'--help|/\?|/h', (_) => wantHelp = true),
276 new OptionHandler('--package-root=.+|-p.+', setPackageRoot), 276 new OptionHandler('--package-root=.+|-p.+', setPackageRoot),
277 new OptionHandler('--analyze-all', passThrough), 277 new OptionHandler('--analyze-all', passThrough),
278 new OptionHandler('--analyze-only', setAnalyzeOnly), 278 new OptionHandler('--analyze-only', setAnalyzeOnly),
279 new OptionHandler('--analyze-signatures-only', passThrough), 279 new OptionHandler('--analyze-signatures-only', passThrough),
280 new OptionHandler('--disable-native-live-type-analysis', passThrough), 280 new OptionHandler('--disable-native-live-type-analysis', passThrough),
281 new OptionHandler('--categories=.*', setCategories), 281 new OptionHandler('--categories=.*', setCategories),
282 new OptionHandler('--global-js-name=.*', checkGlobalName), 282 new OptionHandler('--global-js-name=.*', checkGlobalName),
283 new OptionHandler('--disable-type-inference', passThrough), 283 new OptionHandler('--disable-type-inference', passThrough),
284 new OptionHandler('--terse', passThrough), 284 new OptionHandler('--terse', passThrough),
285 new OptionHandler('--dump-info', passThrough),
285 new OptionHandler('--disallow-unsafe-eval', 286 new OptionHandler('--disallow-unsafe-eval',
286 (_) => hasDisallowUnsafeEval = true), 287 (_) => hasDisallowUnsafeEval = true),
287 new OptionHandler('-D.+=.*', addInEnvironment), 288 new OptionHandler('-D.+=.*', addInEnvironment),
288 289
289 // The following two options must come last. 290 // The following two options must come last.
290 new OptionHandler('-.*', (String argument) { 291 new OptionHandler('-.*', (String argument) {
291 helpAndFail('Error: Unknown option "$argument".'); 292 helpAndFail('Error: Unknown option "$argument".');
292 }), 293 }),
293 new OptionHandler('.*', (String argument) { 294 new OptionHandler('.*', (String argument) {
294 arguments.add(nativeToUriPath(argument)); 295 arguments.add(nativeToUriPath(argument));
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 uri = out; 360 uri = out;
360 sourceMapFileName = 361 sourceMapFileName =
361 sourceMapOut.path.substring(sourceMapOut.path.lastIndexOf('/') + 1); 362 sourceMapOut.path.substring(sourceMapOut.path.lastIndexOf('/') + 1);
362 } else if (extension == 'precompiled.js') { 363 } else if (extension == 'precompiled.js') {
363 uri = computePrecompiledUri(); 364 uri = computePrecompiledUri();
364 diagnosticHandler.info( 365 diagnosticHandler.info(
365 "File ($uri) is compatible with header" 366 "File ($uri) is compatible with header"
366 " \"Content-Security-Policy: script-src 'self'\""); 367 " \"Content-Security-Policy: script-src 'self'\"");
367 } else if (extension == 'js.map' || extension == 'dart.map') { 368 } else if (extension == 'js.map' || extension == 'dart.map') {
368 uri = sourceMapOut; 369 uri = sourceMapOut;
370 } else if (extension == 'info.html') {
371 String outName = out.path.substring(out.path.lastIndexOf('/') + 1);
372 uri = out.resolve('${outName}.$extension');
369 } else { 373 } else {
370 fail('Error: Unknown extension: $extension'); 374 fail('Error: Unknown extension: $extension');
371 } 375 }
372 } else { 376 } else {
373 uri = out.resolve('$name.$extension'); 377 uri = out.resolve('$name.$extension');
374 } 378 }
375 379
376 if (uri.scheme != 'file') { 380 if (uri.scheme != 'file') {
377 fail('Error: Unhandled scheme ${uri.scheme} in $uri.'); 381 fail('Error: Unhandled scheme ${uri.scheme} in $uri.');
378 } 382 }
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 A comma separated list of allowed library categories. The default 573 A comma separated list of allowed library categories. The default
570 is "Client". Possible categories can be seen by providing an 574 is "Client". Possible categories can be seen by providing an
571 unsupported category, for example, --categories=help. To enable 575 unsupported category, for example, --categories=help. To enable
572 all categories, use --categories=all. 576 all categories, use --categories=all.
573 577
574 --global-js-name=<name> 578 --global-js-name=<name>
575 By default, dart2js generates JavaScript output that uses a global 579 By default, dart2js generates JavaScript output that uses a global
576 variable named "$". The name of this global can be overridden 580 variable named "$". The name of this global can be overridden
577 with this option. The name must match the regular expression "\$[a-z]*". 581 with this option. The name must match the regular expression "\$[a-z]*".
578 582
583 --dump-info
584 Given this option dart2js generates a out.info.html file with information
ahe 2013/11/27 18:01:31 "Given this option dart2js ..." is redundant.
sigurdm 2013/11/29 10:39:37 Done.
sigurdm 2013/11/29 10:39:37 Done.
585 about the generated code.
586
579 '''.trim()); 587 '''.trim());
580 } 588 }
581 589
582 void helpAndExit(bool wantHelp, bool wantVersion, bool verbose) { 590 void helpAndExit(bool wantHelp, bool wantVersion, bool verbose) {
583 if (wantVersion) { 591 if (wantVersion) {
584 var version = (BUILD_ID == null) 592 var version = (BUILD_ID == null)
585 ? '<non-SDK build>' 593 ? '<non-SDK build>'
586 : BUILD_ID; 594 : BUILD_ID;
587 print('Dart-to-JavaScript compiler (dart2js) version: $version'); 595 print('Dart-to-JavaScript compiler (dart2js) version: $version');
588 } 596 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 } 634 }
627 } 635 }
628 636
629 try { 637 try {
630 return compilerMain(arguments).catchError(onError); 638 return compilerMain(arguments).catchError(onError);
631 } catch (exception, trace) { 639 } catch (exception, trace) {
632 onError(exception, trace); 640 onError(exception, trace);
633 return new Future.value(); 641 return new Future.value();
634 } 642 }
635 } 643 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698