Files
amethyst/nappletHost/build.gradle.kts
T
Claude 2415565ebf refactor: replace org.json with kotlinx.serialization in source files
Sweeps the last org.json usages out of the Kotlin sources and moves them
to kotlinx.serialization's JSON tree API (already the project standard):

- nappletHost: bridge/broker envelope handling in NappletHostActivity,
  NappletHostService, NappletBrowserActivity, NappletBrowserService and
  NappletFaviconSniffer now parses with Json.parseToJsonElement via new
  total helpers in JsonEnvelope.kt (absent/mistyped fields degrade to
  empty/false instead of throwing, matching the old opt* semantics).
  Adds the kotlinx-serialization-json runtime to the module (tree API
  only, so no serialization plugin needed).
- amethyst embed IME relay: EmbeddedImeBridge parses ime.* envelopes
  with JsonObject accessors; RemoteImeView and EmbeddedTabLayer build
  their outgoing envelopes with buildJsonObject.
- tools/ime-test: drops the now-stale "org.json is stubbed in JVM unit
  tests" rationale from the README and shim-events.mjs header.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AVcZwp65oybotmq5o66foW
2026-08-30 05:52:29 +00:00

55 lines
1.8 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) 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(":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)
}