mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-10-05 19:28:25 +00:00
`:commons` is on the CLI classpath, yet it declared Compose UI, Coil, Compose resources, markdown and desktop Compose as dependencies, dragging ~40 MB of UI/Skiko jars into every `amy` distribution. This moves every Compose-dependent file into a new KMP module, `:commonsUI`, that `api`-depends on `:commons`; `:commons` keeps only the Compose runtime (stability annotations + snapshot state) and lifecycle-viewmodel. Files keep their `com.vitorpamplona.amethyst.commons.*` packages, so the split is a build-graph boundary and no consumer import changed. 236 files were `git mv`'d (composables, icons, robohash, theme, Coil fetchers, the `@Composable` relay-client entry points, `composeResources`, and the tests that exercise them). Two headless files needed surgery instead of a move: `GalleryParser` lost a vestigial foundation `@OptIn`, and the `LocalPrivacyLockState`/`lockStateFor` CompositionLocal accessor moved out of `PrivacyLockState` into its own commonsUI file. The feed DAL under `ui/feeds` and `ui/note/ParentNote`+`ReplyContext` stay in `commons` because ViewModels depend on them. `amethyst`, `desktopApp`, `nappletHost` (NappletWebContract serves the shell from composeResources) and `benchmark` now depend on `:commonsUI`; `cli`, `geode` and `marmotBench` do not. commons' androidMain gains an explicit androidx.core KTX dep it previously got transitively through Compose UI. CI, crowdin, the icon-font tools and the escaping hook point at the new composeResources location; CLAUDE.md, commons/ARCHITECTURE.md, a new commonsUI/ARCHITECTURE.md, CONTRIBUTING, BUILDING and the affected skills document the boundary. A plan doc under commons/plans records the classification method and follow-ups. Verified: JVM compiles for commons, commonsUI, cli, desktopApp; Android debug compiles for nappletHost and amethyst; commons/commonsUI/cli JVM test suites; both verifyKmpPurity gates; the cli runtime classpath no longer resolves Compose UI, material3, Skiko or Coil. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N56KzPSYiN5edMRamvKEgD
57 lines
1.9 KiB
Kotlin
57 lines
1.9 KiB
Kotlin
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
|
|
plugins {
|
|
alias(libs.plugins.androidLibrary)
|
|
}
|
|
|
|
android {
|
|
namespace = "com.vitorpamplona.amethyst.napplethost"
|
|
compileSdk = libs.versions.android.compileSdk.get().toInt()
|
|
|
|
defaultConfig {
|
|
minSdk = libs.versions.android.minSdk.get().toInt()
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_21
|
|
targetCompatibility = JavaVersion.VERSION_21
|
|
}
|
|
|
|
buildTypes {
|
|
// :amethyst defines a `benchmark` build type (release + profileable) for macrobenchmarks.
|
|
// Declare a matching variant here so the app can resolve this library for benchmark builds.
|
|
create("benchmark") {
|
|
initWith(getByName("release"))
|
|
}
|
|
}
|
|
}
|
|
|
|
kotlin {
|
|
compilerOptions {
|
|
jvmTarget.set(JvmTarget.JVM_21)
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
// The sandbox runtime depends ONLY on the protocol/contract (commons), the shell/shim
|
|
// Compose resources it serves (commonsUI's NappletWebContract) and Nostr resolution
|
|
// (quartz) — never on :amethyst. This makes it impossible for the `:napplet` process code to
|
|
// reach for Amethyst.instance / LocalCache / Account (which don't exist in that process).
|
|
implementation(project(":commons"))
|
|
implementation(project(":commonsUI"))
|
|
implementation(project(":quartz"))
|
|
|
|
implementation(libs.androidx.core.ktx)
|
|
implementation(libs.androidx.activity)
|
|
implementation(libs.androidx.webkit)
|
|
implementation(libs.okhttp)
|
|
|
|
// Tree-level JSON for the bridge/broker envelopes (no @Serializable codegen, so no plugin needed).
|
|
implementation(libs.kotlinx.serialization.json)
|
|
|
|
// Provider side of the cross-process UI embedding: hosts the browser WebView in this keyless
|
|
// `:napplet` process and ships its rendered surface to the main app via SurfaceControlViewHost.
|
|
implementation(libs.androidx.privacysandbox.ui.core)
|
|
implementation(libs.androidx.privacysandbox.ui.provider)
|
|
}
|