| 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 'commandline_options.dart' show Flags; | 7 import 'commandline_options.dart' show Flags; |
| 8 import '../compiler.dart' show PackagesDiscoveryProvider; | 8 import '../compiler.dart' show PackagesDiscoveryProvider; |
| 9 | 9 |
| 10 /// Options used for parsing. | 10 /// Options used for parsing. |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 /// URI of the main output if the compiler is generating source maps. | 181 /// URI of the main output if the compiler is generating source maps. |
| 182 final Uri outputUri; | 182 final Uri outputUri; |
| 183 | 183 |
| 184 /// Location of the platform configuration file. | 184 /// Location of the platform configuration file. |
| 185 final Uri platformConfigUri; | 185 final Uri platformConfigUri; |
| 186 | 186 |
| 187 /// Whether to emit URIs in the reflection metadata. | 187 /// Whether to emit URIs in the reflection metadata. |
| 188 final bool preserveUris; | 188 final bool preserveUris; |
| 189 | 189 |
| 190 /// The location of serialized data used for resolution. | 190 /// The locations of serialized data used for resolution. |
| 191 final Uri resolutionInput; | 191 final List<Uri> resolutionInputs; |
| 192 | 192 |
| 193 /// The location of the serialized data from resolution. | 193 /// The location of the serialized data from resolution. |
| 194 final Uri resolutionOutput; | 194 final Uri resolutionOutput; |
| 195 | 195 |
| 196 // If `true`, sources are resolved and serialized. | 196 // If `true`, sources are resolved and serialized. |
| 197 final bool resolveOnly; | 197 final bool resolveOnly; |
| 198 | 198 |
| 199 /// URI where the compiler should generate the output source map file. | 199 /// URI where the compiler should generate the output source map file. |
| 200 final Uri sourceMapUri; | 200 final Uri sourceMapUri; |
| 201 | 201 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 249 |
| 250 /// Strip option used by dart2dart. | 250 /// Strip option used by dart2dart. |
| 251 final List<String> strips; | 251 final List<String> strips; |
| 252 | 252 |
| 253 /// Create an options object by parsing flags from [options]. | 253 /// Create an options object by parsing flags from [options]. |
| 254 factory CompilerOptions.parse( | 254 factory CompilerOptions.parse( |
| 255 {Uri entryPoint, | 255 {Uri entryPoint, |
| 256 Uri libraryRoot, | 256 Uri libraryRoot, |
| 257 Uri packageRoot, | 257 Uri packageRoot, |
| 258 Uri packageConfig, | 258 Uri packageConfig, |
| 259 Uri resolutionInput, | 259 List<Uri> resolutionInputs, |
| 260 Uri resolutionOutput, | 260 Uri resolutionOutput, |
| 261 PackagesDiscoveryProvider packagesDiscoveryProvider, | 261 PackagesDiscoveryProvider packagesDiscoveryProvider, |
| 262 Map<String, dynamic> environment: const <String, dynamic>{}, | 262 Map<String, dynamic> environment: const <String, dynamic>{}, |
| 263 List<String> options}) { | 263 List<String> options}) { |
| 264 return new CompilerOptions( | 264 return new CompilerOptions( |
| 265 entryPoint: entryPoint, | 265 entryPoint: entryPoint, |
| 266 libraryRoot: libraryRoot, | 266 libraryRoot: libraryRoot, |
| 267 packageRoot: packageRoot, | 267 packageRoot: packageRoot, |
| 268 packageConfig: packageConfig, | 268 packageConfig: packageConfig, |
| 269 packagesDiscoveryProvider: packagesDiscoveryProvider, | 269 packagesDiscoveryProvider: packagesDiscoveryProvider, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 generateCodeWithCompileTimeErrors: | 302 generateCodeWithCompileTimeErrors: |
| 303 _hasOption(options, Flags.generateCodeWithCompileTimeErrors), | 303 _hasOption(options, Flags.generateCodeWithCompileTimeErrors), |
| 304 generateSourceMap: !_hasOption(options, Flags.noSourceMaps), | 304 generateSourceMap: !_hasOption(options, Flags.noSourceMaps), |
| 305 hasIncrementalSupport: _forceIncrementalSupport || | 305 hasIncrementalSupport: _forceIncrementalSupport || |
| 306 _hasOption(options, Flags.incrementalSupport), | 306 _hasOption(options, Flags.incrementalSupport), |
| 307 outputUri: _extractUriOption(options, '--out='), | 307 outputUri: _extractUriOption(options, '--out='), |
| 308 platformConfigUri: | 308 platformConfigUri: |
| 309 _resolvePlatformConfigFromOptions(libraryRoot, options), | 309 _resolvePlatformConfigFromOptions(libraryRoot, options), |
| 310 preserveComments: _hasOption(options, Flags.preserveComments), | 310 preserveComments: _hasOption(options, Flags.preserveComments), |
| 311 preserveUris: _hasOption(options, Flags.preserveUris), | 311 preserveUris: _hasOption(options, Flags.preserveUris), |
| 312 resolutionInput: resolutionInput, | 312 resolutionInputs: resolutionInputs, |
| 313 resolutionOutput: resolutionOutput, | 313 resolutionOutput: resolutionOutput, |
| 314 resolveOnly: _hasOption(options, Flags.resolveOnly), | 314 resolveOnly: _hasOption(options, Flags.resolveOnly), |
| 315 sourceMapUri: _extractUriOption(options, '--source-map='), | 315 sourceMapUri: _extractUriOption(options, '--source-map='), |
| 316 strips: _extractCsvOption(options, '--force-strip='), | 316 strips: _extractCsvOption(options, '--force-strip='), |
| 317 testMode: _hasOption(options, Flags.testMode), | 317 testMode: _hasOption(options, Flags.testMode), |
| 318 trustJSInteropTypeAnnotations: | 318 trustJSInteropTypeAnnotations: |
| 319 _hasOption(options, Flags.trustJSInteropTypeAnnotations), | 319 _hasOption(options, Flags.trustJSInteropTypeAnnotations), |
| 320 trustPrimitives: _hasOption(options, Flags.trustPrimitives), | 320 trustPrimitives: _hasOption(options, Flags.trustPrimitives), |
| 321 trustTypeAnnotations: _hasOption(options, Flags.trustTypeAnnotations), | 321 trustTypeAnnotations: _hasOption(options, Flags.trustTypeAnnotations), |
| 322 useContentSecurityPolicy: | 322 useContentSecurityPolicy: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 bool enableNativeLiveTypeAnalysis: true, | 366 bool enableNativeLiveTypeAnalysis: true, |
| 367 bool enableTypeAssertions: false, | 367 bool enableTypeAssertions: false, |
| 368 bool enableUserAssertions: false, | 368 bool enableUserAssertions: false, |
| 369 bool generateCodeWithCompileTimeErrors: false, | 369 bool generateCodeWithCompileTimeErrors: false, |
| 370 bool generateSourceMap: true, | 370 bool generateSourceMap: true, |
| 371 bool hasIncrementalSupport: false, | 371 bool hasIncrementalSupport: false, |
| 372 Uri outputUri: null, | 372 Uri outputUri: null, |
| 373 Uri platformConfigUri: null, | 373 Uri platformConfigUri: null, |
| 374 bool preserveComments: false, | 374 bool preserveComments: false, |
| 375 bool preserveUris: false, | 375 bool preserveUris: false, |
| 376 Uri resolutionInput: null, | 376 List<Uri> resolutionInputs: null, |
| 377 Uri resolutionOutput: null, | 377 Uri resolutionOutput: null, |
| 378 bool resolveOnly: false, | 378 bool resolveOnly: false, |
| 379 Uri sourceMapUri: null, | 379 Uri sourceMapUri: null, |
| 380 List<String> strips: const [], | 380 List<String> strips: const [], |
| 381 bool testMode: false, | 381 bool testMode: false, |
| 382 bool trustJSInteropTypeAnnotations: false, | 382 bool trustJSInteropTypeAnnotations: false, |
| 383 bool trustPrimitives: false, | 383 bool trustPrimitives: false, |
| 384 bool trustTypeAnnotations: false, | 384 bool trustTypeAnnotations: false, |
| 385 bool useContentSecurityPolicy: false, | 385 bool useContentSecurityPolicy: false, |
| 386 bool useCpsIr: false, | 386 bool useCpsIr: false, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 enableUserAssertions: enableUserAssertions, | 441 enableUserAssertions: enableUserAssertions, |
| 442 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors, | 442 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors, |
| 443 generateSourceMap: generateSourceMap, | 443 generateSourceMap: generateSourceMap, |
| 444 hasIncrementalSupport: hasIncrementalSupport, | 444 hasIncrementalSupport: hasIncrementalSupport, |
| 445 outputUri: outputUri, | 445 outputUri: outputUri, |
| 446 platformConfigUri: platformConfigUri ?? | 446 platformConfigUri: platformConfigUri ?? |
| 447 _resolvePlatformConfig( | 447 _resolvePlatformConfig( |
| 448 libraryRoot, null, !emitJavaScript, const []), | 448 libraryRoot, null, !emitJavaScript, const []), |
| 449 preserveComments: preserveComments, | 449 preserveComments: preserveComments, |
| 450 preserveUris: preserveUris, | 450 preserveUris: preserveUris, |
| 451 resolutionInput: resolutionInput, | 451 resolutionInputs: resolutionInputs, |
| 452 resolutionOutput: resolutionOutput, | 452 resolutionOutput: resolutionOutput, |
| 453 resolveOnly: resolveOnly, | 453 resolveOnly: resolveOnly, |
| 454 sourceMapUri: sourceMapUri, | 454 sourceMapUri: sourceMapUri, |
| 455 strips: strips, | 455 strips: strips, |
| 456 testMode: testMode, | 456 testMode: testMode, |
| 457 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations, | 457 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations, |
| 458 trustPrimitives: trustPrimitives, | 458 trustPrimitives: trustPrimitives, |
| 459 trustTypeAnnotations: trustTypeAnnotations, | 459 trustTypeAnnotations: trustTypeAnnotations, |
| 460 useContentSecurityPolicy: useContentSecurityPolicy, | 460 useContentSecurityPolicy: useContentSecurityPolicy, |
| 461 useCpsIr: useCpsIr, | 461 useCpsIr: useCpsIr, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 492 this.enableNativeLiveTypeAnalysis: false, | 492 this.enableNativeLiveTypeAnalysis: false, |
| 493 this.enableTypeAssertions: false, | 493 this.enableTypeAssertions: false, |
| 494 this.enableUserAssertions: false, | 494 this.enableUserAssertions: false, |
| 495 this.generateCodeWithCompileTimeErrors: false, | 495 this.generateCodeWithCompileTimeErrors: false, |
| 496 this.generateSourceMap: true, | 496 this.generateSourceMap: true, |
| 497 this.hasIncrementalSupport: false, | 497 this.hasIncrementalSupport: false, |
| 498 this.outputUri: null, | 498 this.outputUri: null, |
| 499 this.platformConfigUri: null, | 499 this.platformConfigUri: null, |
| 500 this.preserveComments: false, | 500 this.preserveComments: false, |
| 501 this.preserveUris: false, | 501 this.preserveUris: false, |
| 502 this.resolutionInput: null, | 502 this.resolutionInputs: null, |
| 503 this.resolutionOutput: null, | 503 this.resolutionOutput: null, |
| 504 this.resolveOnly: false, | 504 this.resolveOnly: false, |
| 505 this.sourceMapUri: null, | 505 this.sourceMapUri: null, |
| 506 this.strips: const [], | 506 this.strips: const [], |
| 507 this.testMode: false, | 507 this.testMode: false, |
| 508 this.trustJSInteropTypeAnnotations: false, | 508 this.trustJSInteropTypeAnnotations: false, |
| 509 this.trustPrimitives: false, | 509 this.trustPrimitives: false, |
| 510 this.trustTypeAnnotations: false, | 510 this.trustTypeAnnotations: false, |
| 511 this.useContentSecurityPolicy: false, | 511 this.useContentSecurityPolicy: false, |
| 512 this.useCpsIr: false, | 512 this.useCpsIr: false, |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 | 614 |
| 615 /// Locations of the platform descriptor files relative to the library root. | 615 /// Locations of the platform descriptor files relative to the library root. |
| 616 const String _clientPlatform = "lib/dart_client.platform"; | 616 const String _clientPlatform = "lib/dart_client.platform"; |
| 617 const String _serverPlatform = "lib/dart_server.platform"; | 617 const String _serverPlatform = "lib/dart_server.platform"; |
| 618 const String _sharedPlatform = "lib/dart_shared.platform"; | 618 const String _sharedPlatform = "lib/dart_shared.platform"; |
| 619 const String _dart2dartPlatform = "lib/dart2dart.platform"; | 619 const String _dart2dartPlatform = "lib/dart2dart.platform"; |
| 620 | 620 |
| 621 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; | 621 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; |
| 622 const bool _forceIncrementalSupport = | 622 const bool _forceIncrementalSupport = |
| 623 const bool.fromEnvironment('DART2JS_EXPERIMENTAL_INCREMENTAL_SUPPORT'); | 623 const bool.fromEnvironment('DART2JS_EXPERIMENTAL_INCREMENTAL_SUPPORT'); |
| OLD | NEW |