OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.src.options; | 5 library dart2js.src.options; |
6 | 6 |
7 import '../compiler.dart' show PackagesDiscoveryProvider; | 7 import '../compiler.dart' show PackagesDiscoveryProvider; |
8 import 'commandline_options.dart' show Flags; | 8 import 'commandline_options.dart' show Flags; |
9 | 9 |
10 /// Options used for controlling diagnostic messages. | 10 /// Options used for controlling diagnostic messages. |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 final bool useNewSourceInfo; | 223 final bool useNewSourceInfo; |
224 | 224 |
225 /// Whether the user requested to use the fast startup emitter. The full | 225 /// Whether the user requested to use the fast startup emitter. The full |
226 /// emitter might still be used if the program uses dart:mirrors. | 226 /// emitter might still be used if the program uses dart:mirrors. |
227 final bool useStartupEmitter; | 227 final bool useStartupEmitter; |
228 | 228 |
229 /// Enable verbose printing during compilation. Includes progress messages | 229 /// Enable verbose printing during compilation. Includes progress messages |
230 /// during each phase and a time-breakdown between phases at the end. | 230 /// during each phase and a time-breakdown between phases at the end. |
231 final bool verbose; | 231 final bool verbose; |
232 | 232 |
| 233 /// Track allocations in the JS output. |
| 234 /// |
| 235 /// This is an experimental feature. |
| 236 final bool trackAllocations; |
| 237 |
233 // ------------------------------------------------- | 238 // ------------------------------------------------- |
234 // Options for deprecated features | 239 // Options for deprecated features |
235 // ------------------------------------------------- | 240 // ------------------------------------------------- |
236 // TODO(sigmund): delete these as we delete the underlying features | 241 // TODO(sigmund): delete these as we delete the underlying features |
237 | 242 |
238 /// Whether to preserve comments while scanning (only use for dart:mirrors). | 243 /// Whether to preserve comments while scanning (only use for dart:mirrors). |
239 final bool preserveComments; | 244 final bool preserveComments; |
240 | 245 |
241 /// Strip option used by dart2dart. | 246 /// Strip option used by dart2dart. |
242 final List<String> strips; | 247 final List<String> strips; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 platformConfigUri: | 297 platformConfigUri: |
293 _resolvePlatformConfigFromOptions(libraryRoot, options), | 298 _resolvePlatformConfigFromOptions(libraryRoot, options), |
294 preserveComments: _hasOption(options, Flags.preserveComments), | 299 preserveComments: _hasOption(options, Flags.preserveComments), |
295 preserveUris: _hasOption(options, Flags.preserveUris), | 300 preserveUris: _hasOption(options, Flags.preserveUris), |
296 resolutionInputs: resolutionInputs, | 301 resolutionInputs: resolutionInputs, |
297 resolutionOutput: resolutionOutput, | 302 resolutionOutput: resolutionOutput, |
298 resolveOnly: _hasOption(options, Flags.resolveOnly), | 303 resolveOnly: _hasOption(options, Flags.resolveOnly), |
299 sourceMapUri: _extractUriOption(options, '--source-map='), | 304 sourceMapUri: _extractUriOption(options, '--source-map='), |
300 strips: _extractCsvOption(options, '--force-strip='), | 305 strips: _extractCsvOption(options, '--force-strip='), |
301 testMode: _hasOption(options, Flags.testMode), | 306 testMode: _hasOption(options, Flags.testMode), |
| 307 trackAllocations: _hasOption(options, Flags.trackAllocations), |
302 trustJSInteropTypeAnnotations: | 308 trustJSInteropTypeAnnotations: |
303 _hasOption(options, Flags.trustJSInteropTypeAnnotations), | 309 _hasOption(options, Flags.trustJSInteropTypeAnnotations), |
304 trustPrimitives: _hasOption(options, Flags.trustPrimitives), | 310 trustPrimitives: _hasOption(options, Flags.trustPrimitives), |
305 trustTypeAnnotations: _hasOption(options, Flags.trustTypeAnnotations), | 311 trustTypeAnnotations: _hasOption(options, Flags.trustTypeAnnotations), |
306 useContentSecurityPolicy: | 312 useContentSecurityPolicy: |
307 _hasOption(options, Flags.useContentSecurityPolicy), | 313 _hasOption(options, Flags.useContentSecurityPolicy), |
308 useKernel: _hasOption(options, Flags.useKernel), | 314 useKernel: _hasOption(options, Flags.useKernel), |
309 loadFromDill: _hasOption(options, Flags.loadFromDill), | 315 loadFromDill: _hasOption(options, Flags.loadFromDill), |
310 useFrequencyNamer: | 316 useFrequencyNamer: |
311 !_hasOption(options, Flags.noFrequencyBasedMinification), | 317 !_hasOption(options, Flags.noFrequencyBasedMinification), |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 Uri outputUri: null, | 361 Uri outputUri: null, |
356 Uri platformConfigUri: null, | 362 Uri platformConfigUri: null, |
357 bool preserveComments: false, | 363 bool preserveComments: false, |
358 bool preserveUris: false, | 364 bool preserveUris: false, |
359 List<Uri> resolutionInputs: null, | 365 List<Uri> resolutionInputs: null, |
360 Uri resolutionOutput: null, | 366 Uri resolutionOutput: null, |
361 bool resolveOnly: false, | 367 bool resolveOnly: false, |
362 Uri sourceMapUri: null, | 368 Uri sourceMapUri: null, |
363 List<String> strips: const [], | 369 List<String> strips: const [], |
364 bool testMode: false, | 370 bool testMode: false, |
| 371 bool trackAllocations: false, |
365 bool trustJSInteropTypeAnnotations: false, | 372 bool trustJSInteropTypeAnnotations: false, |
366 bool trustPrimitives: false, | 373 bool trustPrimitives: false, |
367 bool trustTypeAnnotations: false, | 374 bool trustTypeAnnotations: false, |
368 bool useContentSecurityPolicy: false, | 375 bool useContentSecurityPolicy: false, |
369 bool useKernel: false, | 376 bool useKernel: false, |
370 bool loadFromDill: false, | 377 bool loadFromDill: false, |
371 bool useFrequencyNamer: true, | 378 bool useFrequencyNamer: true, |
372 bool useMultiSourceInfo: false, | 379 bool useMultiSourceInfo: false, |
373 bool useNewSourceInfo: false, | 380 bool useNewSourceInfo: false, |
374 bool useStartupEmitter: false, | 381 bool useStartupEmitter: false, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 platformConfigUri: platformConfigUri ?? | 435 platformConfigUri: platformConfigUri ?? |
429 _resolvePlatformConfig(libraryRoot, null, const []), | 436 _resolvePlatformConfig(libraryRoot, null, const []), |
430 preserveComments: preserveComments, | 437 preserveComments: preserveComments, |
431 preserveUris: preserveUris, | 438 preserveUris: preserveUris, |
432 resolutionInputs: resolutionInputs, | 439 resolutionInputs: resolutionInputs, |
433 resolutionOutput: resolutionOutput, | 440 resolutionOutput: resolutionOutput, |
434 resolveOnly: resolveOnly, | 441 resolveOnly: resolveOnly, |
435 sourceMapUri: sourceMapUri, | 442 sourceMapUri: sourceMapUri, |
436 strips: strips, | 443 strips: strips, |
437 testMode: testMode, | 444 testMode: testMode, |
| 445 trackAllocations: trackAllocations, |
438 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations, | 446 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations, |
439 trustPrimitives: trustPrimitives, | 447 trustPrimitives: trustPrimitives, |
440 trustTypeAnnotations: trustTypeAnnotations, | 448 trustTypeAnnotations: trustTypeAnnotations, |
441 useContentSecurityPolicy: useContentSecurityPolicy, | 449 useContentSecurityPolicy: useContentSecurityPolicy, |
442 useKernel: useKernel, | 450 useKernel: useKernel, |
443 loadFromDill: loadFromDill, | 451 loadFromDill: loadFromDill, |
444 useFrequencyNamer: useFrequencyNamer, | 452 useFrequencyNamer: useFrequencyNamer, |
445 useMultiSourceInfo: useMultiSourceInfo, | 453 useMultiSourceInfo: useMultiSourceInfo, |
446 useNewSourceInfo: useNewSourceInfo, | 454 useNewSourceInfo: useNewSourceInfo, |
447 useStartupEmitter: useStartupEmitter, | 455 useStartupEmitter: useStartupEmitter, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 this.platformConfigUri: null, | 487 this.platformConfigUri: null, |
480 this.preserveComments: false, | 488 this.preserveComments: false, |
481 this.preserveUris: false, | 489 this.preserveUris: false, |
482 this.resolutionInputs: null, | 490 this.resolutionInputs: null, |
483 this.resolutionOutput: null, | 491 this.resolutionOutput: null, |
484 this.resolveOnly: false, | 492 this.resolveOnly: false, |
485 this.compileOnly: false, | 493 this.compileOnly: false, |
486 this.sourceMapUri: null, | 494 this.sourceMapUri: null, |
487 this.strips: const [], | 495 this.strips: const [], |
488 this.testMode: false, | 496 this.testMode: false, |
| 497 this.trackAllocations: false, |
489 this.trustJSInteropTypeAnnotations: false, | 498 this.trustJSInteropTypeAnnotations: false, |
490 this.trustPrimitives: false, | 499 this.trustPrimitives: false, |
491 this.trustTypeAnnotations: false, | 500 this.trustTypeAnnotations: false, |
492 this.useContentSecurityPolicy: false, | 501 this.useContentSecurityPolicy: false, |
493 this.useKernel: false, | 502 this.useKernel: false, |
494 this.loadFromDill: false, | 503 this.loadFromDill: false, |
495 this.useFrequencyNamer: false, | 504 this.useFrequencyNamer: false, |
496 this.useMultiSourceInfo: false, | 505 this.useMultiSourceInfo: false, |
497 this.useNewSourceInfo: false, | 506 this.useNewSourceInfo: false, |
498 this.useStartupEmitter: false, | 507 this.useStartupEmitter: false, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 platformConfigUri, | 546 platformConfigUri, |
538 preserveComments, | 547 preserveComments, |
539 preserveUris, | 548 preserveUris, |
540 resolutionInputs, | 549 resolutionInputs, |
541 resolutionOutput, | 550 resolutionOutput, |
542 resolveOnly, | 551 resolveOnly, |
543 compileOnly, | 552 compileOnly, |
544 sourceMapUri, | 553 sourceMapUri, |
545 strips, | 554 strips, |
546 testMode, | 555 testMode, |
| 556 trackAllocations, |
547 trustJSInteropTypeAnnotations, | 557 trustJSInteropTypeAnnotations, |
548 trustPrimitives, | 558 trustPrimitives, |
549 trustTypeAnnotations, | 559 trustTypeAnnotations, |
550 useContentSecurityPolicy, | 560 useContentSecurityPolicy, |
551 useKernel, | 561 useKernel, |
552 loadFromDill, | 562 loadFromDill, |
553 useFrequencyNamer, | 563 useFrequencyNamer, |
554 useMultiSourceInfo, | 564 useMultiSourceInfo, |
555 useNewSourceInfo, | 565 useNewSourceInfo, |
556 useStartupEmitter, | 566 useStartupEmitter, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 platformConfigUri: platformConfigUri ?? options.platformConfigUri, | 612 platformConfigUri: platformConfigUri ?? options.platformConfigUri, |
603 preserveComments: preserveComments ?? options.preserveComments, | 613 preserveComments: preserveComments ?? options.preserveComments, |
604 preserveUris: preserveUris ?? options.preserveUris, | 614 preserveUris: preserveUris ?? options.preserveUris, |
605 resolutionInputs: resolutionInputs ?? options.resolutionInputs, | 615 resolutionInputs: resolutionInputs ?? options.resolutionInputs, |
606 resolutionOutput: resolutionOutput ?? options.resolutionOutput, | 616 resolutionOutput: resolutionOutput ?? options.resolutionOutput, |
607 resolveOnly: resolveOnly ?? options.resolveOnly, | 617 resolveOnly: resolveOnly ?? options.resolveOnly, |
608 compileOnly: compileOnly ?? options.compileOnly, | 618 compileOnly: compileOnly ?? options.compileOnly, |
609 sourceMapUri: sourceMapUri ?? options.sourceMapUri, | 619 sourceMapUri: sourceMapUri ?? options.sourceMapUri, |
610 strips: strips ?? options.strips, | 620 strips: strips ?? options.strips, |
611 testMode: testMode ?? options.testMode, | 621 testMode: testMode ?? options.testMode, |
| 622 trackAllocations: trackAllocations ?? options.trackAllocations, |
612 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations ?? | 623 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations ?? |
613 options.trustJSInteropTypeAnnotations, | 624 options.trustJSInteropTypeAnnotations, |
614 trustPrimitives: trustPrimitives ?? options.trustPrimitives, | 625 trustPrimitives: trustPrimitives ?? options.trustPrimitives, |
615 trustTypeAnnotations: | 626 trustTypeAnnotations: |
616 trustTypeAnnotations ?? options.trustTypeAnnotations, | 627 trustTypeAnnotations ?? options.trustTypeAnnotations, |
617 useContentSecurityPolicy: | 628 useContentSecurityPolicy: |
618 useContentSecurityPolicy ?? options.useContentSecurityPolicy, | 629 useContentSecurityPolicy ?? options.useContentSecurityPolicy, |
619 useKernel: useKernel ?? options.useKernel, | 630 useKernel: useKernel ?? options.useKernel, |
620 loadFromDill: loadFromDill ?? options.loadFromDill, | 631 loadFromDill: loadFromDill ?? options.loadFromDill, |
621 useFrequencyNamer: useFrequencyNamer ?? options.useFrequencyNamer, | 632 useFrequencyNamer: useFrequencyNamer ?? options.useFrequencyNamer, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 _extractStringOption(options, "--platform-config=", null), | 728 _extractStringOption(options, "--platform-config=", null), |
718 _extractCsvOption(options, '--categories=')); | 729 _extractCsvOption(options, '--categories=')); |
719 } | 730 } |
720 | 731 |
721 /// Locations of the platform descriptor files relative to the library root. | 732 /// Locations of the platform descriptor files relative to the library root. |
722 const String _clientPlatform = "lib/dart_client.platform"; | 733 const String _clientPlatform = "lib/dart_client.platform"; |
723 const String _serverPlatform = "lib/dart_server.platform"; | 734 const String _serverPlatform = "lib/dart_server.platform"; |
724 const String _sharedPlatform = "lib/dart_shared.platform"; | 735 const String _sharedPlatform = "lib/dart_shared.platform"; |
725 | 736 |
726 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; | 737 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; |
OLD | NEW |