| 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 import 'package:args/args.dart' show ArgParser, ArgResults; | 5 import 'package:args/args.dart' show ArgParser, ArgResults; |
| 6 import 'package:analyzer/file_system/file_system.dart' | 6 import 'package:analyzer/file_system/file_system.dart' |
| 7 show ResourceProvider, ResourceUriResolver; | 7 show ResourceProvider, ResourceUriResolver; |
| 8 import 'package:analyzer/file_system/physical_file_system.dart' | 8 import 'package:analyzer/file_system/physical_file_system.dart' |
| 9 show PhysicalResourceProvider; | 9 show PhysicalResourceProvider; |
| 10 import 'package:analyzer/source/custom_resolver.dart'; | 10 import 'package:analyzer/source/custom_resolver.dart'; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 return sdk; | 168 return sdk; |
| 169 } | 169 } |
| 170 | 170 |
| 171 /// Creates a [DartUriResolver] that uses the SDK at the given [sdkPath]. | 171 /// Creates a [DartUriResolver] that uses the SDK at the given [sdkPath]. |
| 172 DartUriResolver createSdkPathResolver(String sdkSummaryPath, String sdkPath) { | 172 DartUriResolver createSdkPathResolver(String sdkSummaryPath, String sdkPath) { |
| 173 var sdk = (sdkSummaryPath != null) | 173 var sdk = (sdkSummaryPath != null) |
| 174 ? new SummaryBasedDartSdk(sdkSummaryPath, true) | 174 ? new SummaryBasedDartSdk(sdkSummaryPath, true) |
| 175 : _createFolderBasedDartSdk(sdkPath); | 175 : _createFolderBasedDartSdk(sdkPath); |
| 176 return new DartUriResolver(sdk); | 176 return new DartUriResolver(sdk); |
| 177 } | 177 } |
| 178 | |
| 179 List<String> parseDeclaredVariables( | |
| 180 List<String> args, Map<String, String> declaredVars) { | |
| 181 var count = args.length; | |
| 182 var remainingArgs = <String>[]; | |
| 183 for (int i = 0; i < count; i++) { | |
| 184 var arg = args[i]; | |
| 185 if (arg == '--') { | |
| 186 while (i < count) { | |
| 187 remainingArgs.add(args[i++]); | |
| 188 } | |
| 189 } else if (arg.startsWith("-D")) { | |
| 190 // The format for defined variables is: | |
| 191 // -D<name>=<value> | |
| 192 var parts = arg.substring(2).split('='); | |
| 193 declaredVars[parts[0]] = parts.length > 1 ? parts[1] : ''; | |
| 194 } else { | |
| 195 remainingArgs.add(arg); | |
| 196 } | |
| 197 } | |
| 198 return remainingArgs; | |
| 199 } | |
| OLD | NEW |