snowe
11/19/2018, 6:11 PMgradle.properties
, like so
version=0.14.0
commonVersion=0.15.0-SNAPSHOT
enterpriseVersion=0.16.0-SNAPSHOT
I need to remove the snapshot, so I've written a task
tasks {
register("snapshotIncrementer") {
group = "release"
inputs.file("gradle.properties")
outputs.file("gradle.properties")
doFirst {
val file = File("$projectDir/gradle.properties")
val newLines = file.readLines().map { it.replace("-SNAPSHOT", "") }
file.writeText(newLines.joinToString(separator = "\n"))
exec {
setIgnoreExitValue(true)
commandLine("git", "commit", "-m", "Removing SNAPSHOT versions", "--", "gradle.properties")
}
}
doLast {
Thread.sleep(20000)
}
}
"checkSnapshotDependencies" {
dependsOn("snapshotIncrementer")
}
}
That runs before the gradle-release plugin checks if snapshot versions are present. This succeeds in committing the gradle.properties file with the -SNAPSHOT
removed, but no matter how long I Thread.sleep
for, when the checkSnapshotDependencies
task runs, it still sees the old version of the file. I am not sure why this would be unless gradle is doing some sort of optimizing and starting the second task thread before the snapshotIncrementer
is done. Any ideas what I can do to get this working?