Index: pkg/barback/lib/src/dry_run_transform.dart |
diff --git a/pkg/barback/lib/src/dry_run_transform.dart b/pkg/barback/lib/src/dry_run_transform.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1da520e67c94b38eba87fa0886cf8f436744d654 |
--- /dev/null |
+++ b/pkg/barback/lib/src/dry_run_transform.dart |
@@ -0,0 +1,31 @@ |
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
+// 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.dry_run_transform; |
+ |
+import 'asset_id.dart'; |
+import 'base_transform.dart'; |
+import 'transform_logger.dart'; |
+import 'transform_node.dart'; |
+ |
+/// A transform for [DryRunTransform]ers that allows them to declare the ids of |
+/// the outputs they'll generate without generating the concrete bodies of those |
+/// outputs. |
+class DryRunTransform extends BaseTransform { |
Bob Nystrom
2014/01/30 19:33:44
Do we want to allow dry run transformers to read c
nweiz
2014/01/31 03:43:27
I believe we do. We can optimize for the case wher
|
+ final Set<AssetId> _outputIds; |
+ |
+ DryRunTransform(TransformNode node, this._outputIds, LogFunction logFunction) |
+ : super(node, logFunction); |
+ |
+ /// Stores [id] as the id of an output created by this transformation. |
+ /// |
+ /// A transformation can output as many assets as it wants. If |
+ /// [DryRunTransformer.dryRun] outputs a given asset id for a given input, |
+ /// [Transformer.apply] should emit the corresponding asset as well. |
Bob Nystrom
2014/01/30 19:33:44
"should" -> "must".
What happens if it emits an a
nweiz
2014/01/31 03:43:27
I don't think we should say "must", since we do ha
|
+ void addOutputId(AssetId id) { |
+ // TODO(nweiz): This should immediately throw if an output with that ID |
+ // has already been created by this transformer. |
+ _outputIds.add(id); |
+ } |
+} |