Skip to content

Commit fb830b7

Browse files
committed
Fix a bug where pub would fail to load a transformer.
If a transformer is defined in a dependency, used in the root package, and restricted (via $include or $exclude) to only run on files in test/, pub will think it's not necessary and fail to load it. [email protected] Review URL: https://codereview.chromium.org//1052353003 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44876 260f80e4-7a28-3924-810f-c04153c831b5
1 parent 0e48841 commit fb830b7

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

sdk/lib/_internal/pub/lib/src/barback/dependency_computer.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class DependencyComputer {
7575
return phase.expand((config) {
7676
var id = config.id;
7777
if (id.isBuiltInTransformer) return [];
78-
if (id.package != _graph.entrypoint.root.name &&
78+
if (package.name != _graph.entrypoint.root.name &&
7979
!config.canTransformPublicFiles) {
8080
return [];
8181
}

sdk/lib/_internal/pub/test/dependency_computer/dev_transformers_test.dart

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,28 @@ void main() {
4747
expectDependencies({"myapp": []});
4848
});
4949

50+
integration("does return a dependency's transformer that the root package "
51+
"uses", () {
52+
d.dir(appPath, [
53+
d.pubspec({
54+
"name": "myapp",
55+
"dependencies": {"foo": {"path": "../foo"}},
56+
"transformers": [{"foo": {"\$include": "test/myapp_test.dart"}}]
57+
}),
58+
d.dir("test", [d.file("myapp_test.dart", "")])
59+
]).create();
60+
61+
d.dir("foo", [
62+
d.pubspec({
63+
"name": "foo",
64+
"version": "1.0.0"
65+
}),
66+
d.dir("lib", [d.file("foo.dart", transformer())])
67+
]).create();
68+
69+
expectDependencies({"foo": []});
70+
});
71+
5072
integration("doesn't return a dependency's transformer that can run on bin",
5173
() {
5274
d.dir(appPath, [

0 commit comments

Comments
 (0)