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

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

Issue 808713003: Remove barback from the repo. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 'package:barback/barback.dart';
8
9 import 'mock.dart';
10
11 /// A transformer that declares some outputs and emits others.
12 class DeclareAssetsTransformer extends MockTransformer
13 implements DeclaringTransformer {
14 /// The assets that the transformer declares that it will emit.
15 final List<AssetId> declared;
16
17 /// The assets that the transformer actually emits.
18 ///
19 /// These assets' contents will be identical to their ids.
20 final List<AssetId> emitted;
21
22 /// If this is non-`null`, assets are only declared for this input.
23 final AssetId input;
24
25 DeclareAssetsTransformer(Iterable<String> declared, {Iterable<String> emitted,
26 String input})
27 : this.declared = declared.map((id) => new AssetId.parse(id)).toList(),
28 this.emitted = (emitted == null ? declared : emitted)
29 .map((id) => new AssetId.parse(id)).toList(),
30 this.input = input == null ? null : new AssetId.parse(input);
31
32 bool doIsPrimary(AssetId id) => input == null || id == input;
33
34 void doApply(Transform transform) {
35 for (var id in emitted) {
36 transform.addOutput(new Asset.fromString(id, id.toString()));
37 }
38 }
39
40 void declareOutputs(DeclaringTransform transform) {
41 declared.forEach(transform.declareOutput);
42 }
43 }
OLDNEW
« no previous file with comments | « pkg/barback/test/transformer/create_asset.dart ('k') | pkg/barback/test/transformer/declaring_aggregate_many_to_many.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698