Files
Incido/composeApp/build.gradle.kts
T
Incido Developer bdb3d7157d feat(phase-1/m4.4a): first screens to commonMain + shared clipboard
Pure moves: IncidoDrawer, ReleaseNotesDialog, PassphraseDialog
(clipboard: Context.getSystemService -> LocalClipboardManager, the
SAME API both targets ship in Compose 1.7.3 - the section 6.3
LocalClipboard+ClipEntry swap is a Compose 1.8-only API, recorded
for M5+). PassphraseGenerator moves behind an internal expect/
actual secureRandomInt (blockingFirst precedent; identical
SecureRandom actuals - both targets ARE the JVM).

New seams justified: secureRandomInt (java.security is not common);
commonMain gains jetbrains lifecycle viewmodel-compose +
runtime-compose (the SAME coordinates androidMain resolved since
M4.1) and material-icons-extended (moved with the screens).

Verified: ./gradlew assembleDebug :desktopApp:build SUCCESSFUL
+ :composeApp:compileKotlinJvm + :desktopApp:run --self-test
(SELFTEST id=1 -> RENDER notes=1 selected=1) + :core:data-jvm:smoke
(M1a PASS); objectbox-models clean.
2026-10-06 18:26:07 +13:00

169 lines
7.9 KiB
Kotlin

