desktop: fix nanohttpd submodule check never running (#7408)

This commit is contained in:
sh
2026-08-25 09:40:13 +01:00
committed by GitHub
parent ca8a7eda69
commit 0210591af7
+15 -6
View File
@@ -26,16 +26,25 @@ java {
targetCompatibility = jvmVersion
}
// Without this the jar records the build machine's timestamps, file order and file modes,
// which makes the desktop packages unreproducible
tasks.jar {
// Checked here and not during configuration, so that Android builds, which don't use nanohttpd,
// work without the submodule
val upstreamSources = sourceSets.main.get().java.matching { include("org/nanohttpd/**") }
// compileJava and jar silently succeed without the sources, so the check needs its own task.
// It cannot run during configuration, Android builds must work without the submodule.
val checkUpstreamSources by tasks.registering {
doFirst {
if (!upstream.file("core/src/main/java").asFile.isDirectory) {
if (upstreamSources.isEmpty) {
throw GradleException("nanohttpd sources are missing, run: git submodule update --init --recursive")
}
}
}
tasks.compileJava {
dependsOn(checkUpstreamSources)
}
// Without this the jar records the build machine's timestamps, file order and file modes,
// which makes the desktop packages unreproducible
tasks.jar {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
filePermissions { unix("644") }