| 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 library descriptor; | 6 library descriptor; |
| 7 | 7 |
| 8 import "dart:io" show File; |
| 9 |
| 8 import 'package:oauth2/oauth2.dart' as oauth2; | 10 import 'package:oauth2/oauth2.dart' as oauth2; |
| 11 import 'package:path/path.dart' as p; |
| 9 import 'package:pub/src/io.dart'; | 12 import 'package:pub/src/io.dart'; |
| 10 import 'package:pub/src/utils.dart'; | 13 import 'package:pub/src/utils.dart'; |
| 11 import 'package:scheduled_test/descriptor.dart'; | 14 import 'package:scheduled_test/descriptor.dart'; |
| 12 import 'package:scheduled_test/scheduled_server.dart'; | 15 import 'package:scheduled_test/scheduled_server.dart'; |
| 16 import 'package:package_config/packages_file.dart' as packages_file; |
| 17 import 'package:stack_trace/stack_trace.dart'; |
| 13 | 18 |
| 14 import 'descriptor/git.dart'; | 19 import 'descriptor/git.dart'; |
| 15 import 'descriptor/tar.dart'; | 20 import 'descriptor/tar.dart'; |
| 21 import 'descriptor/packages.dart'; |
| 16 import 'test_pub.dart'; | 22 import 'test_pub.dart'; |
| 17 | 23 |
| 18 export 'package:scheduled_test/descriptor.dart'; | 24 export 'package:scheduled_test/descriptor.dart'; |
| 19 export 'descriptor/git.dart'; | 25 export 'descriptor/git.dart'; |
| 20 export 'descriptor/tar.dart'; | 26 export 'descriptor/tar.dart'; |
| 27 export 'descriptor/packages.dart'; |
| 21 | 28 |
| 22 /// Creates a new [GitRepoDescriptor] with [name] and [contents]. | 29 /// Creates a new [GitRepoDescriptor] with [name] and [contents]. |
| 23 GitRepoDescriptor git(String name, [Iterable<Descriptor> contents]) => | 30 GitRepoDescriptor git(String name, [Iterable<Descriptor> contents]) => |
| 24 new GitRepoDescriptor(name, contents == null ? <Descriptor>[] : contents); | 31 new GitRepoDescriptor(name, contents == null ? <Descriptor>[] : contents); |
| 25 | 32 |
| 26 /// Creates a new [TarRepoDescriptor] with [name] and [contents]. | 33 /// Creates a new [TarRepoDescriptor] with [name] and [contents]. |
| 27 TarFileDescriptor tar(String name, [Iterable<Descriptor> contents]) => | 34 TarFileDescriptor tar(String name, [Iterable<Descriptor> contents]) => |
| 28 new TarFileDescriptor(name, contents == null ? <Descriptor>[] : contents); | 35 new TarFileDescriptor(name, contents == null ? <Descriptor>[] : contents); |
| 29 | 36 |
| 30 /// Describes a package that passes all validation. | 37 /// Describes a package that passes all validation. |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 ['https://www.googleapis.com/auth/userinfo.email'], | 182 ['https://www.googleapis.com/auth/userinfo.email'], |
| 176 expiration).toJson()) | 183 expiration).toJson()) |
| 177 ]); | 184 ]); |
| 178 })); | 185 })); |
| 179 } | 186 } |
| 180 | 187 |
| 181 /// Describes the application directory, containing only a pubspec specifying | 188 /// Describes the application directory, containing only a pubspec specifying |
| 182 /// the given [dependencies]. | 189 /// the given [dependencies]. |
| 183 DirectoryDescriptor appDir([Map dependencies]) => | 190 DirectoryDescriptor appDir([Map dependencies]) => |
| 184 dir(appPath, [appPubspec(dependencies)]); | 191 dir(appPath, [appPubspec(dependencies)]); |
| 192 |
| 193 /// Describes a `.packages` file. |
| 194 /// |
| 195 /// [dependencies] maps package names to version strings. |
| 196 /// |
| 197 /// Validation checks that the `.packages` file exists, has the expected |
| 198 /// entries (one per key in [dependencies]), each with a path that contains |
| 199 /// either the version string (for a reference to the pub cache) or a |
| 200 /// path to a path dependency, relative to the application directory. |
| 201 Descriptor packagesFile([Map dependencies]) => |
| 202 new PackagesFileDescriptor(dependencies); |
| OLD | NEW |