From 0210591af7ad288798592b446095f219f82f452f Mon Sep 17 00:00:00 2001 From: sh <37271604+shumvgolove@users.noreply.github.com> Date: Tue, 25 Aug 2026 12:40:13 +0400 Subject: [PATCH] desktop: fix nanohttpd submodule check never running (#7408) --- .../external/nanohttpd/build.gradle.kts | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/apps/multiplatform/external/nanohttpd/build.gradle.kts b/apps/multiplatform/external/nanohttpd/build.gradle.kts index fb24922208..7841d8f803 100644 --- a/apps/multiplatform/external/nanohttpd/build.gradle.kts +++ b/apps/multiplatform/external/nanohttpd/build.gradle.kts @@ -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") }