[Gradle] Keep materializing commonizeCInteropTask...

...as it contains important information needed to create
 consumable commonized cinterop configurations

^KT-59596 Verification Pending
This commit is contained in:
Anton Lakotka
2023-08-08 11:33:46 +02:00
committed by Space Team
parent 14f216764d
commit cbe11e8c9a
2 changed files with 4 additions and 10 deletions
@@ -75,13 +75,7 @@ class KotlinMultiplatformPlugin : Plugin<Project> {
// Ensure that the instance is created and configured during apply
project.kotlinIdeMultiplatformImport
project.locateOrRegisterIdeResolveDependenciesTask()
// FIXME: This code creates consumable configurations for Commonized CInterops
// FIXME: Unfortunately, it also creates [commonizeCInteropTask] eagerly
// FIXME: Decouple [allInteropGroups] from task internals and then create configuration without task materialization.
project.launch {
val task = project.commonizeCInteropTask()?.get() ?: return@launch
project.createCommonizedCInteropApiElementsKlibArtifact(task)
}
project.launch { project.createCommonizedCInteropApiElementsKlibArtifact() }
project.addBuildListenerForXcode()
project.whenEvaluated { kotlinMultiplatformExtension.createFatFrameworks() }
}
@@ -41,9 +41,9 @@ internal fun createCInteropApiElementsKlibArtifact(
}
}
internal suspend fun Project.createCommonizedCInteropApiElementsKlibArtifact(
interopTask: CInteropCommonizerTask
) {
internal suspend fun Project.createCommonizedCInteropApiElementsKlibArtifact() {
// TODO: Find a way to not materialize task. i.e. initialize only outputDirectory and allInteropGroups
val interopTask = project.commonizeCInteropTask()?.get() ?: return
for (commonizerGroup in interopTask.allInteropGroups.await()) {
for (sharedCommonizerTargets in commonizerGroup.targets) {
val configuration = locateOrCreateCommonizedCInteropApiElementsConfiguration(sharedCommonizerTargets)