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

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

Issue 331263002: Improve parallelism when loading transformer plugins. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 6 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 /// Test infrastructure for testing pub. Unlike typical unit tests, most pub 5 /// Test infrastructure for testing pub. Unlike typical unit tests, most pub
6 /// tests are integration tests that stage some stuff on the file system, run 6 /// tests are integration tests that stage some stuff on the file system, run
7 /// pub, and then validate the results. This library provides an API to build 7 /// pub, and then validate the results. This library provides an API to build
8 /// tests like that. 8 /// tests like that.
9 library test_pub; 9 library test_pub;
10 10
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 }, 'initializing the package server'); 277 }, 'initializing the package server');
278 } 278 }
279 279
280 /// Converts [value] into a YAML string. 280 /// Converts [value] into a YAML string.
281 String yaml(value) => JSON.encode(value); 281 String yaml(value) => JSON.encode(value);
282 282
283 /// The full path to the created sandbox directory for an integration test. 283 /// The full path to the created sandbox directory for an integration test.
284 String get sandboxDir => _sandboxDir; 284 String get sandboxDir => _sandboxDir;
285 String _sandboxDir; 285 String _sandboxDir;
286 286
287 /// The path to the Dart repo's packages.
288 final String pkgPath = path.absolute(path.join(
289 path.dirname(Platform.executable),
290 '..', '..', '..', '..', 'pkg'));
291
287 /// The path of the package cache directory used for tests. Relative to the 292 /// The path of the package cache directory used for tests. Relative to the
288 /// sandbox directory. 293 /// sandbox directory.
289 final String cachePath = "cache"; 294 final String cachePath = "cache";
290 295
291 /// The path of the mock app directory used for tests. Relative to the sandbox 296 /// The path of the mock app directory used for tests. Relative to the sandbox
292 /// directory. 297 /// directory.
293 final String appPath = "myapp"; 298 final String appPath = "myapp";
294 299
295 /// The path of the packages directory in the mock app used for tests. Relative 300 /// The path of the packages directory in the mock app used for tests. Relative
296 /// to the sandbox directory. 301 /// to the sandbox directory.
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 Iterable<String> pkg, Map<String, String> hosted}) { 672 Iterable<String> pkg, Map<String, String> hosted}) {
668 var dependencies = {}; 673 var dependencies = {};
669 674
670 if (sandbox != null) { 675 if (sandbox != null) {
671 for (var package in sandbox) { 676 for (var package in sandbox) {
672 dependencies[package] = '../$package'; 677 dependencies[package] = '../$package';
673 } 678 }
674 } 679 }
675 680
676 if (pkg != null) { 681 if (pkg != null) {
677 var pkgDir = path.absolute(path.join(
678 path.dirname(Platform.executable),
679 '..', '..', '..', '..', 'pkg'));
680
681 _addPackage(String package) { 682 _addPackage(String package) {
682 if (dependencies.containsKey(package)) return; 683 if (dependencies.containsKey(package)) return;
683 684
684 var packagePath; 685 var packagePath;
685 if (package == 'barback') { 686 if (package == 'barback') {
686 if (_barbackDir == null) { 687 if (_barbackDir == null) {
687 throw new StateError("createLockFile() can only create a lock file " 688 throw new StateError("createLockFile() can only create a lock file "
688 "with a barback dependency within a withBarbackVersions() " 689 "with a barback dependency within a withBarbackVersions() "
689 "block."); 690 "block.");
690 } 691 }
691 packagePath = _barbackDir; 692 packagePath = _barbackDir;
692 } else { 693 } else {
693 packagePath = path.join(pkgDir, package); 694 packagePath = path.join(pkgPath, package);
694 } 695 }
695 696
696 dependencies[package] = packagePath; 697 dependencies[package] = packagePath;
697 var pubspec = loadYaml( 698 var pubspec = loadYaml(
698 readTextFile(path.join(packagePath, 'pubspec.yaml'))); 699 readTextFile(path.join(packagePath, 'pubspec.yaml')));
699 var packageDeps = pubspec['dependencies']; 700 var packageDeps = pubspec['dependencies'];
700 if (packageDeps == null) return; 701 if (packageDeps == null) return;
701 packageDeps.keys.forEach(_addPackage); 702 packageDeps.keys.forEach(_addPackage);
702 } 703 }
703 704
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 _lastMatcher.matches(item.last, matchState); 909 _lastMatcher.matches(item.last, matchState);
909 } 910 }
910 911
911 Description describe(Description description) { 912 Description describe(Description description) {
912 return description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); 913 return description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]);
913 } 914 }
914 } 915 }
915 916
916 /// A [StreamMatcher] that matches multiple lines of output. 917 /// A [StreamMatcher] that matches multiple lines of output.
917 StreamMatcher emitsLines(String output) => inOrder(output.split("\n")); 918 StreamMatcher emitsLines(String output) => inOrder(output.split("\n"));
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/utils.dart ('k') | sdk/lib/_internal/pub/test/transformer/detects_a_transformer_cycle_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698