// composeApp — Incido's UI module: all screens, ViewModels, theme,
// navigation, and the manual DI container.
//
// Phase 1 (M4.1): converted in place from `kotlin("android")` to
// `kotlin("multiplatform")` with `androidTarget()` + `jvm()`, per the
// order of attack in tools/DESKTOP_PHASE_PLAN.md §6.1. The split is
// deliberately conservative — the goal of THIS step is the build shape:
//
// * commonMain — every file that compiles for both targets today
// (theme Color/Type, PasswordPolicy, ReleaseNotes,
// LinkedShareComposer) plus two expect/actual seams:
// `platformDynamicColorScheme` and `relativeTimestamp`.
// The Android actuals keep the pre-M4 code verbatim.
// * androidMain — everything still touching `android.*` (screens,
// ViewModels, AppContainer, security, backup IO, …),
// moved UNMODIFIED. Zero behaviour change; the seams
// for these move file-by-file in M4.2/M4.3.
// * jvmMain — the JVM actuals. Nothing else yet: :desktopApp keeps
// its own stand-in UI until M4.5 consumes this target.
//
// Note: :core:domain converted to multiplatform in M4.2, so commonMain
// sees it — NoteColors.kt moved up with that commit.
plugins {
alias(libs.plugins.androidLibrary)
alias(libs.plugins.kotlinMultiplatform)
// org.jetbrains.compose provides the `compose.*` dependency accessors
// that resolve to the right artifact per target (androidx.compose.*
// on androidTarget, *-desktop jars on jvm).
alias(libs.plugins.compose)
alias(libs.plugins.kotlinCompose)
// v0.3.2.0 — Kotlin Serialization for the Backup JSON codec (used by
// CarnetImporter today; the plugin stays target-agnostic).
alias(libs.plugins.kotlinSerialization)
}
kotlin {
jvmToolchain(17)
androidTarget()
jvm()
sourceSets {
commonMain.dependencies {
implementation(compose.runtime)
implementation(compose.ui)
implementation(compose.foundation)
implementation(compose.material3)
// Phase 1 (M4.4a): moved screens (IncidoDrawer, PassphraseDialog)
// use extended icons (Drafts/LabelOff/Tag/ContentCopy/Visibility).
// androidMain already had the same jetbrains coordinate (it
// resolves to androidx on that target); on jvm this pulls the
// ~100 MB material-icons-extended-desktop jar (§3 trap — a first
// build can time out; retry, don't debug).
implementation(libs.compose.material.icons.extended)
implementation(libs.kotlinx.coroutines.core)
// Phase 1 (M4.3b): the §6.4 artifact check resolves GREEN —
// these org.jetbrains.androidx.lifecycle coordinates are what
// androidMain has been resolving since M4.1 (assembleDebug
// proves they coexist with the AndroidX BOM on the android
// target), and the desktopApp runtime already carried the
// matching -desktop jars. Here they enter commonMain so the
// ViewModels move with their `androidx.lifecycle.*` imports
// UNCHANGED (the offline set keeps the androidx FQCNs).
implementation(libs.androidx.lifecycle.viewmodel)
// Phase 1 (M4.4a): screens move with their construction sites
// intact — `viewModel(factory = …)` from viewmodel-compose and
// `collectAsStateWithLifecycle` from runtime-compose. These are
// the SAME jetbrains coordinates androidMain already resolved
// since M4.1 (collectAsStateWithLifecycle reached the Android
// classpath through them), now declared in commonMain so the
// moved screens compile for both targets (§6.4 GREEN).
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.androidx.lifecycle.runtime.compose)
// Phase 1 (M4.2): :core:domain is multiplatform now (M4.2's own
// conversion), so commonMain can see it — this is what let
// NoteColors.kt move up. api: screens/ViewModels across all
// targets consume Note/NoteColor/NoteRepository from it.
api(project(":core:domain"))
// Phase 1 (M4.3a): :core:settings converted in the same shape —
// M4.3's AppGraph exposes SettingsRepository/UserSettings to
// commonMain, so this has to be api too.
api(project(":core:settings"))
}
androidMain.dependencies {
implementation(project(":core:data"))
// Phase 1 (M2 task 1): backup codecs + bridge now live here; the
// org.incido.compose.data.backup package name was kept, so no imports
// changed — only this dependency line.
implementation(project(":core:backup"))
// Phase 1 (M3 task 1): settings repository, same treatment — package
// kept, the Context-based construction moved to AndroidSettingsStore.kt.
implementation(project(":core:settings"))
// Core / lifecycle
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.viewmodel)
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.androidx.lifecycle.runtime)
implementation(libs.androidx.lifecycle.process)
implementation(libs.kotlinx.coroutines.android)
// Compose BOM keeps all Compose artefact versions aligned.
// (Called inline — the KMP source-set dependency handler's
// platform() returns a raw notation, not a Dependency, so the
// old `val composeBom = platform(…)` idiom fails here.)
implementation(project.dependencies.platform(libs.composeBom))
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.navigation.compose)
// Compose (same org.jetbrains.compose artifacts as before the
// M4.1 conversion — they resolve to the androidx variants on
// this target; version alignment unchanged).
implementation(libs.compose.ui)
implementation(libs.compose.ui.tooling.preview)
implementation(libs.compose.foundation)
implementation(libs.compose.material3)
implementation(libs.compose.material.icons.extended)
// v0.3.2.0 — Settings (DataStore Preferences), Security (Biometric),
// and Backup (Kotlin Serialization JSON) support.
implementation(libs.androidx.datastore.preferences)
implementation(libs.androidx.biometric)
implementation(libs.kotlinx.serialization.json)
}
jvmMain.dependencies {
// Nothing yet — the compose artifacts arrive via commonMain;
// :core:data-jvm / :core:settings wiring lands with M4.3's
// container seam when :desktopApp starts consuming this target.
}
}
}
android {
namespace = "org.incido.compose"
compileSdk = 35
defaultConfig {
minSdk = 26
}
// M4.1: `buildFeatures.compose` is NOT set — the org.jetbrains.compose
// plugin owns Compose wiring on this target (setting it here alongside
// the KMP plugin is the classic double-wire; see §3 trap 6's sibling).
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}
// AGP's debug-only configurations are project-level, so the Compose
// tooling dependency that was `debugImplementation` before the M4.1
// conversion keeps that exact scope here (the KMP `sourceSets { … }`
// dependency handlers only expose implementation/api/compileOnly).
dependencies {
debugImplementation(libs.compose.ui.tooling)
}