| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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.test.transformer.many_to_one; | 5 library barback.test.transformer.many_to_one; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:barback/barback.dart'; | 9 import 'package:barback/barback.dart'; |
| 10 import 'package:barback/src/utils.dart'; | 10 import 'package:barback/src/utils.dart'; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 Future<bool> doIsPrimary(Asset asset) => | 27 Future<bool> doIsPrimary(Asset asset) => |
| 28 new Future.value(asset.id.extension == ".$extension"); | 28 new Future.value(asset.id.extension == ".$extension"); |
| 29 | 29 |
| 30 Future doApply(Transform transform) { | 30 Future doApply(Transform transform) { |
| 31 return getPrimary(transform) | 31 return getPrimary(transform) |
| 32 .then((primary) => primary.readAsString()) | 32 .then((primary) => primary.readAsString()) |
| 33 .then((contents) { | 33 .then((contents) { |
| 34 // Get all of the included inputs. | 34 // Get all of the included inputs. |
| 35 return Future.wait(contents.split(",").map((path) { | 35 return Future.wait(contents.split(",").map((path) { |
| 36 var id = new AssetId(transform.primaryId.package, path); | 36 var id; |
| 37 if (path.contains("|")) { |
| 38 id = new AssetId.parse(path); |
| 39 } else { |
| 40 id = new AssetId(transform.primaryId.package, path); |
| 41 } |
| 37 return getInput(transform, id).then((input) => input.readAsString()); | 42 return getInput(transform, id).then((input) => input.readAsString()); |
| 38 })); | 43 })); |
| 39 }).then((outputs) { | 44 }).then((outputs) { |
| 40 var id = transform.primaryId.changeExtension(".out"); | 45 var id = transform.primaryId.changeExtension(".out"); |
| 41 transform.addOutput(new Asset.fromString(id, outputs.join())); | 46 transform.addOutput(new Asset.fromString(id, outputs.join())); |
| 42 }); | 47 }); |
| 43 } | 48 } |
| 44 | 49 |
| 45 String toString() => "many->1 $extension"; | 50 String toString() => "many->1 $extension"; |
| 46 } | 51 } |
| OLD | NEW |