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/src/command_line/arguments.dart'; | 6 import 'package:analyzer/src/command_line/arguments.dart'; |
7 import 'package:analyzer/file_system/file_system.dart' | 7 import 'package:analyzer/file_system/file_system.dart' |
8 show ResourceProvider, ResourceUriResolver; | 8 show ResourceProvider, ResourceUriResolver; |
9 import 'package:analyzer/file_system/physical_file_system.dart' | 9 import 'package:analyzer/file_system/physical_file_system.dart' |
10 show PhysicalResourceProvider; | 10 show PhysicalResourceProvider; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 'library.dart as the source for an import of of "libraryUri".', | 97 'library.dart as the source for an import of of "libraryUri".', |
98 allowMultiple: true, | 98 allowMultiple: true, |
99 splitCommas: false); | 99 splitCommas: false); |
100 } | 100 } |
101 | 101 |
102 static Map<String, String> _parseUrlMappings(Iterable argument) { | 102 static Map<String, String> _parseUrlMappings(Iterable argument) { |
103 var mappings = <String, String>{}; | 103 var mappings = <String, String>{}; |
104 for (var mapping in argument) { | 104 for (var mapping in argument) { |
105 var splitMapping = mapping.split(','); | 105 var splitMapping = mapping.split(','); |
106 if (splitMapping.length >= 2) { | 106 if (splitMapping.length >= 2) { |
107 mappings[splitMapping[0]] = path.absolute(splitMapping[1]); | 107 mappings[splitMapping[0]] = path.canonicalize(splitMapping[1]); |
108 } | 108 } |
109 } | 109 } |
110 return mappings; | 110 return mappings; |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 /// Creates a SourceFactory configured by the [options]. | 114 /// Creates a SourceFactory configured by the [options]. |
115 /// | 115 /// |
116 /// If supplied, [fileResolvers] will override the default `file:` and | 116 /// If supplied, [fileResolvers] will override the default `file:` and |
117 /// `package:` URI resolvers. | 117 /// `package:` URI resolvers. |
(...skipping 29 matching lines...) Expand all Loading... |
147 builderOptions.defaultPackagesDirectoryPath = options.packageRoot; | 147 builderOptions.defaultPackagesDirectoryPath = options.packageRoot; |
148 } | 148 } |
149 ContextBuilder builder = new ContextBuilder(resourceProvider, null, null, | 149 ContextBuilder builder = new ContextBuilder(resourceProvider, null, null, |
150 options: builderOptions); | 150 options: builderOptions); |
151 return new PackageMapUriResolver(resourceProvider, | 151 return new PackageMapUriResolver(resourceProvider, |
152 builder.convertPackagesToMap(builder.createPackageMap(''))); | 152 builder.convertPackagesToMap(builder.createPackageMap(''))); |
153 } | 153 } |
154 | 154 |
155 return [new ResourceUriResolver(resourceProvider), packageResolver()]; | 155 return [new ResourceUriResolver(resourceProvider), packageResolver()]; |
156 } | 156 } |
OLD | NEW |