Files
Incido/desktopApp/build.gradle.kts
T
Incido Developer 8db835640e feat(phase-1/m3.1): :core:settings — SettingsRepository shared, store injected
Milestone M3 task 1 (DESKTOP_PHASE_PLAN §5): move UserSettings +
SettingsRepository into a plain kotlin("jvm") module so the desktop
build reads/writes the SAME preferences keys and .preferences_pb format
the phone uses. Package name org.incido.compose.data.settings kept, so
the Android diff is file moves + one constructor change.

Seam: SettingsRepository now takes an injected DataStore<Preferences>.
Android supplies the preferencesDataStore(name = "incido_settings")
Context-extension store (new AndroidSettingsStore.kt, moved verbatim);
desktop builds it with PreferenceDataStoreFactory.create(
corruptionHandler = ReplaceFileCorruptionHandler, produceFile) — the
Phase-0 API delta (no Context extension on the multiplatform core
artifact). snapshot() keeps runBlocking for startup-only use.

DesktopContainer grows settingsRepository first, mirroring AppContainer
construction order ahead of M3's cipher install. dynamic_color /
use_biometric / block_screenshots keys ride along but have no desktop
UI — hidden, not faked (M3 exit rule).

Verified: ./gradlew assembleDebug (green; :app needed :core:settings on
its classpath — MainActivity reads userSettingsFlow, same pattern as
:core:domain) + ./gradlew :desktopApp:run --args="--data-dir
/tmp/incido-desktop-smoke --self-test --exit-after 6" (RENDER/SELFTEST
sequence intact) + ./gradlew :core:data-jvm:smoke (green).
2026-10-06 06:20:13 +13:00

58 lines
2.3 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)
}
// Packaging works (proven in Phase 0), but per-OS installers and icons are
// milestone M5. Version is pinned numerically here because jpackage only
// accepts major.minor.patch; M5 wires it to the app's version scheme.
compose.desktop {
application {
mainClass = "org.incido.desktop.MainKt"
nativeDistributions {
targetFormats(TargetFormat.Deb, TargetFormat.Rpm, TargetFormat.AppImage)
packageName = "incido"
packageVersion = "0.4.2"
vendor = "Incido"
description = "Incido — offline-first notes (desktop)."
}
}
}