Index: third_party/pkg/barback-0.13.0/lib/src/package_graph.dart |
diff --git a/pkg/barback/lib/src/graph/package_graph.dart b/third_party/pkg/barback-0.13.0/lib/src/package_graph.dart |
similarity index 92% |
copy from pkg/barback/lib/src/graph/package_graph.dart |
copy to third_party/pkg/barback-0.13.0/lib/src/package_graph.dart |
index 8cd47157d15142cec615679a250aafc516e804d4..c503c601c5c774a3448aa28904dc22ed3fbb40ec 100644 |
--- a/pkg/barback/lib/src/graph/package_graph.dart |
+++ b/third_party/pkg/barback-0.13.0/lib/src/package_graph.dart |
@@ -2,22 +2,21 @@ |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
-library barback.graph.package_graph; |
+library barback.package_graph; |
import 'dart:async'; |
import 'dart:collection'; |
-import '../asset/asset_id.dart'; |
-import '../asset/asset_node.dart'; |
-import '../asset/asset_set.dart'; |
-import '../build_result.dart'; |
-import '../errors.dart'; |
-import '../log.dart'; |
-import '../package_provider.dart'; |
-import '../transformer/transformer.dart'; |
-import '../utils.dart'; |
import 'asset_cascade.dart'; |
-import 'node_status.dart'; |
+import 'asset_id.dart'; |
+import 'asset_node.dart'; |
+import 'asset_set.dart'; |
+import 'build_result.dart'; |
+import 'errors.dart'; |
+import 'log.dart'; |
+import 'package_provider.dart'; |
+import 'transformer.dart'; |
+import 'utils.dart'; |
/// The collection of [AssetCascade]s for an entire application. |
/// |
@@ -56,9 +55,8 @@ class PackageGraph { |
Stream<LogEntry> get log => _logController.stream; |
final _logController = new StreamController<LogEntry>.broadcast(sync: true); |
- /// How far along [this] is in processing its assets. |
- NodeStatus get _status => NodeStatus.dirtiest( |
- _cascades.values.map((cascade) => cascade.status)); |
+ /// Whether [this] is dirty and still has more processing to do. |
+ bool get _isDirty => _cascades.values.any((cascade) => cascade.isDirty); |
/// Whether a [BuildResult] is scheduled to be emitted on [results] (see |
/// [_tryScheduleResult]). |
@@ -91,9 +89,7 @@ class PackageGraph { |
var cascade = new AssetCascade(this, package); |
_cascades[package] = cascade; |
cascade.onLog.listen(_onLog); |
- cascade.onStatusChange.listen((status) { |
- if (status == NodeStatus.IDLE) _tryScheduleResult(); |
- }); |
+ cascade.onDone.listen((_) => _tryScheduleResult()); |
} |
_errors = mergeStreams(_cascades.values.map((cascade) => cascade.errors), |
@@ -130,7 +126,7 @@ class PackageGraph { |
_inErrorZone(() => cascade.forceAllTransforms()); |
} |
- if (_status != NodeStatus.IDLE) { |
+ if (_isDirty) { |
// A build is still ongoing, so wait for it to complete and try again. |
return results.first.then((_) => getAllAssets()); |
} |
@@ -226,13 +222,13 @@ class PackageGraph { |
/// [BuildResult]) to ensure that calling multiple functions synchronously |
/// produces only a single [BuildResult]. |
void _tryScheduleResult() { |
- if (_status != NodeStatus.IDLE) return; |
+ if (_isDirty) return; |
if (_resultScheduled) return; |
_resultScheduled = true; |
newFuture(() { |
_resultScheduled = false; |
- if (_status != NodeStatus.IDLE) return; |
+ if (_isDirty) return; |
_lastResult = new BuildResult(_accumulatedErrors); |
_accumulatedErrors.clear(); |