| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 dartSdkSummaryPath: sdkSummaryPath, | 71 dartSdkSummaryPath: sdkSummaryPath, |
| 72 customUrlMappings: _parseUrlMappings(args['url-mapping']), | 72 customUrlMappings: _parseUrlMappings(args['url-mapping']), |
| 73 packageRoot: args['package-root'], | 73 packageRoot: args['package-root'], |
| 74 declaredVariables: declaredVariables); | 74 declaredVariables: declaredVariables); |
| 75 } | 75 } |
| 76 | 76 |
| 77 static void addArguments(ArgParser parser, {bool hide: true}) { | 77 static void addArguments(ArgParser parser, {bool hide: true}) { |
| 78 parser | 78 parser |
| 79 ..addOption('summary', | 79 ..addOption('summary', |
| 80 abbr: 's', help: 'summary file(s) to include', allowMultiple: true) | 80 abbr: 's', help: 'summary file(s) to include', allowMultiple: true) |
| 81 ..addOption('dart-sdk', | |
| 82 help: 'Dart SDK Path', defaultsTo: null, hide: hide) | |
| 83 ..addOption('dart-sdk-summary', | |
| 84 help: 'Dart SDK Summary Path', defaultsTo: null, hide: hide) | |
| 85 ..addOption('package-root', | |
| 86 abbr: 'p', help: 'Package root to resolve "package:" imports') | |
| 87 ..addOption('url-mapping', | 81 ..addOption('url-mapping', |
| 88 help: '--url-mapping=libraryUri,/path/to/library.dart uses\n' | 82 help: '--url-mapping=libraryUri,/path/to/library.dart uses\n' |
| 89 'library.dart as the source for an import of of "libraryUri".', | 83 'library.dart as the source for an import of of "libraryUri".', |
| 90 allowMultiple: true, | 84 allowMultiple: true, |
| 91 splitCommas: false); | 85 splitCommas: false); |
| 92 } | 86 } |
| 93 | 87 |
| 94 static Map<String, String> _parseUrlMappings(Iterable argument) { | 88 static Map<String, String> _parseUrlMappings(Iterable argument) { |
| 95 var mappings = <String, String>{}; | 89 var mappings = <String, String>{}; |
| 96 for (var mapping in argument) { | 90 for (var mapping in argument) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 return sdk; | 162 return sdk; |
| 169 } | 163 } |
| 170 | 164 |
| 171 /// Creates a [DartUriResolver] that uses the SDK at the given [sdkPath]. | 165 /// Creates a [DartUriResolver] that uses the SDK at the given [sdkPath]. |
| 172 DartUriResolver createSdkPathResolver(String sdkSummaryPath, String sdkPath) { | 166 DartUriResolver createSdkPathResolver(String sdkSummaryPath, String sdkPath) { |
| 173 var sdk = (sdkSummaryPath != null) | 167 var sdk = (sdkSummaryPath != null) |
| 174 ? new SummaryBasedDartSdk(sdkSummaryPath, true) | 168 ? new SummaryBasedDartSdk(sdkSummaryPath, true) |
| 175 : _createFolderBasedDartSdk(sdkPath); | 169 : _createFolderBasedDartSdk(sdkPath); |
| 176 return new DartUriResolver(sdk); | 170 return new DartUriResolver(sdk); |
| 177 } | 171 } |
| OLD | NEW |