Gradle 8 compatibility
TWiStErRob opened this issue · 1 comments
From repo: bnorm/kotlin-power-assert@0b398d6 (latest commit that exhibits the problem)
Task :kotlin-power-assert-gradle:publishPluginJar
Execution optimizations have been disabled for task ':kotlin-power-assert-gradle:publishPluginJar' to ensure correctness due to the following reasons:
- Gradle detected a problem with the following location: 'P:\projects\contrib\github-kotlin-power-assert\kotlin-power-assert-gradle\build\generated\source\buildConfig\main\main'. Reason: Task ':kotlin-power-assert-gradle:publishPluginJar' uses this output of task ':kotlin-power-assert-gradle:generateBuildConfig' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.4.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.
Gradle detected a problem with the following location: 'P:\projects\contrib\github-kotlin-power-assert\kotlin-power-assert-gradle\build\generated\source\buildConfig\main\main'. Reason: Task ':kotlin-power-assert-gradle:publishPluginJar' uses this output of task ':kotlin-power-assert-gradle:generateBuildConfig' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.4.2/userguide/validation_problems.html#implicit_dependency for more details about this problem. This behaviour has been deprecated and is scheduled to be removed in Gradle 8.0. Execution optimizations are disabled to ensure correctness. See https://docs.gradle.org/7.4.2/userguide/more_about_tasks.html#sec:up_to_date_checks for more details.
This is a serious breakage in Gradle 8.0.
Workaround
afterEvaluate {
// com.gradle.plugin-publish uses afterEvaluate to create everything.
// Note: misleading name, this is actually `PublishPlugin.createAndSetupJarSourcesTask()`.
tasks.named("publishPluginJar") {
// https://github.com/gmazzo/gradle-buildconfig-plugin/pull/38
dependsOn(tasks.generateBuildConfig)
}
}
Actually, never mind, the project was using a 3 year old version...
This has been fixed 2 years ago in #12 by this line https://github.com/gmazzo/gradle-buildconfig-plugin/pull/12/files#diff-8754fa7ea91eec5a991c4e9d8a5dd52c06868684fb4812c2a8ee8579bb97e5fcR25
If anyone runs into this, mind the coordinate change in 4.0:
https://github.com/gmazzo/gradle-buildconfig-plugin/releases/tag/v4.0.0