[GRADLE-2873] configuration.setExtendsFrom() may not clear all previous targets Created: 21/Aug/13 Updated: 02/Sep/13 Resolved: 02/Sep/13 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | None |
Fix Version/s: | 1.8-rc-1 |
Type: | Bug | ||
Reporter: | Szczepan Faber | Assignee: | Szczepan Faber |
Resolution: | Fixed | Votes: | 0 |
Known Issue Of: |
Description |
If the same configuration is added to extendsFrom multiple times then setExtendsFrom() does not behave correctly and fails to clear out dependencies from previous extends-from targets. It affects earlier versions of Gradle, too. Here's an example: configurations { foo bar baz } repositories { mavenCentral() } dependencies { foo 'junit:junit:4.10' bar 'org.mockito:mockito-core:1.9.5' } configurations.baz.extendsFrom configurations.foo //2nd time: configurations.baz.extendsFrom configurations.foo assert configurations.baz.allDependencies*.name == ['junit'] configurations.baz.extendsFrom = [configurations.bar] //fails: assert configurations.baz.allDependencies*.name == ['mockito-core'] //workaround: if (!configurations.baz.extendsFrom.contains(configurations.foo)) { configurations.baz.extendsFrom configurations.foo } |