Fix Gradle build sometimes gives spurious "unreferenced license file" warnings (#13696)

Revert changes by #12150 in jar-checks.gradle, because tasks in this file share internal state between tasks without using files. Because of this all tasks here must always execute together, so they cannot define task outputs.
This commit is contained in:
Uwe Schindler 2024-08-28 20:35:26 +02:00 committed by GitHub
parent 79fd9fee97
commit e45b5ebdf8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 10 deletions

View File

@ -20,6 +20,10 @@
// 2) notice file // 2) notice file
// 3) checksum validation/ generation. // 3) checksum validation/ generation.
// WARNING: The tasks in this file share internal state between tasks without using files.
// Because of this all tasks here must always execute together, so they cannot define task outputs.
// TODO: Rewrite the internal state to use state files containing the ext.jarInfos and its referencedFiles
// This should be false only for debugging. // This should be false only for debugging.
def failOnError = true def failOnError = true
@ -194,13 +198,6 @@ subprojects {
description = "Validate license and notice files of dependencies" description = "Validate license and notice files of dependencies"
dependsOn collectJarInfos dependsOn collectJarInfos
def outputFileName = 'validateJarLicenses'
inputs.dir(file(project.rootDir.path + '/lucene/licenses'))
.withPropertyName('licenses')
.withPathSensitivity(PathSensitivity.RELATIVE)
outputs.file(layout.buildDirectory.file(outputFileName))
.withPropertyName('validateJarLicensesResult')
doLast { doLast {
def errors = [] def errors = []
jarInfos.each { dep -> jarInfos.each { dep ->
@ -246,9 +243,7 @@ subprojects {
} }
} }
} }
// Required to take advantage of incremental building and the build cache
def f = new File(project.buildDir.path + "/" + outputFileName)
f.write(errors.toString(), "UTF-8")
if (errors) { if (errors) {
def msg = "Certain license/ notice files are missing:\n - " + errors.join("\n - ") def msg = "Certain license/ notice files are missing:\n - " + errors.join("\n - ")
if (failOnError) { if (failOnError) {

View File

@ -405,6 +405,12 @@ Bug Fixes
* GITHUB#13691: Fix incorrect exponent value in explain of SigmoidFunction. (Owais Kazi) * GITHUB#13691: Fix incorrect exponent value in explain of SigmoidFunction. (Owais Kazi)
Build
---------------------
* GITHUB#13695, GITHUB#13696: Fix Gradle build sometimes gives spurious "unreferenced license file" warnings.
(Uwe Schindler)
Other Other
-------------------- --------------------
(No changes) (No changes)