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

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

Issue 23543005: Make Transform a little more pleasant to use: (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise test code for handling primaryInput. Created 7 years, 3 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
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 10
(...skipping 18 matching lines...) Expand all
29 Future doApply(Transform transform) { 29 Future doApply(Transform transform) {
30 return getPrimary(transform) 30 return getPrimary(transform)
31 .then((primary) => primary.readAsString()) 31 .then((primary) => primary.readAsString())
32 .then((contents) { 32 .then((contents) {
33 // Get all of the included inputs. 33 // Get all of the included inputs.
34 return Future.wait(contents.split(",").map((path) { 34 return Future.wait(contents.split(",").map((path) {
35 var id; 35 var id;
36 if (path.contains("|")) { 36 if (path.contains("|")) {
37 id = new AssetId.parse(path); 37 id = new AssetId.parse(path);
38 } else { 38 } else {
39 id = new AssetId(transform.primaryId.package, path); 39 id = new AssetId(transform.primaryInput.id.package, path);
40 } 40 }
41 return getInput(transform, id).then((input) => input.readAsString()); 41 return getInput(transform, id).then((input) => input.readAsString());
42 })); 42 }));
43 }).then((outputs) { 43 }).then((outputs) {
44 var id = transform.primaryId.changeExtension(".out"); 44 var id = transform.primaryInput.id.changeExtension(".out");
45 transform.addOutput(new Asset.fromString(id, outputs.join())); 45 transform.addOutput(new Asset.fromString(id, outputs.join()));
46 }); 46 });
47 } 47 }
48 48
49 String toString() => "many->1 $extension"; 49 String toString() => "many->1 $extension";
50 } 50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698