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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
253 } | 253 } |
254 | 254 |
255 /// Parses options from the command-line | 255 /// Parses options from the command-line |
256 CompilerOptions parseOptions(List<String> argv) { | 256 CompilerOptions parseOptions(List<String> argv) { |
257 ArgResults args = argParser.parse(argv); | 257 ArgResults args = argParser.parse(argv); |
258 var serverMode = args['server']; | 258 var serverMode = args['server']; |
259 var enableHashing = args['hashing']; | 259 var enableHashing = args['hashing']; |
260 if (enableHashing == null) { | 260 if (enableHashing == null) { |
261 enableHashing = serverMode; | 261 enableHashing = serverMode; |
262 } | 262 } |
263 // TODO(jmesserly): shouldn't level always default to warning? | |
vsm
2015/05/19 20:41:08
Eventually, yes. I bumped this up as I didn't wan
| |
263 var logLevel = serverMode ? Level.WARNING : Level.SEVERE; | 264 var logLevel = serverMode ? Level.WARNING : Level.SEVERE; |
264 var levelName = args['log']; | 265 var levelName = args['log']; |
265 if (levelName != null) { | 266 if (levelName != null) { |
266 levelName = levelName.toUpperCase(); | 267 levelName = levelName.toUpperCase(); |
267 logLevel = Level.LEVELS.firstWhere((l) => l.name == levelName, | 268 logLevel = Level.LEVELS.firstWhere((l) => l.name == levelName, |
268 orElse: () => logLevel); | 269 orElse: () => logLevel); |
269 } | 270 } |
270 var useColors = stdioType(stdout) == StdioType.TERMINAL; | 271 var useColors = stdioType(stdout) == StdioType.TERMINAL; |
271 var sdkPath = args['dart-sdk']; | 272 var sdkPath = args['dart-sdk']; |
272 if (sdkPath == null && !args['mock-sdk']) { | 273 if (sdkPath == null && !args['mock-sdk']) { |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
446 // The pub-cache directory is two levels up, but we verify that the layout | 447 // The pub-cache directory is two levels up, but we verify that the layout |
447 // looks correct. | 448 // looks correct. |
448 if (path.basename(dir) != 'dev_compiler') return null; | 449 if (path.basename(dir) != 'dev_compiler') return null; |
449 dir = path.dirname(dir); | 450 dir = path.dirname(dir); |
450 if (path.basename(dir) != 'global_packages') return null; | 451 if (path.basename(dir) != 'global_packages') return null; |
451 dir = path.dirname(dir); | 452 dir = path.dirname(dir); |
452 return path.join(dir, cacheDir, 'lib', 'runtime'); | 453 return path.join(dir, cacheDir, 'lib', 'runtime'); |
453 } | 454 } |
454 return null; | 455 return null; |
455 } | 456 } |
OLD | NEW |