Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: sdk/lib/_internal/pub/test/descriptor.dart

Issue 548603002: Use the VM to detect when a precompiled executable is out-of-date. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 'package:oauth2/oauth2.dart' as oauth2; 8 import 'package:oauth2/oauth2.dart' as oauth2;
9 import 'package:scheduled_test/scheduled_server.dart'; 9 import 'package:scheduled_test/scheduled_server.dart';
10 import 'package:scheduled_test/descriptor.dart'; 10 import 'package:scheduled_test/descriptor.dart';
11 11
12 import '../lib/src/io.dart';
12 import '../lib/src/utils.dart'; 13 import '../lib/src/utils.dart';
13 import 'descriptor/git.dart'; 14 import 'descriptor/git.dart';
14 import 'descriptor/tar.dart'; 15 import 'descriptor/tar.dart';
15 import 'test_pub.dart'; 16 import 'test_pub.dart';
16 17
17 export 'package:scheduled_test/descriptor.dart'; 18 export 'package:scheduled_test/descriptor.dart';
18 export 'descriptor/git.dart'; 19 export 'descriptor/git.dart';
19 export 'descriptor/tar.dart'; 20 export 'descriptor/tar.dart';
20 21
21 /// Creates a new [GitRepoDescriptor] with [name] and [contents]. 22 /// Creates a new [GitRepoDescriptor] with [name] and [contents].
22 GitRepoDescriptor git(String name, [Iterable<Descriptor> contents]) => 23 GitRepoDescriptor git(String name, [Iterable<Descriptor> contents]) =>
23 new GitRepoDescriptor(name, contents == null ? <Descriptor>[] : contents); 24 new GitRepoDescriptor(name, contents == null ? <Descriptor>[] : contents);
24 25
25 /// Creates a new [TarRepoDescriptor] with [name] and [contents]. 26 /// Creates a new [TarRepoDescriptor] with [name] and [contents].
26 TarFileDescriptor tar(String name, [Iterable<Descriptor> contents]) => 27 TarFileDescriptor tar(String name, [Iterable<Descriptor> contents]) =>
27 new TarFileDescriptor(name, contents == null ? <Descriptor>[] : contents); 28 new TarFileDescriptor(name, contents == null ? <Descriptor>[] : contents);
28 29
29 /// Describes a package that passes all validation. 30 /// Describes a package that passes all validation.
30 Descriptor get validPackage => dir(appPath, [ 31 Descriptor get validPackage => dir(appPath, [
31 libPubspec("test_pkg", "1.0.0"), 32 libPubspec("test_pkg", "1.0.0"),
32 file("LICENSE", "Eh, do what you want."), 33 file("LICENSE", "Eh, do what you want."),
33 dir("lib", [ 34 dir("lib", [
34 file("test_pkg.dart", "int i = 1;") 35 file("test_pkg.dart", "int i = 1;")
35 ]) 36 ])
36 ]); 37 ]);
37 38
39 /// Returns a descriptor of a snapshot that can't be run by the current VM.
40 ///
41 /// This snapshot was generated by the VM on r39611, the revision immediately
42 /// before snapshot versioning was added.
43 FileDescriptor outOfDateSnapshot(String name) =>
44 binaryFile(name, readBinaryFile(testAssetPath('out-of-date.snapshot')));
45
38 /// Describes a file named `pubspec.yaml` with the given YAML-serialized 46 /// Describes a file named `pubspec.yaml` with the given YAML-serialized
39 /// [contents], which should be a serializable object. 47 /// [contents], which should be a serializable object.
40 /// 48 ///
41 /// [contents] may contain [Future]s that resolve to serializable objects, 49 /// [contents] may contain [Future]s that resolve to serializable objects,
42 /// which may in turn contain [Future]s recursively. 50 /// which may in turn contain [Future]s recursively.
43 Descriptor pubspec(Map contents) { 51 Descriptor pubspec(Map contents) {
44 return async(awaitObject(contents).then((resolvedContents) => 52 return async(awaitObject(contents).then((resolvedContents) =>
45 file("pubspec.yaml", yaml(resolvedContents)))); 53 file("pubspec.yaml", yaml(resolvedContents))));
46 } 54 }
47 55
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 ['https://www.googleapis.com/auth/userinfo.email'], 175 ['https://www.googleapis.com/auth/userinfo.email'],
168 expiration).toJson()) 176 expiration).toJson())
169 ]); 177 ]);
170 })); 178 }));
171 } 179 }
172 180
173 /// Describes the application directory, containing only a pubspec specifying 181 /// Describes the application directory, containing only a pubspec specifying
174 /// the given [dependencies]. 182 /// the given [dependencies].
175 DirectoryDescriptor appDir([Map dependencies]) => 183 DirectoryDescriptor appDir([Map dependencies]) =>
176 dir(appPath, [appPubspec(dependencies)]); 184 dir(appPath, [appPubspec(dependencies)]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698