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

Unified Diff: sdk/lib/_internal/pub/lib/src/barback/watch_sources.dart

Issue 42823002: Avoid watching files that aren't going to change for "pub serve". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | « no previous file | sdk/lib/_internal/pub/lib/src/entrypoint.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/barback/watch_sources.dart
diff --git a/sdk/lib/_internal/pub/lib/src/barback/watch_sources.dart b/sdk/lib/_internal/pub/lib/src/barback/watch_sources.dart
index bc1c7ec8c582e6ecc9d8d17f67d9c798e35a0a4d..6a176aa5a8ab2d609fa3c990da2b06b1c45e3a92 100644
--- a/sdk/lib/_internal/pub/lib/src/barback/watch_sources.dart
+++ b/sdk/lib/_internal/pub/lib/src/barback/watch_sources.dart
@@ -20,9 +20,20 @@ void watchSources(PackageGraph graph, Barback barback) {
// Add the initial sources.
barback.updateSources(_listAssets(graph.entrypoint, package));
+ // If this package comes from a cached source, its contents won't change so
+ // we don't need to monitor it. `packageId` will be null for the application
+ // package, since that's not locked.
+ var packageId = graph.lockFile.packages[package.name];
+ if (packageId != null &&
+ graph.entrypoint.cache.sources[packageId.source].shouldCache) {
+ continue;
+ }
+
// Watch the visible package directories for changes.
for (var name in _getPublicDirectories(graph.entrypoint, package)) {
var subdirectory = path.join(package.dir, name);
+ if (!dirExists(subdirectory)) continue;
+
// TODO(nweiz): close these watchers when [barback] is closed.
var watcher = new DirectoryWatcher(subdirectory);
watcher.events.listen((event) {
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/lib/src/entrypoint.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698