| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 return new AnalyzerOptions( | 68 return new AnalyzerOptions( |
| 69 summaryPaths: args['summary'] as List<String>, | 69 summaryPaths: args['summary'] as List<String>, |
| 70 dartSdkPath: sdkPath, | 70 dartSdkPath: sdkPath, |
| 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) { | 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', | 81 ..addOption('dart-sdk', |
| 82 help: 'Dart SDK Path', defaultsTo: null, hide: true) | 82 help: 'Dart SDK Path', defaultsTo: null, hide: hide) |
| 83 ..addOption('dart-sdk-summary', | 83 ..addOption('dart-sdk-summary', |
| 84 help: 'Dart SDK Summary Path', defaultsTo: null, hide: true) | 84 help: 'Dart SDK Summary Path', defaultsTo: null, hide: hide) |
| 85 ..addOption('package-root', | 85 ..addOption('package-root', |
| 86 abbr: 'p', help: 'Package root to resolve "package:" imports') | 86 abbr: 'p', help: 'Package root to resolve "package:" imports') |
| 87 ..addOption('url-mapping', | 87 ..addOption('url-mapping', |
| 88 help: '--url-mapping=libraryUri,/path/to/library.dart uses\n' | 88 help: '--url-mapping=libraryUri,/path/to/library.dart uses\n' |
| 89 'library.dart as the source for an import of of "libraryUri".', | 89 'library.dart as the source for an import of of "libraryUri".', |
| 90 allowMultiple: true, | 90 allowMultiple: true, |
| 91 splitCommas: false); | 91 splitCommas: false); |
| 92 } | 92 } |
| 93 | 93 |
| 94 static Map<String, String> _parseUrlMappings(Iterable argument) { | 94 static Map<String, String> _parseUrlMappings(Iterable argument) { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 // The format for defined variables is: | 190 // The format for defined variables is: |
| 191 // -D<name>=<value> | 191 // -D<name>=<value> |
| 192 var parts = arg.substring(2).split('='); | 192 var parts = arg.substring(2).split('='); |
| 193 declaredVars[parts[0]] = parts.length > 1 ? parts[1] : ''; | 193 declaredVars[parts[0]] = parts.length > 1 ? parts[1] : ''; |
| 194 } else { | 194 } else { |
| 195 remainingArgs.add(arg); | 195 remainingArgs.add(arg); |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 return remainingArgs; | 198 return remainingArgs; |
| 199 } | 199 } |
| OLD | NEW |