Skip to content

Commit 05294de

Browse files
authored
Disable generateLicenseReport task unless it is explicitly run (#7995)
After gradle 8 update gradle started complaining that other tasks depend on `generateLicenseReport` output. Hopefully disabling this task during regular builds fixes this.
1 parent a217e77 commit 05294de

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

javaagent/build.gradle.kts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,18 @@ tasks {
232232
delete(rootProject.file("licenses"))
233233
}
234234

235+
val generateLicenseReportEnabled = gradle.startParameter.taskNames.any { it.equals("generateLicenseReport") }
235236
named("generateLicenseReport").configure {
236237
dependsOn(cleanLicenses)
237238
finalizedBy(":spotlessApply")
239+
// disable licence report generation unless this task is explicitly run
240+
// the files produced by this task are used by other tasks without declaring them as dependency
241+
// which gradle considers an error
242+
enabled = enabled && generateLicenseReportEnabled
243+
}
244+
if (generateLicenseReportEnabled) {
245+
project.parent?.tasks?.getByName("spotlessMisc")?.dependsOn(named("generateLicenseReport"))
238246
}
239-
project.parent?.tasks?.getByName("spotlessMisc")?.dependsOn(named("generateLicenseReport"))
240247

241248
// Because we reconfigure publishing to only include the shadow jar, the Gradle metadata is not correct.
242249
// Since we are fully bundled and have no dependencies, Gradle metadata wouldn't provide any advantage over

0 commit comments

Comments
 (0)