Fixed updating the gradle wrapper in a multi-project build
parent
01eb8a356f
commit
42e370d72a
|
@ -50,8 +50,9 @@ GradleUpdateTask : DefaultTask() {
|
|||
} else {
|
||||
println("\tDetected new Gradle Version: '$foundGradleVersion', updating from '$current'")
|
||||
|
||||
val wrapper = project.tasks.create("wrapperUpdate", Wrapper::class.java)
|
||||
wrapper.apply {
|
||||
val wrapperUpdate = project.tasks.create("wrapperUpdate", Wrapper::class.java)
|
||||
|
||||
wrapperUpdate.apply {
|
||||
group = "other"
|
||||
outputs.upToDateWhen { false }
|
||||
outputs.cacheIf { false }
|
||||
|
@ -61,7 +62,7 @@ GradleUpdateTask : DefaultTask() {
|
|||
distributionType = Wrapper.DistributionType.ALL
|
||||
}
|
||||
|
||||
wrapper.actions[0].execute(wrapper)
|
||||
wrapperUpdate.actions[0].execute(wrapperUpdate)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,18 +53,24 @@ class GradleUtils : Plugin<Project> {
|
|||
|
||||
propertyMappingExtension = project.extensions.create("GradleUtils", StaticMethodsAndTools::class.java, project)
|
||||
|
||||
project.tasks.create("updateGradleWrapper", GradleUpdateTask::class.java).apply {
|
||||
group = "gradle"
|
||||
outputs.upToDateWhen { false }
|
||||
outputs.cacheIf { false }
|
||||
description = "Automatically update Gradle to the latest version"
|
||||
}
|
||||
// do absolutely NOTHING if we are not the root project.
|
||||
// the gradle wrapper CAN ONLY be applied to the ROOT project (in a multi-project build), otherwise it will FAIL
|
||||
// when trying to apply to the sub-projects.
|
||||
|
||||
project.tasks.create("checkGradleVersion", GradleCheckTask::class.java).apply {
|
||||
group = "gradle"
|
||||
outputs.upToDateWhen { false }
|
||||
outputs.cacheIf { false }
|
||||
description = "Gets both the latest and currently installed Gradle versions"
|
||||
if (project == project.rootProject) {
|
||||
project.tasks.create("updateGradleWrapper", GradleUpdateTask::class.java).apply {
|
||||
group = "gradle"
|
||||
outputs.upToDateWhen { false }
|
||||
outputs.cacheIf { false }
|
||||
description = "Automatically update Gradle to the latest version"
|
||||
}
|
||||
|
||||
project.tasks.create("checkGradleVersion", GradleCheckTask::class.java).apply {
|
||||
group = "gradle"
|
||||
outputs.upToDateWhen { false }
|
||||
outputs.cacheIf { false }
|
||||
description = "Gets both the latest and currently installed Gradle versions"
|
||||
}
|
||||
}
|
||||
|
||||
project.tasks.create("updateDependencies", GetVersionInfoTask::class.java).apply {
|
||||
|
|
Loading…
Reference in New Issue