Consider the following buildscript where
.
configurations {
myConfig
}
task addToMyConfig {
doLast {
println "Doing some work"
dependencies {
myConfig 'log4j:log4j:1.2.17'
}
}
}
task useMyConfig {
doLast {
println "myConfig = $configurations.myConfig.files"
}
}
Question: Is there a way to run addToMyConfigevery time it is configurations.myConfigresolved without adding dependencies to the task, where does it useMyConfigdepend on addToMyConfig?
I would like to say:
configurations.myConfig.builtBy addToMyConfig
** I do not want to talk **
useMyConfig.dependsOn addToMyConfig
I want to avoid useMyConfig.dependsOn addToMyConfigbecause there can be many tasks that consumeconfigurations.myConfig
. ConfigurableFileCollection.builtBy(Object... tasks), , Configuration ( FileCollection)