mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-11 08:47:33 +00:00
Merge pull request #3216 from davotoula/fix/ios-test-uikit-prebuilt-cache
Restore iOS test native-cache workaround dropped in dependency bump
This commit is contained in:
@@ -1,5 +1,23 @@
|
||||
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.DisableCacheInKotlinVersion
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeCacheApi
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.TestExecutable
|
||||
|
||||
// Disables the Kotlin/Native compiler cache for an iOS test binary so the
|
||||
// Compose ui-uikit klib recompiles fresh instead of linking the broken prebuilt
|
||||
// cache (see the call site in the `kotlin {}` block). The version guard makes
|
||||
// Kotlin re-surface this workaround once we move past 2.4.0, so it can be
|
||||
// dropped when a newer Compose/Kotlin pairing fixes the cache. Wrapped in a
|
||||
// helper because @OptIn only applies to declarations, not bare statements.
|
||||
@OptIn(KotlinNativeCacheApi::class)
|
||||
fun TestExecutable.disableUiKitPrebuiltCache() =
|
||||
disableNativeCache(
|
||||
DisableCacheInKotlinVersion.`2_4_0`,
|
||||
"Compose ui-uikit prebuilt cache references UIViewLayoutRegion (iOS 17+); " +
|
||||
"linking the iOS test binary fails under Xcode 16.4.",
|
||||
)
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.kotlinMultiplatform)
|
||||
@@ -50,6 +68,22 @@ kotlin {
|
||||
iosArm64()
|
||||
iosSimulatorArm64()
|
||||
|
||||
// Compose Multiplatform 1.11.x ships an `org.jetbrains.compose.ui:ui-uikit`
|
||||
// prebuilt Kotlin/Native cache whose CMPLayoutRegion object hard-references
|
||||
// the UIKit class `UIViewLayoutRegion` (introduced in iOS 17). Linking the
|
||||
// iOS *test* executable against that cache under Xcode 16.4 fails with
|
||||
// ld: Undefined symbols: _OBJC_CLASS_$_UIViewLayoutRegion
|
||||
// because the cached object was built for a newer simulator SDK (18.5) than
|
||||
// the test binary is being linked for (14.0). Disabling the native cache for
|
||||
// the iOS test binaries makes ui-uikit recompile against the active SDK,
|
||||
// where the symbol resolves. See disableUiKitPrebuiltCache() above and
|
||||
// https://kotl.in/disable-native-cache
|
||||
targets.withType<KotlinNativeTarget>().configureEach {
|
||||
binaries.withType<TestExecutable>().configureEach {
|
||||
disableUiKitPrebuiltCache()
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
|
||||
Reference in New Issue
Block a user