OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 analyzer_cli.src.options; | 5 library analyzer_cli.src.options; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import 'package:analyzer_cli/src/driver.dart'; | 9 import 'package:analyzer_cli/src/driver.dart'; |
10 import 'package:args/args.dart'; | 10 import 'package:args/args.dart'; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 strongMode = args['strong'], | 186 strongMode = args['strong'], |
187 lintsAreFatal = args['fatal-lints']; | 187 lintsAreFatal = args['fatal-lints']; |
188 | 188 |
189 /// Parse [args] into [CommandLineOptions] describing the specified | 189 /// Parse [args] into [CommandLineOptions] describing the specified |
190 /// analyzer options. In case of a format error, calls [printAndFail], which | 190 /// analyzer options. In case of a format error, calls [printAndFail], which |
191 /// by default prints an error message to stderr and exits. | 191 /// by default prints an error message to stderr and exits. |
192 static CommandLineOptions parse(List<String> args, | 192 static CommandLineOptions parse(List<String> args, |
193 [printAndFail(String msg) = printAndFail]) { | 193 [printAndFail(String msg) = printAndFail]) { |
194 CommandLineOptions options = _parse(args); | 194 CommandLineOptions options = _parse(args); |
195 // Check SDK. | 195 // Check SDK. |
196 { | 196 if (!options.buildModePersistentWorker) { |
197 // Infer if unspecified. | 197 // Infer if unspecified. |
198 if (options.dartSdkPath == null) { | 198 if (options.dartSdkPath == null) { |
199 Directory sdkDir = getSdkDir(args); | 199 Directory sdkDir = getSdkDir(args); |
200 if (sdkDir != null) { | 200 if (sdkDir != null) { |
201 options.dartSdkPath = sdkDir.path; | 201 options.dartSdkPath = sdkDir.path; |
202 } | 202 } |
203 } | 203 } |
204 | 204 |
205 var sdkPath = options.dartSdkPath; | 205 var sdkPath = options.dartSdkPath; |
206 | 206 |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 | 667 |
668 int _getNextFlagIndex(args, i) { | 668 int _getNextFlagIndex(args, i) { |
669 for (; i < args.length; ++i) { | 669 for (; i < args.length; ++i) { |
670 if (args[i].startsWith('--')) { | 670 if (args[i].startsWith('--')) { |
671 return i; | 671 return i; |
672 } | 672 } |
673 } | 673 } |
674 return i; | 674 return i; |
675 } | 675 } |
676 } | 676 } |
OLD | NEW |