| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 } | 252 } |
| 253 | 253 |
| 254 /// Parses options from the command-line | 254 /// Parses options from the command-line |
| 255 CompilerOptions parseOptions(List<String> argv) { | 255 CompilerOptions parseOptions(List<String> argv) { |
| 256 ArgResults args = argParser.parse(argv); | 256 ArgResults args = argParser.parse(argv); |
| 257 var serverMode = args['server']; | 257 var serverMode = args['server']; |
| 258 var enableHashing = args['hashing']; | 258 var enableHashing = args['hashing']; |
| 259 if (enableHashing == null) { | 259 if (enableHashing == null) { |
| 260 enableHashing = serverMode; | 260 enableHashing = serverMode; |
| 261 } | 261 } |
| 262 var logLevel = serverMode ? Level.ALL : Level.SEVERE; | 262 var logLevel = serverMode ? Level.WARNING : Level.SEVERE; |
| 263 var levelName = args['log']; | 263 var levelName = args['log']; |
| 264 if (levelName != null) { | 264 if (levelName != null) { |
| 265 levelName = levelName.toUpperCase(); | 265 levelName = levelName.toUpperCase(); |
| 266 logLevel = Level.LEVELS.firstWhere((l) => l.name == levelName, | 266 logLevel = Level.LEVELS.firstWhere((l) => l.name == levelName, |
| 267 orElse: () => logLevel); | 267 orElse: () => logLevel); |
| 268 } | 268 } |
| 269 var useColors = stdioType(stdout) == StdioType.TERMINAL; | 269 var useColors = stdioType(stdout) == StdioType.TERMINAL; |
| 270 var sdkPath = args['dart-sdk']; | 270 var sdkPath = args['dart-sdk']; |
| 271 if (sdkPath == null && !args['mock-sdk']) { | 271 if (sdkPath == null && !args['mock-sdk']) { |
| 272 sdkPath = getSdkDir(argv).path; | 272 sdkPath = getSdkDir(argv).path; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 // The pub-cache directory is two levels up, but we verify that the layout | 445 // The pub-cache directory is two levels up, but we verify that the layout |
| 446 // looks correct. | 446 // looks correct. |
| 447 if (path.basename(dir) != 'dev_compiler') return null; | 447 if (path.basename(dir) != 'dev_compiler') return null; |
| 448 dir = path.dirname(dir); | 448 dir = path.dirname(dir); |
| 449 if (path.basename(dir) != 'global_packages') return null; | 449 if (path.basename(dir) != 'global_packages') return null; |
| 450 dir = path.dirname(dir); | 450 dir = path.dirname(dir); |
| 451 return path.join(dir, cacheDir, 'lib', 'runtime'); | 451 return path.join(dir, cacheDir, 'lib', 'runtime'); |
| 452 } | 452 } |
| 453 return null; | 453 return null; |
| 454 } | 454 } |
| OLD | NEW |