packageVersion derived from app versionName (0.4.2.0 -> 0.4.2; printPackageVersion task). packaging/icon.png + packaging/incido.desktop template ship the icon (1.7.3 DSL exposes no iconFile — recorded). Image smoke caught a REAL bug: jlink runtime lacked jdk.unsupported, DataStore protobuf died on sun/misc.Unsafe only inside the image; fixed via modules.add. createDistributable re-verified: 171 MB image, bin/incido --self-test inside it rc=0. HiDPI: sun.java2d.uiScale=2 doubles requested geometry (screen-clamp proves it). Native Wayland: AWT probe on JDK17 AND 27 both resolve X11 XToolkit — stays XWayland; JBR bundling is Phase 2. New §3 traps + M5.3 run log recorded. Verify: :desktopApp:createDistributable (SUCCESSFUL, 171 MB); image bin/incido --data-dir /tmp/incido-img-smoke --self-test --exit-after 6 (SELFTEST id=1, RENDER notes=1, rc=0); :desktopApp:run --keys-smoke KEYS ALL-OK; :core:data-jvm:smoke M1a PASS; assembleDebug SUCCESSFUL.
89 lines
4.0 KiB
Kotlin
89 lines
4.0 KiB
Kotlin
// desktopApp — Incido for the desktop (Development Plan §6, Phase 1, M1b).
|
|
//
|
|
// A Compose Multiplatform window over :core:data-jvm, i.e. the SAME data layer
|
|
// the Android app compiles (shared sources, sibling ObjectBox codegen). The
|
|
// desktop build owns its own library in the XDG data dir; the encrypted backup
|
|
// file is the only bridge to the phone (M2) because ObjectBox is single-writer.
|
|
|
|
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
|
|
|
|
plugins {
|
|
alias(libs.plugins.kotlinJvm)
|
|
alias(libs.plugins.compose)
|
|
alias(libs.plugins.kotlinCompose)
|
|
// SPIKE FINDING: the `application` plugin is NOT applied explicitly —
|
|
// org.jetbrains.compose applies it itself, and applying it first collides
|
|
// on task registration. `compose.desktop { application { } }` gives `run`.
|
|
}
|
|
|
|
kotlin {
|
|
jvmToolchain(17)
|
|
}
|
|
|
|
dependencies {
|
|
implementation(compose.desktop.currentOs)
|
|
implementation(compose.ui)
|
|
implementation(compose.foundation)
|
|
implementation(compose.material3)
|
|
implementation(compose.materialIconsExtended)
|
|
implementation(libs.kotlinx.coroutines.core)
|
|
implementation(libs.kotlinx.coroutines.swing)
|
|
|
|
implementation(project(":core:domain"))
|
|
implementation(project(":core:data-jvm"))
|
|
// Phase 1 (M2 task 2): the backup bridge — the desktop "Import from
|
|
// file… / Export" menu speaks the phone's format through it.
|
|
implementation(project(":core:backup"))
|
|
// Phase 1 (M3 task 1): shared settings repository + the multiplatform
|
|
// DataStore core artifact, which is where a JVM builds a
|
|
// `.preferences_pb` store from a file path (no Context extension).
|
|
implementation(project(":core:settings"))
|
|
implementation(libs.androidx.datastore.preferences.core)
|
|
// Phase 1 (M4.3c): composeApp's jvm target — the AppGraph face and
|
|
// the commonMain ViewModels. DesktopContainer implementing AppGraph
|
|
// is the M4.3 exit proof, checked by the compiler. The stand-in UI
|
|
// keeps running until M4.5 consumes the real screens.
|
|
implementation(project(":composeApp"))
|
|
}
|
|
|
|
// Packaging works (proven in Phase 0), M5 wires it: version derived from
|
|
// the app's versionName, distribution icon shipped, per-OS installers need
|
|
// per-OS runners (§7: jpackage cannot cross-compile — CI matrix, M5.4).
|
|
// jpackage accepts major.minor.patch ONLY, so the app's 4-segment
|
|
// versionName (0.4.2.0 — validator in app/build.gradle.kts is the source of
|
|
// truth) maps to its first three segments; the emergency segment lives in
|
|
// the git tag, exactly like the APK release flow.
|
|
val appVersionName: String = run {
|
|
val appBuild = rootProject.file("app/build.gradle.kts").readText()
|
|
Regex("versionName\\s*=\\s*\"([0-9.]+)\"").find(appBuild)?.groupValues?.get(1)
|
|
?: error("M5.3: could not read versionName from app/build.gradle.kts")
|
|
}
|
|
|
|
compose.desktop {
|
|
application {
|
|
mainClass = "org.incido.desktop.MainKt"
|
|
nativeDistributions {
|
|
targetFormats(TargetFormat.Deb, TargetFormat.Rpm, TargetFormat.AppImage)
|
|
packageName = "incido"
|
|
packageVersion = appVersionName.split(".").take(3).joinToString(".")
|
|
vendor = "Incido"
|
|
description = "Incido — offline-first notes (desktop)."
|
|
// The jlink runtime needs jdk.unsupported: DataStore's bundled
|
|
// protobuf touches sun.misc.Unsafe (M5.3 image smoke caught it —
|
|
// :desktopApp:run never notices, the host JDK has the module).
|
|
modules.add("jdk.unsupported")
|
|
// API delta (M5.3): the 1.7.3 Compose DSL exposes NO iconFile
|
|
// property (jpackage's --icon is unreachable from here). The
|
|
// icon vehicle is packaging/incido.desktop (app-image) and the
|
|
// CI install step (deb/rpm, M5.4) — packaging/icon.png ships
|
|
// beside them.
|
|
}
|
|
}
|
|
}
|
|
|
|
// Derivation is visible (and CI-readable) without parsing jpackage logs.
|
|
tasks.register("printPackageVersion") {
|
|
doLast {
|
|
println("PACKAGE-VERSION ${appVersionName.split(".").take(3).joinToString(".")}")
|
|
}
|
|
} |