I have the following code:
static def getFamilyDependencies(ConfigurationContainer configurations) {
def result = configurations.collect { configuration ->
configuration.allDependencies.findAll { dependency ->
dependency instanceof DefaultProjectDependency
} collect { projectDependency ->
projectDependency.dependencyProject.name
}
} flatten()
result as Set
}
and I would like to test it. So far, I have:
@Test
void shouldGetFamilyDependencies() {
final Project project = ProjectBuilder.builder().build()
final configurations = project.getConfigurations()
configurations.create('configuration0')
configurations.create('configuration1')
configurations.each { configuration ->
println "***************** ${configuration}"
configuration.allDependencies.each {
println "@@@@@@@@@@@@@@@@@ ${it}"
}
}
}
How do I add dependencies to the configurations? The following doesn't work:
final Project subproject = ProjectBuilder.builder().build()
configurations.configuration0 {
subproject
}
configurations.configuration1 {
allDependencies {
subproject
}
}
This should do the trick:
configuration.getDependencies().add(dependenyMock);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With