| 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 source.pub_package_map_provider; | 5 library source.pub_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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 | 90 |
| 91 /** | 91 /** |
| 92 * Create a PackageMapInfo object representing an error condition. | 92 * Create a PackageMapInfo object representing an error condition. |
| 93 */ | 93 */ |
| 94 PackageMapInfo computePackageMapError(Folder folder) { | 94 PackageMapInfo computePackageMapError(Folder folder) { |
| 95 // Even if an error occurs, we still need to know the dependencies, so that | 95 // Even if an error occurs, we still need to know the dependencies, so that |
| 96 // we'll know when to try running "pub list-package-dirs" again. | 96 // we'll know when to try running "pub list-package-dirs" again. |
| 97 // Unfortunately, "pub list-package-dirs" doesn't tell us dependencies when | 97 // Unfortunately, "pub list-package-dirs" doesn't tell us dependencies when |
| 98 // an error occurs, so just assume there is one dependency, "pubspec.lock". | 98 // an error occurs, so just assume there is one dependency, "pubspec.lock". |
| 99 List<String> dependencies = <String>[join(folder.path, PUBSPEC_LOCK_NAME)]; | 99 List<String> dependencies = <String>[ |
| 100 resourceProvider.pathContext.join(folder.path, PUBSPEC_LOCK_NAME)]; |
| 100 return new PackageMapInfo(null, dependencies.toSet()); | 101 return new PackageMapInfo(null, dependencies.toSet()); |
| 101 } | 102 } |
| 102 | 103 |
| 103 /** | 104 /** |
| 104 * Decode the JSON output from pub into a package map. Paths in the | 105 * Decode the JSON output from pub into a package map. Paths in the |
| 105 * output are considered relative to [folder]. | 106 * output are considered relative to [folder]. |
| 106 */ | 107 */ |
| 107 PackageMapInfo parsePackageMap(Map obj, Folder folder) { | 108 PackageMapInfo parsePackageMap(Map obj, Folder folder) { |
| 108 // The output of pub looks like this: | 109 // The output of pub looks like this: |
| 109 // { | 110 // { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 /** | 155 /** |
| 155 * Run pub list to determine the packages and input files. | 156 * Run pub list to determine the packages and input files. |
| 156 */ | 157 */ |
| 157 io.ProcessResult _runPubListDefault(Folder folder) { | 158 io.ProcessResult _runPubListDefault(Folder folder) { |
| 158 return io.Process.runSync( | 159 return io.Process.runSync( |
| 159 sdk.pubExecutable.getAbsolutePath(), | 160 sdk.pubExecutable.getAbsolutePath(), |
| 160 [PUB_LIST_COMMAND], | 161 [PUB_LIST_COMMAND], |
| 161 workingDirectory: folder.path); | 162 workingDirectory: folder.path); |
| 162 } | 163 } |
| 163 } | 164 } |
| OLD | NEW |