Chromium Code Reviews| Index: sdk/lib/_internal/pub/lib/src/barback/sources.dart |
| diff --git a/sdk/lib/_internal/pub/lib/src/barback/sources.dart b/sdk/lib/_internal/pub/lib/src/barback/sources.dart |
| index c85044b75a82e413e6e653e01e327d5d2213ee04..0f44e76336f494d7894e5fa0d59f9a7466a6493a 100644 |
| --- a/sdk/lib/_internal/pub/lib/src/barback/sources.dart |
| +++ b/sdk/lib/_internal/pub/lib/src/barback/sources.dart |
| @@ -18,9 +18,13 @@ import '../package_graph.dart'; |
| /// Adds all of the source assets in the provided packages to barback and |
| /// then watches the public directories for changes. |
| /// |
| -/// Returns a Future that completes when the sources are loaded and the |
| -/// watchers are active. |
| -Future watchSources(PackageGraph graph, Barback barback) { |
| +/// [watcherFactory] should return a [DirectoryWatcher] watching the given |
| +/// directory for changes. |
| +/// |
| +/// Returns a Future that completes when the sources are loaded and the watchers |
| +/// are active. |
| +Future watchSources(PackageGraph graph, Barback barback, |
| + DirectoryWatcher watcherFactory(String directory)) { |
|
Bob Nystrom
2013/11/08 01:32:32
Why not just pass the WatcherType in here?
nweiz
2013/11/08 01:44:24
It seemed a little weird to have this just not han
|
| return Future.wait(graph.packages.values.map((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 |
| @@ -39,7 +43,7 @@ Future watchSources(PackageGraph graph, Barback barback) { |
| if (!dirExists(subdirectory)) return new Future.value(); |
| // TODO(nweiz): close these watchers when [barback] is closed. |
| - var watcher = new DirectoryWatcher(subdirectory); |
| + var watcher = watcherFactory(subdirectory); |
| watcher.events.listen((event) { |
| // Don't watch files symlinked into these directories. |
| // TODO(rnystrom): If pub gets rid of symlinks, remove this. |