desktop: build nanohttpd from a submodule (#7396)

This commit is contained in:
sh
2026-08-20 13:43:09 +01:00
committed by GitHub
parent 0ec028a668
commit ca8a7eda69
9 changed files with 67 additions and 4 deletions
+1
View File
@@ -16,6 +16,7 @@ android/build
android/release
common/build
desktop/build
external/nanohttpd/build
release
# Generated SimpleX assets
+9
View File
@@ -6,6 +6,15 @@ This is a guide to contributing to the develop of the SimpleX android and deskto
This is the **Kotlin Multiplatform (KMP)** mobile and desktop client for SimpleX Chat, sharing code between Android and Desktop (JVM) platforms using Compose Multiplatform for UI.
## Setup
The desktop app builds nanohttpd from a submodule, Android does not use it. Before building
the desktop app on a fresh checkout:
```bash
git submodule update --init --recursive
```
## Build Commands
```bash
+1 -2
View File
@@ -148,8 +148,7 @@ kotlin {
implementation("org.slf4j:slf4j-simple:2.0.12")
implementation("uk.co.caprica:vlcj:4.8.3")
implementation("net.java.dev.jna:jna:5.14.0")
implementation("com.github.NanoHttpd.nanohttpd:nanohttpd:efb2ebf")
implementation("com.github.NanoHttpd.nanohttpd:nanohttpd-websocket:efb2ebf")
implementation(project(":external:nanohttpd"))
implementation("com.squareup.okhttp3:okhttp:4.12.0")
}
}
+43
View File
@@ -0,0 +1,43 @@
plugins {
`java-library`
}
// Built from the upstream submodule pinned at efb2ebf85a2b06f7c508aba9eaad5377e3a01e81, because
// upstream never released the org.nanohttpd packages and JitPack no longer serves or builds that
// commit. Only the core and websocket modules are used, the samples are not.
group = "org.nanohttpd"
version = "efb2ebf"
val upstream = layout.projectDirectory.dir("upstream")
sourceSets {
main {
java {
setSrcDirs(listOf(upstream.dir("core/src/main/java"), upstream.dir("websocket/src/main/java")))
exclude("org/nanohttpd/samples/**")
}
resources.setSrcDirs(listOf(upstream.dir("core/src/main/resources")))
}
}
java {
val jvmVersion = JavaVersion.toVersion(providers.gradleProperty("kotlin.jvm.target").get())
sourceCompatibility = jvmVersion
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
doFirst {
if (!upstream.file("core/src/main/java").asFile.isDirectory) {
throw GradleException("nanohttpd sources are missing, run: git submodule update --init --recursive")
}
}
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
filePermissions { unix("644") }
dirPermissions { unix("755") }
}
+1 -1
View File
@@ -18,4 +18,4 @@ pluginManagement {
rootProject.name = "app"
include(":android", ":desktop", ":common")
include(":android", ":desktop", ":common", ":external:nanohttpd")