Simplify Lokksmith integration

This commit is contained in:
2026-04-30 22:27:37 +02:00
parent e0af5f4053
commit 95bbeb57d2
39 changed files with 325 additions and 740 deletions

View File

@@ -1,6 +1,12 @@
dependencyResolutionManagement {
repositories {
google()
google {
mavenContent {
includeGroupAndSubgroups("androidx")
includeGroupAndSubgroups("com.android")
includeGroupAndSubgroups("com.google")
}
}
mavenCentral()
gradlePluginPortal()
}

View File

@@ -1,87 +1,22 @@
// Establishes the D-05 target matrix + JVM toolchain + warning policy.
// Android bytecode is JVM 11 (D-08); server + desktop + shared/jvm are JVM 21.
//
// This plugin is intentionally dependency-free: shared/ must stay light
// (no Koin, no Kermit), and composeApp adds those in its own build file.
import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.kotlin.dsl.getByType
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
plugins {
id("org.jetbrains.kotlin.multiplatform")
}
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
kotlin {
jvmToolchain(21)
androidTarget {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
}
}
// Framework declaration moved here from composeApp/build.gradle.kts when the
// CocoaPods plugin was dropped (2026-04-28). The Xcode run script invokes
// :composeApp:embedAndSignAppleFrameworkForXcode, which needs `baseName` to
// resolve `import ComposeApp` from Swift. `isStatic = true` keeps the link
// shape unchanged from the previous CocoaPods setup. The `:shared` module is
// still re-exported so Swift can read shared constants when needed.
listOf(iosArm64(), iosSimulatorArm64()).forEach { target ->
target.binaries.framework {
baseName = "ComposeApp"
isStatic = true
// `composeApp` only applies the multiplatform plugin; project deps
// live in its own build file. Skip the export when this convention
// plugin is applied to a module that doesn't depend on `:shared`
// (e.g., shared itself).
project.findProject(":shared")?.let { sharedProject ->
if (project != sharedProject) export(sharedProject)
}
}
}
jvm {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_21)
}
}
@OptIn(ExperimentalWasmDsl::class)
wasmJs { browser() }
compilerOptions {
allWarningsAsErrors.set(true)
}
sourceSets {
commonTest.dependencies {
implementation(libs.findLibrary("kotlin-test").get())
}
}
}
// Relax allWarningsAsErrors for KLIB-merging metadata tasks. KotlinCompileCommon
// aggregates dependency KLIBs and surfaces upstream "duplicated unique_name"
// resolver warnings caused by androidx.lifecycle 2.10.0 (Android-only) and
// org.jetbrains.androidx.lifecycle 2.10.0 (CMP) co-publishing artifacts with
// matching KLIB unique_names. This is an upstream Compose-Multiplatform 1.10 +
// lifecycle 2.10 ecosystem condition (KT-62515-style), not actionable in our
// source — so we keep -Werror on real source compilation tasks but disable it
// for the metadata-aggregation step where no user code is being compiled.
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompileCommon>().configureEach {
// KMP metadata tasks can surface duplicate KLIB unique_name warnings from upstream
// Compose/AndroidX artifacts. Keep warnings-as-errors for source compilation, but
// do not fail metadata aggregation on dependency metadata warnings.
tasks.withType<KotlinCompilationTask<*>>().configureEach {
compilerOptions {
allWarningsAsErrors.set(false)
}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile>().configureEach {
if (name.endsWith("KotlinMetadata")) {
compilerOptions {
allWarningsAsErrors.set(false)
}
allWarningsAsErrors.set(!name.endsWith("KotlinMetadata"))
}
}

View File

@@ -18,23 +18,3 @@ spotless {
trimTrailingWhitespace()
}
}
// D-11 redundancy guard: if a module applies recipe.quality alongside a Kotlin plugin
// (multiplatform or jvm), ensure allWarningsAsErrors still applies even if the module
// build didn't already configure it. Guarded with plugins.withId so this plugin is
// safely composable even when applied alone (no KotlinCompilationTask type available
// on the classpath until a Kotlin plugin is present).
plugins.withId("org.jetbrains.kotlin.multiplatform") {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask<*>>().configureEach {
compilerOptions {
allWarningsAsErrors.set(!name.endsWith("KotlinMetadata"))
}
}
}
plugins.withId("org.jetbrains.kotlin.jvm") {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask<*>>().configureEach {
compilerOptions {
allWarningsAsErrors.set(true)
}
}
}