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

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

Issue 19592015: Get rid of hokey dependencyMapList stuff. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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/scheduled_test.dart'; 10 import 'package:scheduled_test/scheduled_test.dart';
(...skipping 30 matching lines...) Expand all
41 /// 41 ///
42 /// [contents] may contain [Future]s that resolve to serializable objects, 42 /// [contents] may contain [Future]s that resolve to serializable objects,
43 /// which may in turn contain [Future]s recursively. 43 /// which may in turn contain [Future]s recursively.
44 Descriptor pubspec(Map contents) { 44 Descriptor pubspec(Map contents) {
45 return async(awaitObject(contents).then((resolvedContents) => 45 return async(awaitObject(contents).then((resolvedContents) =>
46 file("pubspec.yaml", yaml(resolvedContents)))); 46 file("pubspec.yaml", yaml(resolvedContents))));
47 } 47 }
48 48
49 /// Describes a file named `pubspec.yaml` for an application package with the 49 /// Describes a file named `pubspec.yaml` for an application package with the
50 /// given [dependencies]. 50 /// given [dependencies].
51 Descriptor appPubspec(List dependencies) { 51 Descriptor appPubspec([Map dependencies]) {
52 return pubspec({ 52 var map = {"name": "myapp"};
53 "name": "myapp", 53 if (dependencies != null) map["dependencies"] = dependencies;
54 "dependencies": dependencyListToMap(dependencies) 54 return pubspec(map);
55 });
56 } 55 }
57 56
58 /// Describes a file named `pubspec.yaml` for a library package with the given 57 /// Describes a file named `pubspec.yaml` for a library package with the given
59 /// [name], [version], and [deps]. If "sdk" is given, then it adds an SDK 58 /// [name], [version], and [deps]. If "sdk" is given, then it adds an SDK
60 /// constraint on that version. 59 /// constraint on that version.
61 Descriptor libPubspec(String name, String version, {List deps, String sdk}) { 60 Descriptor libPubspec(String name, String version, {Map deps, String sdk}) {
62 var map = packageMap(name, version, deps); 61 var map = packageMap(name, version, deps);
63 62 if (sdk != null) map["environment"] = {"sdk": sdk};
64 if (sdk != null) {
65 map["environment"] = {
66 "sdk": sdk
67 };
68 }
69
70 return pubspec(map); 63 return pubspec(map);
71 } 64 }
72 65
73 /// Describes a directory named `lib` containing a single dart file named 66 /// Describes a directory named `lib` containing a single dart file named
74 /// `<name>.dart` that contains a line of Dart code. 67 /// `<name>.dart` that contains a line of Dart code.
75 Descriptor libDir(String name, [String code]) { 68 Descriptor libDir(String name, [String code]) {
76 // Default to printing the name if no other code was given. 69 // Default to printing the name if no other code was given.
77 if (code == null) { 70 if (code == null) code = name;
78 code = name;
79 }
80
81 return dir("lib", [ 71 return dir("lib", [
82 file("$name.dart", 'main() => "$code";') 72 file("$name.dart", 'main() => "$code";')
83 ]); 73 ]);
84 } 74 }
85 75
86 /// Describes a directory for a Git package. This directory is of the form 76 /// Describes a directory for a Git package. This directory is of the form
87 /// found in the revision cache of the global package cache. 77 /// found in the revision cache of the global package cache.
88 Descriptor gitPackageRevisionCacheDir(String name, [int modifier]) { 78 Descriptor gitPackageRevisionCacheDir(String name, [int modifier]) {
89 var value = name; 79 var value = name;
90 if (modifier != null) value = "$name $modifier"; 80 if (modifier != null) value = "$name $modifier";
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 refreshToken, 160 refreshToken,
171 url.resolve('/token'), 161 url.resolve('/token'),
172 ['https://www.googleapis.com/auth/userinfo.email'], 162 ['https://www.googleapis.com/auth/userinfo.email'],
173 expiration).toJson()) 163 expiration).toJson())
174 ]); 164 ]);
175 })); 165 }));
176 } 166 }
177 167
178 /// Describes the application directory, containing only a pubspec specifying 168 /// Describes the application directory, containing only a pubspec specifying
179 /// the given [dependencies]. 169 /// the given [dependencies].
180 DirectoryDescriptor appDir(List dependencies) => 170 DirectoryDescriptor appDir([Map dependencies]) =>
181 dir(appPath, [appPubspec(dependencies)]); 171 dir(appPath, [appPubspec(dependencies)]);
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub/test/deploy/with_no_web_directory_test.dart ('k') | sdk/lib/_internal/pub/test/dev_dependency_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698