Skip to content

Commit

Permalink
chore: ensure verifyReleaseDependencies can be executed several times…
Browse files Browse the repository at this point in the history
… in snapshot builds

Previously the second execution was UP-TO-DATE, so the task did not print the diff.
  • Loading branch information
vlsi committed May 19, 2023
1 parent 3722961 commit a67b5e0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/dist/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,13 @@ val verifyReleaseDependencies by tasks.registering {
inputs.file(expectedLibs)
val actualLibs = File(buildDir, "dist/expected_release_jars.csv")
outputs.file(actualLibs)
val ignoreJarsMismatch = version.toString().endsWith("-SNAPSHOT")
if (ignoreJarsMismatch || updateExpectedJars) {
// The task does not fail in case of -SNAPSHOT version, so we make the task never UP-TO-DATE
// in that case. Otherwise, the task never executes on the second request, even if the user runs with
// -PupdateExpectedJars
outputs.upToDateWhen { false }
}
doLast {
val caseInsensitive: Comparator<String> = compareBy(String.CASE_INSENSITIVE_ORDER, { it })

Expand Down Expand Up @@ -237,7 +244,7 @@ val verifyReleaseDependencies by tasks.registering {
if (updateExpectedJars) {
println("Updating ${expectedLibs.relativeTo(rootDir)}")
actualLibs.copyTo(expectedLibs, overwrite = true)
} else if (version.toString().endsWith("-SNAPSHOT")) {
} else if (ignoreJarsMismatch) {
// Renovate requires self-hosted runner for executing postUpgradeTasks,
// so we can't make Renovate to update expected_release_jars.csv at the moment
logger.lifecycle(sb.toString())
Expand Down

0 comments on commit a67b5e0

Please sign in to comment.