Closed ghost closed 11 years ago
I tried to do something like this when I first created the plugin. I actually wanted to provide common tasks for dealing with SCM and doing releases, but allow users to be able to define their own release process by setting the tasks in the ReleaseConvention. I wasn't able to accomplish this because the ReleaseConvention wasn't configured before the ReleaseTask was, and thus the user's values are never seen. Do you know if there are any draw backs to using the GradleLauncher as you have? I seem to remember the Gradle folks discouraging it's use and using the GradleBuild Task type instead. Does kicking off a new GradleLauncher as you have forward the output (and input) to the current console?
I'm not sure about the GradleLauncher. Even the API page warns that it's half deprecated, so you're right that it can't be relied on. Regardless, what I posted is definitely NOT the way to do what I actually want. I didn't notice the GradleBuild
type on the release
task until just now. That whole ridiculous overridden task setup I posted can be replaced by this:
release.tasks.eachWithIndex { it, i ->
if (it.equals('build')) {
release.tasks[i] = 'releaseBuild'
}
}
I wouldn't be surprised if there's some other shorter syntax, but that's the best I could come up with for now. I don't know enough about the structure of plugins to make any suggestions, but, as long as having build
as the main lifecycle task in the plugin isn't going to change, the above works perfectly fine for me.
I also noticed that if a build fails between confirmReleaseVersion
and preTagCommit
the gradle.properties
file will contain the unSnapshotted (release) version number and I have to fix it by hand.
Ok cool. I think I'll add your work-a-round to the readme file so others can use it. I don't think the build
task will change - at least not anytime soon, since it's the default task for the standard plugins (java, groovy, etc..).
As for the other question, please create a separate ticket and describe the situation where the release fails between those two steps so I can recreate it. I've tried my best to revert the gradle.properties
file should anything fail, but I'm sure there are holes.
I would like to configure the plugin to use my own lifecycle task(s) instead of the default
build
task. I imagine something like this:I'm including part of my build script inline to show how I've set up a few lifecycle tasks and integrated them with the plugin. It seems to work quite well, but I just finished writing it, so it shouldn't be taken as an example of how to structure a build.