Hi together,
I have been playing around with gradle for some time and now it is time for the
first real project.
The user guide has a nice example on how to set the version-number in relation
to the DAG (chapter 2.11) and this is what I want to do:
version = null
task('init').doLast {
if (build.taskGraph.hasTask(':release')) {
version = '1.0'
} else {
version = 'SNAPSHOT'
}
logger.warn ' Version set to: {}', version
}
My question is: How can I use the version property in libs and dists tasks?
E.g. I want to use the version property as part of the path prefix to added
files of the archive:
dists {
zipRoot = "${name}-${version}"
zip() {
zipFileSet(dir: buildDir) {
include('*.jar')
prefix: "${zipRoot}"
}
}
}
The problem is: The second code snippet will be executed during configuration
phase whereas the task 'init' will get executed later, during execution phase.
Unfortunately, the logic contained in 'init' (setting the version number) can't
be executed before because it depends on the population of the DAG which can't
be populated before the configuration phase is finished.
Sounds like the dilemma of chicken or egg. For me, the only way around this
seems to redefine the dists task:
createTask('dists', overwrite: true) {
[...]
}
Unfortunately, I was not able to get this done because I couldn't figure out
how to use and configure the Bundle "animal".
Is there an easier solution and if not, how can you redefine tasks like libs
and dists?
Thanks for your help and keep up the good work!
Kind Regards,
Matthias
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email