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

Side by Side Diff: test/dependency_computer/utils.dart

Issue 2044253003: Refactor Source and SourceRegistry. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Rename LiveSource to BoundSource. Created 4 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
« no previous file with comments | « lib/src/validator/dependency.dart ('k') | test/lock_file_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS d.file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS d.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 import 'package:barback/barback.dart'; 5 import 'package:barback/barback.dart';
6 import 'package:path/path.dart' as p; 6 import 'package:path/path.dart' as p;
7 import 'package:pub/src/barback/cycle_exception.dart'; 7 import 'package:pub/src/barback/cycle_exception.dart';
8 import 'package:pub/src/barback/dependency_computer.dart'; 8 import 'package:pub/src/barback/dependency_computer.dart';
9 import 'package:pub/src/entrypoint.dart'; 9 import 'package:pub/src/entrypoint.dart';
10 import 'package:pub/src/io.dart'; 10 import 'package:pub/src/io.dart';
11 import 'package:pub/src/package.dart'; 11 import 'package:pub/src/package.dart';
12 import 'package:pub/src/package_graph.dart'; 12 import 'package:pub/src/package_graph.dart';
13 import 'package:pub/src/source/path.dart';
14 import 'package:pub/src/system_cache.dart'; 13 import 'package:pub/src/system_cache.dart';
15 import 'package:pub/src/utils.dart'; 14 import 'package:pub/src/utils.dart';
16 import 'package:scheduled_test/scheduled_test.dart'; 15 import 'package:scheduled_test/scheduled_test.dart';
17 16
18 import '../test_pub.dart'; 17 import '../test_pub.dart';
19 18
20 /// Expects that [DependencyComputer.transformersNeededByTransformers] will 19 /// Expects that [DependencyComputer.transformersNeededByTransformers] will
21 /// return a graph matching [expected] when run on the package graph defined by 20 /// return a graph matching [expected] when run on the package graph defined by
22 /// packages in the sandbox. 21 /// packages in the sandbox.
23 void expectDependencies(Map<String, Iterable<String>> expected) { 22 void expectDependencies(Map<String, Iterable<String>> expected) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 70 }
72 71
73 /// Loads a [PackageGraph] from the packages in the sandbox. 72 /// Loads a [PackageGraph] from the packages in the sandbox.
74 /// 73 ///
75 /// This graph will also include barback and its transitive dependencies from 74 /// This graph will also include barback and its transitive dependencies from
76 /// the repo. 75 /// the repo.
77 PackageGraph _loadPackageGraph() { 76 PackageGraph _loadPackageGraph() {
78 // Load the sandbox packages. 77 // Load the sandbox packages.
79 var packages = {}; 78 var packages = {};
80 79
81 var systemCache = new SystemCache(p.join(sandboxDir, cachePath)); 80 var systemCache = new SystemCache(rootDir: p.join(sandboxDir, cachePath));
82 systemCache.sources 81 systemCache.sources.setDefault('path');
83 ..register(new PathSource())
84 ..setDefault('path');
85 var entrypoint = new Entrypoint(p.join(sandboxDir, appPath), systemCache); 82 var entrypoint = new Entrypoint(p.join(sandboxDir, appPath), systemCache);
86 83
87 for (var package in listDir(sandboxDir)) { 84 for (var package in listDir(sandboxDir)) {
88 if (!fileExists(p.join(package, 'pubspec.yaml'))) continue; 85 if (!fileExists(p.join(package, 'pubspec.yaml'))) continue;
89 var packageName = p.basename(package); 86 var packageName = p.basename(package);
90 packages[packageName] = new Package.load( 87 packages[packageName] = new Package.load(
91 packageName, package, systemCache.sources); 88 packageName, package, systemCache.sources);
92 } 89 }
93 90
94 loadPackage(packageName) { 91 loadPackage(packageName) {
(...skipping 23 matching lines...) Expand all
118 115
119 buffer.writeln(""" 116 buffer.writeln("""
120 NoOpTransformer extends Transformer { 117 NoOpTransformer extends Transformer {
121 bool isPrimary(AssetId id) => true; 118 bool isPrimary(AssetId id) => true;
122 void apply(Transform transform) {} 119 void apply(Transform transform) {}
123 } 120 }
124 """); 121 """);
125 122
126 return buffer.toString(); 123 return buffer.toString();
127 } 124 }
OLDNEW
« no previous file with comments | « lib/src/validator/dependency.dart ('k') | test/lock_file_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698