| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 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 | 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 library package.map.provider; | 5 library package.map.provider; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:io' as io; | 9 import 'dart:io' as io; |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 * Data structure output by PackageMapProvider. This contains both the package | 31 * Data structure output by PackageMapProvider. This contains both the package |
| 32 * map and dependency information. | 32 * map and dependency information. |
| 33 */ | 33 */ |
| 34 class PackageMapInfo { | 34 class PackageMapInfo { |
| 35 /** | 35 /** |
| 36 * The package map itself. This is a map from package name to a list of | 36 * The package map itself. This is a map from package name to a list of |
| 37 * the folders containing source code for the package. | 37 * the folders containing source code for the package. |
| 38 * | 38 * |
| 39 * `null` if an error occurred. | 39 * `null` if an error occurred. |
| 40 */ | 40 */ |
| 41 HashMap<String, List<Folder>> packageMap; | 41 Map<String, List<Folder>> packageMap; |
| 42 | 42 |
| 43 /** | 43 /** |
| 44 * Dependency information. This is a set of the paths which were consulted | 44 * Dependency information. This is a set of the paths which were consulted |
| 45 * in order to generate the package map. If any of these files is | 45 * in order to generate the package map. If any of these files is |
| 46 * modified, the package map will need to be regenerated. | 46 * modified, the package map will need to be regenerated. |
| 47 */ | 47 */ |
| 48 Set<String> dependencies; | 48 Set<String> dependencies; |
| 49 | 49 |
| 50 PackageMapInfo(this.packageMap, this.dependencies); | 50 PackageMapInfo(this.packageMap, this.dependencies); |
| 51 } | 51 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // { | 119 // { |
| 120 // "packages": { | 120 // "packages": { |
| 121 // "foo": "path/to/foo", | 121 // "foo": "path/to/foo", |
| 122 // "bar": ["path/to/bar1", "path/to/bar2"], | 122 // "bar": ["path/to/bar1", "path/to/bar2"], |
| 123 // "myapp": "path/to/myapp", // self link is included | 123 // "myapp": "path/to/myapp", // self link is included |
| 124 // }, | 124 // }, |
| 125 // "input_files": [ | 125 // "input_files": [ |
| 126 // "path/to/myapp/pubspec.lock" | 126 // "path/to/myapp/pubspec.lock" |
| 127 // ] | 127 // ] |
| 128 // } | 128 // } |
| 129 HashMap<String, List<Folder>> packageMap = new HashMap<String, List<Folder>>
(); | 129 Map<String, List<Folder>> packageMap = new HashMap<String, List<Folder>>(); |
| 130 HashMap obj = JSON.decode(jsonText); | 130 Map obj = JSON.decode(jsonText); |
| 131 HashMap packages = obj['packages']; | 131 Map packages = obj['packages']; |
| 132 processPaths(String packageName, List paths) { | 132 processPaths(String packageName, List paths) { |
| 133 List<Folder> folders = <Folder>[]; | 133 List<Folder> folders = <Folder>[]; |
| 134 for (var path in paths) { | 134 for (var path in paths) { |
| 135 if (path is String) { | 135 if (path is String) { |
| 136 Resource resource = resourceProvider.getResource(path); | 136 Resource resource = resourceProvider.getResource(path); |
| 137 if (resource is Folder) { | 137 if (resource is Folder) { |
| 138 folders.add(resource); | 138 folders.add(resource); |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 } | 141 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 155 if (inputFiles != null) { | 155 if (inputFiles != null) { |
| 156 for (var path in inputFiles) { | 156 for (var path in inputFiles) { |
| 157 if (path is String) { | 157 if (path is String) { |
| 158 dependencies.add(path); | 158 dependencies.add(path); |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 return new PackageMapInfo(packageMap, dependencies); | 162 return new PackageMapInfo(packageMap, dependencies); |
| 163 } | 163 } |
| 164 } | 164 } |
| OLD | NEW |