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 /** | 5 /** |
6 * This file contains code to output a description of tasks and their | 6 * This file contains code to output a description of tasks and their |
7 * dependencies in ".dot" format. Prior to running, the user should run "pub | 7 * dependencies in ".dot" format. Prior to running, the user should run "pub |
8 * get" in the analyzer directory to ensure that a "packages" folder exists. | 8 * get" in the analyzer directory to ensure that a "packages" folder exists. |
9 * | 9 * |
10 * TODO(paulberry): | 10 * TODO(paulberry): |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 String generateGraphData() { | 147 String generateGraphData() { |
148 if (!hasInitializedPlugins) { | 148 if (!hasInitializedPlugins) { |
149 AnalysisEngine.instance.processRequiredPlugins(); | 149 AnalysisEngine.instance.processRequiredPlugins(); |
150 hasInitializedPlugins = true; | 150 hasInitializedPlugins = true; |
151 } | 151 } |
152 List<String> lines = <String>[]; | 152 List<String> lines = <String>[]; |
153 resourceProvider = PhysicalResourceProvider.INSTANCE; | 153 resourceProvider = PhysicalResourceProvider.INSTANCE; |
154 DartSdk sdk = new FolderBasedDartSdk(resourceProvider, | 154 DartSdk sdk = new FolderBasedDartSdk(resourceProvider, |
155 FolderBasedDartSdk.defaultSdkDirectory(resourceProvider)); | 155 FolderBasedDartSdk.defaultSdkDirectory(resourceProvider)); |
156 context = AnalysisEngine.instance.createAnalysisContext(); | 156 context = AnalysisEngine.instance.createAnalysisContext(); |
157 String packageRootPath; | 157 ContextBuilder builder = new ContextBuilder(resourceProvider, null, null); |
158 if (Platform.packageRoot != null) { | 158 if (Platform.packageRoot != null) { |
159 packageRootPath = Uri.parse(Platform.packageRoot).toFilePath(); | 159 builder.defaultPackagesDirectoryPath = Uri.parse(Platform.packageRoot).toF
ilePath(); |
| 160 } else if (Platform.packageConfig != null) { |
| 161 builder.defaultPackageFilePath = Platform.packageConfig; |
160 } else { | 162 } else { |
161 packageRootPath = path.join(rootDir, 'packages'); | 163 // Let the context builder use the default algorithm for package |
| 164 // resolution. |
162 } | 165 } |
163 ContextBuilder builder = new ContextBuilder(resourceProvider, null, null); | |
164 builder.defaultPackagesDirectoryPath = packageRootPath; | |
165 List<UriResolver> uriResolvers = [ | 166 List<UriResolver> uriResolvers = [ |
166 new DartUriResolver(sdk), | 167 new DartUriResolver(sdk), |
167 new PackageMapUriResolver(resourceProvider, | 168 new PackageMapUriResolver(resourceProvider, |
168 builder.convertPackagesToMap(builder.createPackageMap(''))), | 169 builder.convertPackagesToMap(builder.createPackageMap(''))), |
169 new ResourceUriResolver(PhysicalResourceProvider.INSTANCE) | 170 new ResourceUriResolver(PhysicalResourceProvider.INSTANCE) |
170 ]; | 171 ]; |
171 context.sourceFactory = new SourceFactory(uriResolvers); | 172 context.sourceFactory = new SourceFactory(uriResolvers); |
172 Source dartDartSource = | 173 Source dartDartSource = |
173 setupSource(path.join('lib', 'src', 'task', 'dart.dart')); | 174 setupSource(path.join('lib', 'src', 'task', 'dart.dart')); |
174 Source taskSource = setupSource(path.join('lib', 'plugin', 'task.dart')); | 175 Source taskSource = setupSource(path.join('lib', 'plugin', 'task.dart')); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 @override | 354 @override |
354 visitIdentifier(Identifier node) { | 355 visitIdentifier(Identifier node) { |
355 Element element = node.staticElement; | 356 Element element = node.staticElement; |
356 if (element is PropertyAccessorElement && | 357 if (element is PropertyAccessorElement && |
357 element.isGetter && | 358 element.isGetter && |
358 element.returnType.isSubtypeOf(type)) { | 359 element.returnType.isSubtypeOf(type)) { |
359 callback(element); | 360 callback(element); |
360 } | 361 } |
361 } | 362 } |
362 } | 363 } |
OLD | NEW |