Skip to content
Snippets Groups Projects
Commit dc254920 authored by nweiz@google.com's avatar nweiz@google.com Committed by Natalie Weizenbaum
Browse files

Fix several errors in pub.

R=alanknight@google.com

Review URL: https://codereview.chromium.org//66133002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge@30096 260f80e4-7a28-3924-810f-c04153c831b5
parent cdbd03a1
No related branches found
No related tags found
No related merge requests found
......@@ -119,15 +119,11 @@ Future<BarbackServer> createServer(String host, int port, PackageGraph graph,
return BarbackServer.bind(host, port, barback, graph.entrypoint.root.name)
.then((server) {
return new Future.sync(() {
if (watcher == WatcherType.NONE) {
loadSources(graph, barback);
return;
if (watcher != WatcherType.NONE) {
return watchSources(graph, barback, watcher);
}
return watchSources(graph, barback, (directory) {
if (watcher == WatcherType.AUTO) return new DirectoryWatcher(directory);
return new PollingDirectoryWatcher(directory);
});
loadSources(graph, barback);
}).then((_) {
var completer = new Completer();
......
......@@ -23,7 +23,8 @@ import '../package_graph.dart';
///
/// Returns a Future that completes when the sources are loaded and the watchers
/// are active.
Future watchSources(PackageGraph graph, Barback barback, WatcherType watcher) {
Future watchSources(PackageGraph graph, Barback barback,
WatcherType watcherType) {
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
......@@ -42,7 +43,7 @@ Future watchSources(PackageGraph graph, Barback barback, WatcherType watcher) {
if (!dirExists(subdirectory)) return new Future.value();
// TODO(nweiz): close these watchers when [barback] is closed.
var watcher = watcher.create(subdirectory);
var watcher = watcherType.create(subdirectory);
watcher.events.listen((event) {
// Don't watch files symlinked into these directories.
// TODO(rnystrom): If pub gets rid of symlinks, remove this.
......@@ -142,7 +143,7 @@ class _PollingWatcherType implements WatcherType {
String toString() => "polling";
}
class _NoneWatcherType implements {
class _NoneWatcherType implements WatcherType {
const _NoneWatcherType();
DirectoryWatcher create(String directory) => null;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment