| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /// Pub-specific scheduled_test descriptors. | 5 /// Pub-specific scheduled_test descriptors. |
| 6 import "dart:io" show File; | 6 import "dart:io" show File; |
| 7 import "dart:async" show Future; | 7 import "dart:async" show Future; |
| 8 import "dart:convert" show UTF8; | 8 import "dart:convert" show UTF8; |
| 9 | 9 |
| 10 import 'package:package_config/packages_file.dart' as packages_file; | 10 import 'package:package_config/packages_file.dart' as packages_file; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 /// Describes a `.packages` file with the given dependencies. | 28 /// Describes a `.packages` file with the given dependencies. |
| 29 /// | 29 /// |
| 30 /// [dependencies] maps package names to strings describing where the packages | 30 /// [dependencies] maps package names to strings describing where the packages |
| 31 /// are located on disk. | 31 /// are located on disk. |
| 32 PackagesFileDescriptor([this._dependencies]) : super('.packages'); | 32 PackagesFileDescriptor([this._dependencies]) : super('.packages'); |
| 33 | 33 |
| 34 Future create([String parent]) => schedule(() { | 34 Future create([String parent]) => schedule(() { |
| 35 if (parent == null) parent = defaultRoot; | 35 if (parent == null) parent = defaultRoot; |
| 36 var contents = const <int>[]; | 36 var contents = const <int>[]; |
| 37 if (_dependencies != null) { | 37 if (_dependencies != null) { |
| 38 var mapping = {}; | 38 var mapping = <String, Uri>{}; |
| 39 _dependencies.forEach((package, version) { | 39 _dependencies.forEach((package, version) { |
| 40 var packagePath; | 40 var packagePath; |
| 41 if (_semverRE.hasMatch(version)) { | 41 if (_semverRE.hasMatch(version)) { |
| 42 // If it's a semver, it's a cache reference. | 42 // If it's a semver, it's a cache reference. |
| 43 packagePath = p.join(cachePath, "$package-$version"); | 43 packagePath = p.join(cachePath, "$package-$version"); |
| 44 } else { | 44 } else { |
| 45 // Otherwise it's a path relative to the pubspec file, | 45 // Otherwise it's a path relative to the pubspec file, |
| 46 // which is also relative to the .packages file. | 46 // which is also relative to the .packages file. |
| 47 packagePath = p.fromUri(version); | 47 packagePath = p.fromUri(version); |
| 48 } | 48 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 for (var key in map.keys) { | 104 for (var key in map.keys) { |
| 105 if (!_dependencies.containsKey(key)) { | 105 if (!_dependencies.containsKey(key)) { |
| 106 fail(".packages file contains unexpected entry: $key"); | 106 fail(".packages file contains unexpected entry: $key"); |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 String describe() => name; | 112 String describe() => name; |
| 113 } | 113 } |
| OLD | NEW |