Lukáš Kúšik
04/27/2024, 11:05 AMorg.gradle.api.tasks.TaskExecutionException: Execution failed for task ':shared:linkPodDebugFrameworkIosArm64'.
Caused by: java.lang.IllegalStateException: Following dependencies exported in the podDebugFramework binary are not specified as API-dependencies of a corresponding source set:
Files: [/Users/cvb941/.gradle/caches/modules-2/files-2.1/com.benasher44/uuid-iosarm64/0.8.4/34b8d38c65dd651a3680572ca7ac60aa4a2ed493/uuid.klib]
Files: [/Users/cvb941/.gradle/caches/modules-2/files-2.1/dev.icerock.moko/resources-iosarm64/0.24.0-beta-1/c4c45169689fd3a348b9dd322be3c24ae3b9a1f4/resources.klib]
Files: [/Users/cvb941/.gradle/caches/modules-2/files-2.1/dev.icerock.moko/graphics-iosarm64/0.9.0/2484b8f1d0c25aa966e2ebd68bf538047cc1bab9/graphics.klib]
Files: [/Users/cvb941/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-core-iosarm64/1.8.0/cea8e525a09fbb5f179bc4237c335170a879c08c/kotlinx-coroutines-core.klib]
Files: [/Users/cvb941/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-datetime-iosarm64/0.5.0/59fd4e92ee56cde95dc20ec968782960f4efb98/kotlinx-datetime.klib]
Files: [/Users/cvb941/.gradle/caches/modules-2/files-2.1/io.arrow-kt/arrow-core-iosarm64/1.1.5/61cfefcae9825594f269deb4f831ac8338829d3e/arrow-core.klib]
Files: [/Users/cvb941/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-serialization-json-iosarm64/1.6.2/404a109ef646ed6fe12b5ea4bfe2d9bf97be8478/kotlinx-serialization-json.klib]
Files: [/Users/cvb941/.gradle/caches/modules-2/files-2.1/com.benasher44/uuid-iosarm64/0.8.4/34b8d38c65dd651a3680572ca7ac60aa4a2ed493/uuid.klib]
Files: [/Users/cvb941/.gradle/caches/modules-2/files-2.1/dev.icerock.moko/resources-iosarm64/0.24.0-beta-1/c4c45169689fd3a348b9dd322be3c24ae3b9a1f4/resources.klib]
Files: [/Users/cvb941/.gradle/caches/modules-2/files-2.1/dev.icerock.moko/graphics-iosarm64/0.9.0/2484b8f1d0c25aa966e2ebd68bf538047cc1bab9/graphics.klib]
Files: [/Users/cvb941/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-core-iosarm64/1.8.0/cea8e525a09fbb5f179bc4237c335170a879c08c/kotlinx-coroutines-core.klib]
Files: [/Users/cvb941/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-datetime-iosarm64/0.5.0/59fd4e92ee56cde95dc20ec968782960f4efb98/kotlinx-datetime.klib]
Files: [/Users/cvb941/.gradle/caches/modules-2/files-2.1/io.arrow-kt/arrow-core-iosarm64/1.1.5/61cfefcae9825594f269deb4f831ac8338829d3e/arrow-core.klib]
Files: [/Users/cvb941/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-serialization-json-iosarm64/1.6.2/404a109ef646ed6fe12b5ea4bfe2d9bf97be8478/kotlinx-serialization-json.klib]
Please add them in the API-dependencies and rerun the build.
All of the mentioned dependencies are defined as api
in commonMain and the project builds on 1.9.23. Copying the dependency to iosMain does not help either.tapchicoma
04/29/2024, 7:56 AMFilip Dolník
04/29/2024, 5:43 PMplugins {
kotlin("multiplatform") version "2.0.0-Beta5"
}
group = "co.touchlab"
version = "1.0-SNAPSHOT"
repositories {
mavenLocal()
mavenCentral()
}
kotlin {
ios()
iosSimulatorArm64()
iosX64()
// Uncomment and it will work
// val iosMain by sourceSets.getting {
// dependencies {
// api("co.touchlab:kermit:2.0.0")
// }
// }
applyDefaultHierarchyTemplate()
targets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget> {
binaries {
framework {
isStatic = true
baseName = "SKIE-test"
freeCompilerArgs = freeCompilerArgs + listOf("-Xbinary=bundleId=Kotlin")
export("co.touchlab:kermit:2.0.0")
}
}
}
// Uncomment and it will not work
// val iosMain by sourceSets.getting {
// dependencies {
// api("co.touchlab:kermit:2.0.0")
// }
// }
}
The crash itself originates in KotlinNativeLink
object in the validatedExportedLibraries function. The function compares exported libraries with those that are declared as api dependencies. The issue is that the list of API dependencies is computed in the object constructor which happens when you declare the binaries.framework. Because the exported library is not declared yet (the dependencies block is after the framework declaration block), the property apiFiles
does not contain it. This was the case for a very long time. What has changed in the 2.0.0 is that the KotlinNativeLink is now instantiated eagerly when you declare the binaries.framework. Or more precisely the Framework
object itself is now instantiated eagerly.Filip Dolník
04/29/2024, 5:46 PMTimofey Solonin
04/29/2024, 6:24 PMfreeCompilerArgs
in the framework
block? Could you please see if using the following instead of the freeCompilerArgs
helps:
linkTaskProvider.configure {
toolOptions {
freeCompilerArgs.add("-Xbinary=bundleId=Kotlin")
}
}
If this doesn't help, could you please provide a reproduction?Filip Dolník
04/29/2024, 6:34 PMfreeCompilerArgs = freeCompilerArgs + listOf("-Xbinary=bundleId=Kotlin")
fixes the issue. Touching the freeCompilerArgs
is what is causing the KotlinNativeLink
to get created in my case at least.Timofey Solonin
04/29/2024, 6:48 PMFilip Dolník
04/29/2024, 6:51 PMapiFiles
FileCollection was “live” and now it’s not.