| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS d.file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS d.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 pub_tests; | 5 library pub_tests; |
| 6 | 6 |
| 7 import '../descriptor.dart' as d; | 7 import '../descriptor.dart' as d; |
| 8 import '../test_pub.dart'; | 8 import '../test_pub.dart'; |
| 9 import 'utils.dart'; | 9 import 'utils.dart'; |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 } | 28 } |
| 29 | 29 |
| 30 Future declareOutputs(DeclaringTransform transform) { | 30 Future declareOutputs(DeclaringTransform transform) { |
| 31 transform.declareOutput(transform.primaryId.changeExtension(".final")); | 31 transform.declareOutput(transform.primaryId.changeExtension(".final")); |
| 32 return new Future.value(); | 32 return new Future.value(); |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 """; | 35 """; |
| 36 | 36 |
| 37 main() { | 37 main() { |
| 38 withBarbackVersions("any", () { | 38 integration("supports a user-defined declaring transformer", () { |
| 39 integration("supports a user-defined declaring transformer", () { | 39 d.dir(appPath, [ |
| 40 d.dir(appPath, [ | 40 d.pubspec({ |
| 41 d.pubspec({ | 41 "name": "myapp", |
| 42 "name": "myapp", | 42 "transformers": ["myapp/src/lazy", "myapp/src/declaring"] |
| 43 "transformers": ["myapp/src/lazy", "myapp/src/declaring"] | 43 }), |
| 44 }), | 44 d.dir("lib", [d.dir("src", [ |
| 45 d.dir("lib", [d.dir("src", [ | 45 // Include a lazy transformer before the declaring transformer, |
| 46 // Include a lazy transformer before the declaring transformer, | 46 // because otherwise its behavior is indistinguishable from a normal |
| 47 // because otherwise its behavior is indistinguishable from a normal | 47 // transformer. |
| 48 // transformer. | 48 d.file("lazy.dart", LAZY_TRANSFORMER), |
| 49 d.file("lazy.dart", LAZY_TRANSFORMER), | 49 d.file("declaring.dart", DECLARING_TRANSFORMER) |
| 50 d.file("declaring.dart", DECLARING_TRANSFORMER) | 50 ])]), |
| 51 ])]), | 51 d.dir("web", [ |
| 52 d.dir("web", [ | 52 d.file("foo.txt", "foo") |
| 53 d.file("foo.txt", "foo") | 53 ]) |
| 54 ]) | 54 ]).create(); |
| 55 ]).create(); | |
| 56 | 55 |
| 57 createLockFile('myapp', pkg: ['barback']); | 56 createLockFile('myapp', pkg: ['barback']); |
| 58 | 57 |
| 59 var server = pubServe(); | 58 var server = pubServe(); |
| 60 // The build should complete without either transformer logging anything. | 59 // The build should complete without either transformer logging anything. |
| 61 server.stdout.expect('Build completed successfully'); | 60 server.stdout.expect('Build completed successfully'); |
| 62 | 61 |
| 63 requestShouldSucceed("foo.final", "foo.out.final"); | 62 requestShouldSucceed("foo.final", "foo.out.final"); |
| 64 server.stdout.expect(emitsLines( | 63 server.stdout.expect(emitsLines( |
| 65 '[Info from LazyRewrite]:\n' | 64 '[Info from LazyRewrite]:\n' |
| 66 'Rewriting myapp|web/foo.txt.\n' | 65 'Rewriting myapp|web/foo.txt.\n' |
| 67 '[Info from DeclaringRewrite]:\n' | 66 '[Info from DeclaringRewrite]:\n' |
| 68 'Rewriting myapp|web/foo.out.')); | 67 'Rewriting myapp|web/foo.out.')); |
| 69 endPubServe(); | 68 endPubServe(); |
| 70 }); | |
| 71 }); | 69 }); |
| 72 } | 70 } |
| OLD | NEW |