I am working with the following project structure
Project
|-Subproject1
|-Subproject2
|build.gradle
|settings.gradle
The submodules are included in the settings.gradle
and configured in the build.gradle
of the root project.
I have 3 tasks to do
build
(every subproject has this)deploy
(this is a packaging mechanism for every subproject needs to work on its own)finalizeDeployment
(this needs to be invoked only once)
I want to be able to call
$gradle deploy
<- all subprojects get deployed and finalize gets called once at the end
$gradle Subproject1:deploy
<- Subproject1 gets deployed and finalize gets called
build.gradle
configure(subprojects) {
task build <<{
println "Do Build "+ project.name
}
task deploy(dependsOn:build){
println 'deploy '+project.name
doLast{
finalizeDeployment.execute()
}
}
}
task finalizeDeployment{
dependsOn subprojects.deploy
doLast{
println 'Finalize Deployment'
}
}