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

Unified Diff: lib/src/global_packages.dart

Issue 1276673006: Make Source.getDirectory synchronous. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/entrypoint.dart ('k') | lib/src/source.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/global_packages.dart
diff --git a/lib/src/global_packages.dart b/lib/src/global_packages.dart
index f0625ae1a4903af60c4cff05f0a8584f3bc2a777..5c280b13c5c77dbe751293ddcd70f11cf2cab470 100644
--- a/lib/src/global_packages.dart
+++ b/lib/src/global_packages.dart
@@ -282,7 +282,7 @@ class GlobalPackages {
/// Finds the active package with [name].
///
/// Returns an [Entrypoint] loaded with the active package if found.
- Future<Entrypoint> find(String name) async {
+ Entrypoint find(String name) {
var lockFilePath = _getLockFilePath(name);
var lockFile;
try {
@@ -312,7 +312,7 @@ class GlobalPackages {
if (source is CachedSource) {
// For cached sources, the package itself is in the cache and the
// lockfile is the one we just loaded.
- var dir = await cache.sources[id.source].getDirectory(id);
+ var dir = cache.sources[id.source].getDirectory(id);
var package = new Package.load(name, dir, cache.sources);
return new Entrypoint.inMemory(package, lockFile, cache);
}
@@ -342,10 +342,8 @@ class GlobalPackages {
var binDir = p.join(_directory, package, 'bin');
if (mode != BarbackMode.RELEASE ||
!fileExists(p.join(binDir, '$executable.dart.snapshot'))) {
- return find(package).then((entrypoint) {
- return exe.runExecutable(entrypoint, package, executable, args,
- isGlobal: true, checked: checked, mode: mode);
- });
+ return exe.runExecutable(find(package), package, executable, args,
+ isGlobal: true, checked: checked, mode: mode);
}
// Unless the user overrides the verbosity, we want to filter out the
@@ -358,12 +356,11 @@ class GlobalPackages {
return exe.runSnapshot(snapshotPath, args,
checked: checked,
packagesFile: _getPackagesFilePath(package),
- recompile: () {
+ recompile: () async {
log.fine("$package:$executable is out of date and needs to be "
"recompiled.");
- return find(package)
- .then((entrypoint) => entrypoint.loadPackageGraph())
- .then((graph) => _precompileExecutables(graph.entrypoint, package));
+ var graph = await find(package).loadPackageGraph();
+ await _precompileExecutables(graph.entrypoint, package);
});
}
@@ -461,8 +458,7 @@ class GlobalPackages {
id = _loadPackageId(entry);
log.message("Reactivating ${log.bold(id.name)} ${id.version}...");
- var entrypoint = await find(id.name);
-
+ var entrypoint = find(id.name);
var graph = await entrypoint.loadPackageGraph();
var snapshots = await _precompileExecutables(entrypoint, id.name);
var packageExecutables = executables.remove(id.name);
« no previous file with comments | « lib/src/entrypoint.dart ('k') | lib/src/source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698