feat(phase-1/m1a): platform-neutral data layer + :core:data-jvm

Phase 1 milestone M1a (Development Plan §6, desktop track): make the whole
data layer usable from a non-Android build, without touching what the
Android app compiles.

:core:data splits its sources:
  src/main/kotlin      platform-neutral — entities, repository, field
                       crypto, NoteCryptoService. Compiled by BOTH
                       :core:data and :core:data-jvm. Must not import
                       android.*
  src/androidMain/kotlin  Android-only seam implementations.

Two seams were required, both identified by the Phase-0 spike:
  ObjectBoxStore          Context on Android, a directory on desktop. Same
                          FQN in sibling modules that are never on one
                          classpath — which is also what keeps
                          objectbox-android and objectbox-java (they ship
                          the same io.objectbox.* classes) apart.
  ImageOrientationNormalizer  EXIF rotation needs a bitmap decoder; the
                          implementation moved verbatim out of
                          NoteRepositoryImpl, which is now platform-free.
                          The parameter is required, not defaulted, so a
                          platform that forgets it fails the build.

New :core:data-jvm compiles those shared sources against objectbox-java /
objectbox-linux with its own codegen. `:core:data-jvm:smoke` runs the real
NoteRepositoryImpl (save + hashtags + attachment round-trip + close/reopen)
on the JVM: PASS, with the generator reporting "ID model file unchanged" —
one schema, two generated runtimes.

Also: .gitignore excluded **/objectbox-models/, so the schema contract was
never committed and a fresh clone regenerated UIDs. default.json is now
tracked; the rest of that directory stays ignored. This matters more now
that two modules generate from it.

Verified: :core:data-jvm:smoke PASS, assembleDebug green.
This commit is contained in:
Incido Developer committed 2026-10-05 18:20:59 +13:00
1 parent 8b66e82acb
commit 9fe4763aa7
13 files changed
+753 -44

No files matched your search

+13
View File
@@ -26,3 +26,16 @@ include(":app")
include(":composeApp")
include(":core:domain")
include(":core:data")
// Phase 1 (M1a): the desktop build of the same data layer. It compiles
// :core:data's platform-neutral sources against the JVM ObjectBox runtime —
// see core/data-jvm/build.gradle.kts for why this is a sibling module and not
// a multiplatform one.
include(":core:data-jvm")
// --- Desktop feasibility spike (Development Plan §6.3, throwaway) ---
// Throwaway probes that answer "can the existing stack run on the JVM"
// before any of Phases 1-6 are committed to. They are additive: no module
// above is touched, and nothing outside `spike/` depends on them.
// See tools/DESKTOP_FEASIBILITY.md for the findings + how to delete these.
include(":spike:data-jvm")
include(":spike:compose-jvm")