Files
Incido/desktopApp/build.gradle.kts
T
Incido Developer 59bd6e106b feat(phase-1/m4.3c): ViewModels off APPLICATION_KEY; DesktopContainer implements AppGraph
Completes the M4.3 container seam:

* NoteListViewModel + NoteEditorViewModel (UiStates and SharedImage
  included) move to commonMain. NoteEditorViewModel had zero android.*
  imports; its four withContext(Dispatchers.IO) sites become
  withContext(ioDispatcher) — a new internal expect/actual whose ACTUALS
  are literally Dispatchers.IO on both targets, so Android behaviour is
  byte-identical (invariant §2.1), merely spelled through the seam.
* New commonMain EncryptionBadge/LibraryVerification: the read-only
  mirror of :core:data's EncryptionVerification. Required because
  :core:data is an androidLibrary invisible to commonMain and must stay
  so (invariant §2.3 — objectbox-android vs objectbox-java classpaths).
  AppGraph gains encryptionBadge; both containers map the real verifier
  result 1:1 at their own seam.
* SettingsViewModel stays in androidMain (SecurityManager, Keystore key
  provider, BackupManager Uri IO, CarnetImporter are genuine Android-only
  services — the graph was NOT widened to fake them, §9) but its factory
  now takes the concrete AppContainer via a new LocalAndroidContainer,
  provided alongside LocalAppGraph in IncidoApp. No APPLICATION_KEY /
  IncidoApplication reference survives in ANY ViewModel: all six call
  sites (drawer, list, editor, settings, pin setup, pin change) build
  factories from the graph/container locals at composition time.
* M4.3 exit proof: DesktopContainer : AppGraph — the same face
  (noteRepository/settingsRepository/encryptionBadge) the commonMain
  ViewModels consume, compiler-checked by :desktopApp building against
  :composeApp's jvm target. repository → noteRepository rename.
  The stand-in two-pane UI still runs (M4.5 consumes the real screens).

Verification (all green, one suite):
  ./gradlew assembleDebug :composeApp:compileKotlinJvm :desktopApp:build
      → BUILD SUCCESSFUL
  ./gradlew :desktopApp:run … --self-test --exit-after 6 → SELFTEST id=1, clean exit
  ./gradlew :core:data-jvm:smoke → RESULT: M1a PASS
  crypto legs (separate processes): leg-A ALL-OK → LEG-B PASS/ALL-OK
  git diff '*/objectbox-models/*' → empty
2026-10-06 16:42:48 +13:00

63 lines
2.6 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), 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)."
}
}
}