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

Side by Side Diff: pkg/barback/test/transformer/declare_assets.dart

Issue 227123007: Only run [declareOutputs] once for each asset/transformer pair. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library barback.test.transformer.declare_asset;
6
7 import 'dart:async';
8
9 import 'package:barback/barback.dart';
10 import 'package:barback/src/utils.dart';
11
12 import 'mock.dart';
13
14 /// A transformer that declares some outputs and emits others.
15 class DeclareAssetsTransformer extends MockTransformer
16 implements DeclaringTransformer {
17 /// The assets that the transformer declares that it will emit.
18 final List<AssetId> declared;
19
20 /// The assets that the transformer actually emits.
21 ///
22 /// These assets' contents will be identical to their ids.
23 final List<AssetId> emitted;
24
25 DeclareAssetsTransformer(Iterable<String> declared, Iterable<String> emitted)
26 : this.declared = declared.map((id) => new AssetId.parse(id)).toList(),
27 this.emitted = emitted.map((id) => new AssetId.parse(id)).toList();
28
29 Future<bool> doIsPrimary(AssetId id) => new Future.value(true);
30
31 Future doApply(Transform transform) {
32 return newFuture(() {
33 for (var id in emitted) {
34 transform.addOutput(new Asset.fromString(id, id.toString()));
35 }
36 });
37 }
38
39 Future declareOutputs(DeclaringTransform transform) {
40 return newFuture(() {
41 declared.forEach(transform.declareOutput);
42 });
43 }
44 }
OLDNEW
« no previous file with comments | « pkg/barback/test/transformer/create_asset.dart ('k') | pkg/barback/test/transformer/declaring_bad.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698