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

Unified Diff: lib/src/global_packages.dart

Issue 1277773002: Support resources in "pub run" and "pub global run". (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/executable.dart ('k') | lib/src/package_locations.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 a9ca7d4ff7d7710951486107426ce32b422deaf2..f0625ae1a4903af60c4cff05f0a8584f3bc2a777 100644
--- a/lib/src/global_packages.dart
+++ b/lib/src/global_packages.dart
@@ -5,7 +5,6 @@
library pub.global_packages;
import 'dart:async';
-import 'dart:convert';
import 'dart:io';
import 'package:path/path.dart' as p;
@@ -20,6 +19,7 @@ import 'io.dart';
import 'lock_file.dart';
import 'log.dart' as log;
import 'package.dart';
+import 'package_locations.dart';
import 'pubspec.dart';
import 'sdk.dart' as sdk;
import 'solver/version_solver.dart';
@@ -177,6 +177,7 @@ class GlobalPackages {
.loadPackageGraph(result);
var snapshots = await _precompileExecutables(graph.entrypoint, dep.name);
_writeLockFile(dep.name, lockFile);
+ writePackagesMap(graph, _getPackagesFilePath(dep.name));
_updateBinStubs(graph.packages[dep.name], executables,
overwriteBinStubs: overwriteBinStubs, snapshots: snapshots);
@@ -354,7 +355,10 @@ class GlobalPackages {
}
var snapshotPath = p.join(binDir, '$executable.dart.snapshot');
- return exe.runSnapshot(snapshotPath, args, checked: checked, recompile: () {
+ return exe.runSnapshot(snapshotPath, args,
+ checked: checked,
+ packagesFile: _getPackagesFilePath(package),
+ recompile: () {
log.fine("$package:$executable is out of date and needs to be "
"recompiled.");
return find(package)
@@ -368,6 +372,11 @@ class GlobalPackages {
String _getLockFilePath(String name) =>
p.join(_directory, name, "pubspec.lock");
+ /// Gets the path to the .packages file for an activated cached package with
+ /// [name].
+ String _getPackagesFilePath(String name) =>
+ p.join(_directory, name, ".packages");
+
/// Shows the user a formatted list of globally activated packages.
void listActivePackages() {
if (!dirExists(_directory)) return;
« no previous file with comments | « lib/src/executable.dart ('k') | lib/src/package_locations.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698