| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /// Set of flags and options passed to the compiler | 5 /// Set of flags and options passed to the compiler |
| 6 library dev_compiler.src.options; | 6 library dev_compiler.src.options; |
| 7 | 7 |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:args/args.dart'; | 10 import 'package:args/args.dart'; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 /// summary information (only used if [dumpInfo] is true). | 117 /// summary information (only used if [dumpInfo] is true). |
| 118 final String dumpInfoFile; | 118 final String dumpInfoFile; |
| 119 | 119 |
| 120 /// Directory where to dump the orignal but formatted Dart sources. This is | 120 /// Directory where to dump the orignal but formatted Dart sources. This is |
| 121 /// mainly used to make it easier to compare input and output files. | 121 /// mainly used to make it easier to compare input and output files. |
| 122 final String dumpSrcDir; | 122 final String dumpSrcDir; |
| 123 | 123 |
| 124 /// Whether to force compilation of code with static errors. | 124 /// Whether to force compilation of code with static errors. |
| 125 final bool forceCompile; | 125 final bool forceCompile; |
| 126 | 126 |
| 127 /// Whether to run the dart_style formatter on the generated Dart code. | 127 /// Whether to use a cheap formatter instead of dart_style. |
| 128 // TODO(jmesserly): old comment said this might not be a semantically correct |
| 129 // formatter. Why not? |
| 128 final bool formatOutput; | 130 final bool formatOutput; |
| 129 | 131 |
| 130 /// Whether to use a cheap formatter instead of dart_style. This might not be | |
| 131 /// a semantically correct formatter and it is used for testing only. | |
| 132 final bool cheapTestFormat; | |
| 133 | |
| 134 /// Output directory for generated code. | 132 /// Output directory for generated code. |
| 135 final String outputDir; | 133 final String outputDir; |
| 136 | 134 |
| 137 /// Whether to emit Dart output (false means to emit JS output). | 135 /// Whether to emit Dart output (false means to emit JS output). |
| 138 final bool outputDart; | 136 final bool outputDart; |
| 139 | 137 |
| 140 /// Whether to use colors when interacting on the console. | 138 /// Whether to use colors when interacting on the console. |
| 141 final bool useColors; | 139 final bool useColors; |
| 142 | 140 |
| 143 /// Whether the user asked for help. | 141 /// Whether the user asked for help. |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 final bool emitSourceMaps; | 232 final bool emitSourceMaps; |
| 235 | 233 |
| 236 /// Location for runtime files, such as `dart_runtime.js`. By default this is | 234 /// Location for runtime files, such as `dart_runtime.js`. By default this is |
| 237 /// inferred to be under `lib/runtime/` in the location of the `dev_compiler` | 235 /// inferred to be under `lib/runtime/` in the location of the `dev_compiler` |
| 238 /// package (if we can infer where that is located). | 236 /// package (if we can infer where that is located). |
| 239 final String runtimeDir; | 237 final String runtimeDir; |
| 240 | 238 |
| 241 CompilerOptions({this.allowConstCasts: true, this.checkSdk: false, | 239 CompilerOptions({this.allowConstCasts: true, this.checkSdk: false, |
| 242 this.dumpInfo: false, this.dumpInfoFile, this.dumpSrcDir, | 240 this.dumpInfo: false, this.dumpInfoFile, this.dumpSrcDir, |
| 243 this.forceCompile: false, this.formatOutput: false, | 241 this.forceCompile: false, this.formatOutput: false, |
| 244 this.cheapTestFormat: false, this.ignoreTypes: false, | 242 this.ignoreTypes: false, |
| 245 this.wrapClosures: RulesOptions.wrapClosuresDefault, this.outputDir, | 243 this.wrapClosures: RulesOptions.wrapClosuresDefault, this.outputDir, |
| 246 this.outputDart: false, this.useColors: true, | 244 this.outputDart: false, this.useColors: true, |
| 247 this.covariantGenerics: true, this.relaxedCasts: true, | 245 this.covariantGenerics: true, this.relaxedCasts: true, |
| 248 this.useMultiPackage: false, this.packageRoot: 'packages/', | 246 this.useMultiPackage: false, this.packageRoot: 'packages/', |
| 249 this.packagePaths: const <String>[], this.resources: const <String>[], | 247 this.packagePaths: const <String>[], this.resources: const <String>[], |
| 250 this.inferDownwards: RulesOptions.inferDownwardsDefault, | 248 this.inferDownwards: RulesOptions.inferDownwardsDefault, |
| 251 this.inferFromOverrides: ResolverOptions.inferFromOverridesDefault, | 249 this.inferFromOverrides: ResolverOptions.inferFromOverridesDefault, |
| 252 this.inferTransitively: ResolverOptions.inferTransitivelyDefault, | 250 this.inferTransitively: ResolverOptions.inferTransitivelyDefault, |
| 253 this.onlyInferConstsAndFinalFields: ResolverOptions.onlyInferConstAndFinal
FieldsDefault, | 251 this.onlyInferConstsAndFinalFields: ResolverOptions.onlyInferConstAndFinal
FieldsDefault, |
| 254 this.nonnullableTypes: TypeOptions.NONNULLABLE_TYPES, this.help: false, | 252 this.nonnullableTypes: TypeOptions.NONNULLABLE_TYPES, this.help: false, |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 // The pub-cache directory is two levels up, but we verify that the layout | 458 // The pub-cache directory is two levels up, but we verify that the layout |
| 461 // looks correct. | 459 // looks correct. |
| 462 if (path.basename(dir) != 'dev_compiler') return null; | 460 if (path.basename(dir) != 'dev_compiler') return null; |
| 463 dir = path.dirname(dir); | 461 dir = path.dirname(dir); |
| 464 if (path.basename(dir) != 'global_packages') return null; | 462 if (path.basename(dir) != 'global_packages') return null; |
| 465 dir = path.dirname(dir); | 463 dir = path.dirname(dir); |
| 466 return path.join(dir, cacheDir, 'lib', 'runtime'); | 464 return path.join(dir, cacheDir, 'lib', 'runtime'); |
| 467 } | 465 } |
| 468 return null; | 466 return null; |
| 469 } | 467 } |
| OLD | NEW |