Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library barback.transformer.aggregate_transformer; | 5 library barback.transformer.aggregate_transformer; |
| 6 | 6 |
| 7 import '../asset/asset_id.dart'; | 7 import '../asset/asset_id.dart'; |
| 8 import 'aggregate_transform.dart'; | 8 import 'aggregate_transform.dart'; |
| 9 | 9 |
| 10 /// An alternate interface for transformers that want to perform aggregate | 10 /// An alternate interface for transformers that want to perform aggregate |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 /// If possible, aggregate transformers should implement | 25 /// If possible, aggregate transformers should implement |
| 26 /// [DeclaringAggregateTransformer] as well to help barback optimize the package | 26 /// [DeclaringAggregateTransformer] as well to help barback optimize the package |
| 27 /// graph. | 27 /// graph. |
| 28 abstract class AggregateTransformer { | 28 abstract class AggregateTransformer { |
| 29 /// Classifies an asset id by returning a key identifying which group the | 29 /// Classifies an asset id by returning a key identifying which group the |
| 30 /// asset should be placed in. | 30 /// asset should be placed in. |
| 31 /// | 31 /// |
| 32 /// All assets for which [classifyPrimary] returns the same key are passed | 32 /// All assets for which [classifyPrimary] returns the same key are passed |
| 33 /// together to the same [apply] call. | 33 /// together to the same [apply] call. |
| 34 /// | 34 /// |
| 35 /// Any string can be used to classify an asset. If possible, though, this | 35 /// This may return [Future<String>] or, if it's entirely synchronous, |
| 36 /// should return a path-like string to aid in logging. If [classifyPrimary] | 36 /// [String]. Any string can be used to classify an asset. If possible, |
| 37 /// needs to do asynchronous work, it can also return a [Future] that | 37 /// though, this should return a path-like string to aid in logging. If |
| 38 /// completes to the key. | 38 /// [classifyPrimary] needs to do asynchronous work, it can also return a |
| 39 /// [Future] that completes to the key. | |
|
Bob Nystrom
2014/05/08 20:30:48
This last sentence seems redundant with the first.
nweiz
2014/05/08 21:12:36
Done.
| |
| 39 /// | 40 /// |
| 40 /// A return value of `null` indicates that the transformer is not interested | 41 /// A return value of `null` indicates that the transformer is not interested |
| 41 /// in an asset. Assets with a key of `null` will not be passed to any [apply] | 42 /// in an asset. Assets with a key of `null` will not be passed to any [apply] |
| 42 /// call; this is equivalent to [Transformer.isPrimary] returning `false`. | 43 /// call; this is equivalent to [Transformer.isPrimary] returning `false`. |
| 43 String classifyPrimary(AssetId id); | 44 classifyPrimary(AssetId id); |
| 44 | 45 |
| 45 /// Runs this transformer on a group of primary inputs specified by | 46 /// Runs this transformer on a group of primary inputs specified by |
| 46 /// [transform]. | 47 /// [transform]. |
| 47 /// | 48 /// |
| 48 /// If this does asynchronous work, it should return a [Future] that completes | 49 /// If this does asynchronous work, it should return a [Future] that completes |
| 49 /// once it's finished. | 50 /// once it's finished. |
| 50 /// | 51 /// |
| 51 /// This may complete before [AggregateTransform.primarInputs] is closed. For | 52 /// This may complete before [AggregateTransform.primarInputs] is closed. For |
| 52 /// example, it may know that each key will only have two inputs associated | 53 /// example, it may know that each key will only have two inputs associated |
| 53 /// with it, and so use `transform.primaryInputs.take(2)` to access only those | 54 /// with it, and so use `transform.primaryInputs.take(2)` to access only those |
| 54 /// inputs. | 55 /// inputs. |
| 55 apply(AggregateTransform transform); | 56 apply(AggregateTransform transform); |
| 56 | 57 |
| 57 String toString() => runtimeType.toString().replaceAll("Transformer", ""); | 58 String toString() => runtimeType.toString().replaceAll("Transformer", ""); |
| 58 } | 59 } |
| OLD | NEW |