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

Unified Diff: sdk/lib/_internal/pub/lib/src/barback/load_transformers.dart

Issue 169223010: Allow transformers to exclude and include assets. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/pub/lib/src/barback/load_transformers.dart
diff --git a/sdk/lib/_internal/pub/lib/src/barback/load_transformers.dart b/sdk/lib/_internal/pub/lib/src/barback/load_transformers.dart
index 13567edcdbb7160869936af5ed02b0104fff68fc..585dba2203ffab6681c725ce487624b6ca05d03b 100644
--- a/sdk/lib/_internal/pub/lib/src/barback/load_transformers.dart
+++ b/sdk/lib/_internal/pub/lib/src/barback/load_transformers.dart
@@ -19,6 +19,7 @@ import '../dart.dart' as dart;
import '../log.dart' as log;
import '../utils.dart';
import 'build_environment.dart';
+import 'excluding_transformer.dart';
/// A Dart script to run in an isolate.
///
@@ -386,7 +387,9 @@ Future<Set> loadTransformers(BuildEnvironment environment, TransformerId id) {
// TODO(nweiz): support non-JSON-encodable configuration maps.
'configuration': JSON.encode(id.configuration)
}).then((transformers) {
- transformers = transformers.map(_deserializeTransformerOrGroup).toSet();
+ transformers = transformers.map(
+ (transformer) => _deserializeTransformerOrGroup(
+ transformer, id.includes, id.excludes)).toSet();
nweiz 2014/02/24 21:42:46 Rather than passing the includes and excludes arou
Bob Nystrom 2014/02/26 01:09:41 Done, except in ExcludingTransformer. It felt weir
log.fine("Transformers from $assetId: $transformers");
return transformers;
});
@@ -447,9 +450,10 @@ class _ForeignGroup implements TransformerGroup {
/// The result of calling [toString] on the transformer group in the isolate.
final String _toString;
- _ForeignGroup(Map map)
+ _ForeignGroup(Set<String> includes, Set<String> excludes, Map map)
: phases = map['phases'].map((phase) {
- return phase.map(_deserializeTransformerOrGroup).toList();
+ return phase.map((transformer) => _deserializeTransformerOrGroup(
+ transformer, includes, excludes)).toList();
}).toList(),
_toString = map['toString'];
@@ -457,10 +461,15 @@ class _ForeignGroup implements TransformerGroup {
}
/// Converts a serializable map into a [Transformer] or a [TransformerGroup].
-_deserializeTransformerOrGroup(Map map) {
- if (map['type'] == 'Transformer') return new _ForeignTransformer(map);
+_deserializeTransformerOrGroup(Map map, Set<String> includes,
+ Set<String> excludes) {
+ if (map['type'] == 'Transformer') {
+ var transformer = new _ForeignTransformer(map);
+ return ExcludingTransformer.wrap(transformer, includes, excludes);
+ }
+
assert(map['type'] == 'TransformerGroup');
- return new _ForeignGroup(map);
+ return new _ForeignGroup(includes, excludes, map);
}
/// Converts [transform] into a serializable map.

Powered by Google App Engine
This is Rietveld 408576698