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

Side by Side Diff: sdk/lib/_internal/pub_generated/test/serve_packages.dart

Issue 808713003: Remove barback from the repo. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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) 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 serve_packages; 5 library serve_packages;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 9
10 import 'package:path/path.dart' as p; 10 import 'package:path/path.dart' as p;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 })); 141 }));
142 } 142 }
143 143
144 /// Serves the versions of [package] and all its dependencies that are 144 /// Serves the versions of [package] and all its dependencies that are
145 /// currently checked into the Dart repository. 145 /// currently checked into the Dart repository.
146 void serveRepoPackage(String package) { 146 void serveRepoPackage(String package) {
147 _addPackage(name) { 147 _addPackage(name) {
148 if (_packages.containsKey(name)) return; 148 if (_packages.containsKey(name)) return;
149 _packages[name] = []; 149 _packages[name] = [];
150 150
151 var pubspec = new Map.from( 151 var root = packagePath(name);
152 loadYaml(readTextFile(p.join(repoRoot, 'pkg', name, 'pubspec.yaml')))) ; 152 var pubspec =
153 new Map.from(loadYaml(readTextFile(p.join(root, 'pubspec.yaml'))));
153 154
154 // Remove any SDK constraints since we don't have a valid SDK version 155 // Remove any SDK constraints since we don't have a valid SDK version
155 // while testing. 156 // while testing.
156 pubspec.remove('environment'); 157 pubspec.remove('environment');
157 158
158 _packages[name].add( 159 _packages[name].add(
159 new _ServedPackage( 160 new _ServedPackage(
160 pubspec, 161 pubspec,
161 [ 162 [
162 d.file('pubspec.yaml', yaml(pubspec)), 163 d.file('pubspec.yaml', yaml(pubspec)),
163 new d.DirectoryDescriptor.fromFilesystem( 164 new d.DirectoryDescriptor.fromFilesystem('lib', p.join(root, ' lib'))]));
164 'lib',
165 p.join(repoRoot, 'pkg', name, 'lib'))]));
166 165
167 if (pubspec.containsKey('dependencies')) { 166 if (pubspec.containsKey('dependencies')) {
168 pubspec['dependencies'].keys.forEach(_addPackage); 167 pubspec['dependencies'].keys.forEach(_addPackage);
169 } 168 }
170 } 169 }
171 170
172 _addPackage(package); 171 _addPackage(package);
173 } 172 }
174 173
175 /// Returns a Future that completes once all the [serve] calls have been fully 174 /// Returns a Future that completes once all the [serve] calls have been fully
176 /// processed. 175 /// processed.
177 Future _await() { 176 Future _await() {
178 if (_futures.futures.isEmpty) return new Future.value(); 177 if (_futures.futures.isEmpty) return new Future.value();
179 return _futures.future.then((_) { 178 return _futures.future.then((_) {
180 _futures = new FutureGroup(); 179 _futures = new FutureGroup();
181 }); 180 });
182 } 181 }
183 } 182 }
184 183
185 /// A package that's intended to be served. 184 /// A package that's intended to be served.
186 class _ServedPackage { 185 class _ServedPackage {
187 final Map pubspec; 186 final Map pubspec;
188 final List<d.Descriptor> contents; 187 final List<d.Descriptor> contents;
189 188
190 Version get version => new Version.parse(pubspec['version']); 189 Version get version => new Version.parse(pubspec['version']);
191 190
192 _ServedPackage(this.pubspec, this.contents); 191 _ServedPackage(this.pubspec, this.contents);
193 } 192 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698