Task 02-01-02. Adds Phase 2 deps to the version catalog and routes
them into composeApp + server build files. Ktor stays pinned at
3.4.1 per the resolved Open Question — patch bump deferred unless a
concrete incompatibility appears.
Catalog (gradle/libs.versions.toml):
- Versions: appauth, appauth-ios, androidx-security-crypto, exposed,
hikari, multiplatformSettings, testcontainers, plus the
kotlinCocoapods plugin alias.
- Libraries: ktor server auth/auth-jwt/call-logging/status-pages,
ktor client core/auth/content-negotiation/logging/okhttp/darwin/cio,
ktor-serializationKotlinxJsonMpp (the multiplatform variant; the
-jvm one stays for server), AppAuth, AndroidX Security Crypto,
multiplatform-settings + coroutines, Exposed core/jdbc/java-time,
HikariCP, Testcontainers postgresql + junit-jupiter.
composeApp/build.gradle.kts:
- Apply kotlinSerialization (alias) and kotlin.native.cocoapods (by
id — the plugin is shipped inside the Kotlin Gradle plugin already
on the classpath via recipe.kotlin.multiplatform; alias-applying
it would request a fresh version and fail).
- Cocoapods block: ComposeApp baseName + isStatic, ../iosApp/Podfile,
iOS deployment target 15.0, AppAuth pod pulled from
libs.versions.appauth.ios.get() — no literal pin in the build
file (verify-no-version-literals.sh stays green).
- Common deps: Ktor client family, MPP serialization, multiplatform
settings; Android: AppAuth-Android + Security Crypto + OkHttp
engine; iOS: Darwin engine; JVM: CIO engine.
server/build.gradle.kts: Adds Ktor server auth/JWT/CallLogging/
StatusPages, Exposed DSL trio, Hikari, kotlinx.serialization-json,
plus testImplementation testcontainers postgresql + junit-jupiter.
Deviations:
- Rule 3 (blocking): manifestPlaceholders["appAuthRedirectScheme"]
= "recipe" added to Android defaultConfig because AppAuth-Android's
bundled manifest declares a ${appAuthRedirectScheme} placeholder
that breaks AGP merge before Plan 02-04 lands the full <intent-filter>.
- Rule 3 (blocking): top-level group/version on composeApp (required
by the cocoapods podspec generator) pushes the Compose Resources
Res-class package off recipe.composeapp.generated.resources, breaking
Phase 1 App.kt imports. Lock the package via compose.resources {
packageOfResClass = "recipe.composeapp.generated.resources" }.
- Rule 3 (housekeeping): *.podspec is generated by the cocoapods
plugin on every build; ignored.
Verification:
- ./gradlew :composeApp:dependencies --configuration debugCompileClasspath
:server:dependencies --configuration runtimeClasspath: PASS
(the plan-stated androidMainCompileClasspath name doesn't exist
under this AGP/Gradle combo; debugCompileClasspath is the
functional equivalent and resolves all new deps).
- ./gradlew :composeApp:compileDebugKotlinAndroid :server:compileKotlin: PASS
- ./gradlew :composeApp:compileKotlinIosSimulatorArm64: PASS (cinterop
pulls AppAuth pod cleanly).
- ./tools/verify-no-version-literals.sh: PASS
- ./tools/verify-shared-pure.sh: PASS
- All Task 2 grep acceptance criteria satisfied.
149 lines
6.6 KiB
Kotlin
149 lines
6.6 KiB
Kotlin
plugins {
|
|
// AGP must apply before recipe.kotlin.multiplatform — the latter calls androidTarget(),
|
|
// which requires the Android Gradle Plugin to already be on the project.
|
|
alias(libs.plugins.androidApplication)
|
|
id("recipe.kotlin.multiplatform")
|
|
alias(libs.plugins.composeMultiplatform)
|
|
alias(libs.plugins.composeCompiler)
|
|
alias(libs.plugins.composeHotReload)
|
|
alias(libs.plugins.kotlinSerialization)
|
|
// CocoaPods is shipped inside the Kotlin Gradle plugin already on the classpath via
|
|
// `recipe.kotlin.multiplatform`. Applying via `alias(libs.plugins.kotlinCocoapods)`
|
|
// would request a fresh version and fail with "already on the classpath", so we
|
|
// apply it by id only. The catalog still owns the shared Kotlin version.
|
|
id("org.jetbrains.kotlin.native.cocoapods")
|
|
id("recipe.quality")
|
|
}
|
|
|
|
// Top-level project version is required by the Kotlin CocoaPods plugin when no explicit
|
|
// `version` is set inside the `cocoapods { ... }` block. Mirrors `server/build.gradle.kts`
|
|
// — Gradle artifact metadata only, NOT a library/plugin pin (per `verify-no-version-literals.sh`).
|
|
group = "dev.ulfrx.recipe"
|
|
version = "1.0.0"
|
|
|
|
android {
|
|
namespace = "dev.ulfrx.recipe"
|
|
compileSdk = libs.versions.android.compileSdk.get().toInt()
|
|
|
|
defaultConfig {
|
|
applicationId = "dev.ulfrx.recipe"
|
|
minSdk = libs.versions.android.minSdk.get().toInt()
|
|
targetSdk = libs.versions.android.targetSdk.get().toInt()
|
|
versionCode = 1
|
|
versionName = "1.0"
|
|
|
|
// AppAuth-Android (D-01) bundles a manifest entry for its
|
|
// `RedirectUriReceiverActivity` that requires `${appAuthRedirectScheme}` to be
|
|
// resolved at merge time. Pin it to the Phase 2 redirect scheme so simply
|
|
// pulling AppAuth into the classpath (Plan 02-01) doesn't break AGP's manifest
|
|
// merger before Plan 02-04 lands the full `<intent-filter>` registration.
|
|
// Must match `dev.ulfrx.recipe.shared.Constants.OIDC_REDIRECT_URI` byte-for-byte.
|
|
manifestPlaceholders["appAuthRedirectScheme"] = "recipe"
|
|
}
|
|
packaging {
|
|
resources {
|
|
excludes += "/META-INF/{AL2.0,LGPL2.1}"
|
|
}
|
|
}
|
|
buildTypes {
|
|
getByName("release") {
|
|
isMinifyEnabled = false
|
|
}
|
|
}
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_11
|
|
targetCompatibility = JavaVersion.VERSION_11
|
|
}
|
|
}
|
|
|
|
kotlin {
|
|
// The Kotlin CocoaPods plugin (D-01) configures the iOS framework on the iOS targets
|
|
// declared by `recipe.kotlin.multiplatform`. `baseName = "ComposeApp"` / `isStatic = true`
|
|
// keep existing Swift `import ComposeApp` working. The AppAuth iOS pod version comes
|
|
// from the version catalog so this build file stays free of literal pins.
|
|
cocoapods {
|
|
summary = "Recipe Compose Multiplatform shared framework"
|
|
homepage = "https://github.com/ulfrxdev/recipe"
|
|
ios.deploymentTarget = "15.0"
|
|
podfile = project.file("../iosApp/Podfile")
|
|
framework {
|
|
baseName = "ComposeApp"
|
|
isStatic = true
|
|
}
|
|
pod("AppAuth") {
|
|
version = libs.versions.appauth.ios.get()
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
commonMain.dependencies {
|
|
implementation(project.dependencies.platform(libs.koin.bom))
|
|
implementation(libs.koin.core)
|
|
implementation(libs.koin.compose)
|
|
implementation(libs.koin.composeViewmodel)
|
|
implementation(libs.kermit)
|
|
implementation(libs.compose.runtime)
|
|
implementation(libs.compose.foundation)
|
|
implementation(libs.compose.material3)
|
|
implementation(libs.compose.ui)
|
|
implementation(libs.compose.components.resources)
|
|
implementation(libs.compose.uiToolingPreview)
|
|
implementation(libs.androidx.lifecycle.viewmodelCompose)
|
|
implementation(libs.androidx.lifecycle.runtimeCompose)
|
|
implementation(projects.shared)
|
|
|
|
// Phase 2: Ktor client + serialization + secure settings (D-13, D-16, D-17).
|
|
// The MPP variant of `ktor-serialization-kotlinx-json` is required here; the
|
|
// server module keeps the `-jvm` variant via `libs.ktor.serializationKotlinxJson`.
|
|
implementation(libs.ktor.clientCore)
|
|
implementation(libs.ktor.clientAuth)
|
|
implementation(libs.ktor.clientContentNegotiation)
|
|
implementation(libs.ktor.clientLogging)
|
|
implementation(libs.ktor.serializationKotlinxJsonMpp)
|
|
implementation(libs.kotlinx.serializationJson)
|
|
implementation(libs.multiplatform.settings)
|
|
implementation(libs.multiplatform.settings.coroutines)
|
|
}
|
|
androidMain.dependencies {
|
|
implementation(libs.compose.uiToolingPreview)
|
|
implementation(libs.androidx.activity.compose)
|
|
implementation(libs.koin.android)
|
|
|
|
// Phase 2 Android: AppAuth-Android + AndroidX Security Crypto for the
|
|
// SecureAuthStateStore actual (D-01, D-13). EncryptedSharedPreferences is
|
|
// accepted technical debt per Open Question #1; the Keystore-backed
|
|
// implementation can replace it without touching AuthSession.
|
|
implementation(libs.appauth)
|
|
implementation(libs.androidx.security.crypto)
|
|
implementation(libs.ktor.clientOkhttp)
|
|
}
|
|
iosMain.dependencies {
|
|
// Phase 2 iOS: Darwin engine for Ktor; AppAuth-iOS arrives via the
|
|
// CocoaPods block above so the shared framework links it directly.
|
|
implementation(libs.ktor.clientDarwin)
|
|
}
|
|
jvmMain.dependencies {
|
|
implementation(compose.desktop.currentOs)
|
|
implementation(libs.kotlinx.coroutinesSwing)
|
|
|
|
// Phase 2 Desktop: CIO is the JVM Ktor engine for the dev-mode auth stub
|
|
// (D-02). The full stub lives in Plan 02-04; this just makes the engine
|
|
// available so `composeApp:run` still compiles in Phase 2.
|
|
implementation(libs.ktor.clientCio)
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
debugImplementation(libs.compose.uiTooling)
|
|
}
|
|
|
|
// Adding `group = "dev.ulfrx.recipe"` (required by the Kotlin CocoaPods plugin to render
|
|
// the podspec) shifts the Compose Resources `Res` class package from
|
|
// `recipe.composeapp.generated.resources` to `dev.ulfrx.recipe.composeapp.generated.resources`,
|
|
// breaking the Phase 1 `App.kt` import. Lock the historical package so this plan's wiring
|
|
// changes don't cascade into UI code; Plan 02-04+ replaces `App.kt`'s template body anyway.
|
|
compose.resources {
|
|
packageOfResClass = "recipe.composeapp.generated.resources"
|
|
}
|