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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 131 } |
132 | 132 |
133 /** | 133 /** |
134 * Generate the task dependency graph and return it as a [String]. | 134 * Generate the task dependency graph and return it as a [String]. |
135 */ | 135 */ |
136 String generateFileContents() { | 136 String generateFileContents() { |
137 List<String> lines = <String>[]; | 137 List<String> lines = <String>[]; |
138 resourceProvider = PhysicalResourceProvider.INSTANCE; | 138 resourceProvider = PhysicalResourceProvider.INSTANCE; |
139 DartSdk sdk = DirectoryBasedDartSdk.defaultSdk; | 139 DartSdk sdk = DirectoryBasedDartSdk.defaultSdk; |
140 context = AnalysisEngine.instance.createAnalysisContext(); | 140 context = AnalysisEngine.instance.createAnalysisContext(); |
141 JavaFile packagesDir = new JavaFile(path.join(rootDir, 'packages')); | 141 String packageRootPath; |
| 142 if (Platform.packageRoot.isNotEmpty) { |
| 143 packageRootPath = Platform.packageRoot; |
| 144 } else { |
| 145 packageRootPath = path.join(rootDir, 'packages'); |
| 146 } |
| 147 JavaFile packagesDir = new JavaFile(packageRootPath); |
142 List<UriResolver> uriResolvers = [ | 148 List<UriResolver> uriResolvers = [ |
143 new DartUriResolver(sdk), | 149 new DartUriResolver(sdk), |
144 new PackageUriResolver(<JavaFile>[packagesDir]), | 150 new PackageUriResolver(<JavaFile>[packagesDir]), |
145 new FileUriResolver() | 151 new FileUriResolver() |
146 ]; | 152 ]; |
147 context.sourceFactory = new SourceFactory(uriResolvers); | 153 context.sourceFactory = new SourceFactory(uriResolvers); |
148 Source dartDartSource = | 154 Source dartDartSource = |
149 setupSource(path.join('lib', 'src', 'task', 'dart.dart')); | 155 setupSource(path.join('lib', 'src', 'task', 'dart.dart')); |
150 Source taskSource = setupSource(path.join('lib', 'plugin', 'task.dart')); | 156 Source taskSource = setupSource(path.join('lib', 'plugin', 'task.dart')); |
151 Source modelSource = setupSource(path.join('lib', 'task', 'model.dart')); | 157 Source modelSource = setupSource(path.join('lib', 'task', 'model.dart')); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 @override | 337 @override |
332 visitIdentifier(Identifier node) { | 338 visitIdentifier(Identifier node) { |
333 Element element = node.staticElement; | 339 Element element = node.staticElement; |
334 if (element is PropertyAccessorElement && | 340 if (element is PropertyAccessorElement && |
335 element.isGetter && | 341 element.isGetter && |
336 element.returnType.isSubtypeOf(type)) { | 342 element.returnType.isSubtypeOf(type)) { |
337 callback(element); | 343 callback(element); |
338 } | 344 } |
339 } | 345 } |
340 } | 346 } |
OLD | NEW |