OLD | NEW |
| (Empty) |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
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. | |
4 | |
5 library source.package_map_provider; | |
6 | |
7 import 'package:analyzer/file_system/file_system.dart'; | |
8 | |
9 /** | |
10 * Data structure output by PackageMapProvider. This contains both the package | |
11 * map and dependency information. | |
12 */ | |
13 class PackageMapInfo { | |
14 /** | |
15 * The package map itself. This is a map from package name to a list of | |
16 * the folders containing source code for the package. | |
17 * | |
18 * `null` if an error occurred. | |
19 */ | |
20 Map<String, List<Folder>> packageMap; | |
21 | |
22 /** | |
23 * Dependency information. This is a set of the paths which were consulted | |
24 * in order to generate the package map. If any of these files is | |
25 * modified, the package map will need to be regenerated. | |
26 */ | |
27 Set<String> dependencies; | |
28 | |
29 PackageMapInfo(this.packageMap, this.dependencies); | |
30 } | |
31 | |
32 /** | |
33 * A PackageMapProvider is an entity capable of determining the mapping from | |
34 * package name to source directory for a given folder. | |
35 */ | |
36 abstract class PackageMapProvider { | |
37 /** | |
38 * Compute a package map for the given folder, if possible. | |
39 * | |
40 * If a package map can't be computed (e.g. because an error occurred), a | |
41 * [PackageMapInfo] will still be returned, but its packageMap will be null. | |
42 */ | |
43 PackageMapInfo computePackageMap(Folder folder); | |
44 } | |
OLD | NEW |