Repository: JetBrains/compose-multiplatform
File: gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/uikit/internal/resources/configureSyncIosResources.kt (Kotlin)

Code before:
                    framework.project.objects.directoryProperty().apply { set(File(it)) }
                }
        }
    }


    fun configureEachIosFramework(fn: (Framework) -> Unit) {
        mppExt.targets.all { target ->
            target.asIosNativeTargetOrNull()?.let { iosTarget ->
                iosTarget.binaries.withType(Framework::class.java).configureEach { framework ->
                    fn(framework)
                }
            }
        }
    }
}

private const val RESOURCES_SPEC_ATTR = "resources"
private fun SyncIosResourcesContext.configureCocoapodsResourcesAttribute() {
    project.withCocoapodsPlugin {
        project.gradle.taskGraph.whenReady {
            val cocoapodsExt = mppExt.cocoapodsExt
            val specAttributes = cocoapodsExt.extraSpecAttributes
            val resourcesSpec = specAttributes[RESOURCES_SPEC_ATTR]
            if (!resourcesSpec.isNullOrBlank()) {
                project.logger.warn("Warning: kotlin.cocoapods.extraSpecAttributes[\"resources\"] is ignored by Compose Multiplatform's resource synchronization for iOS")
            }
            cocoapodsExt.framework {
                val syncDir = syncDirFor(this).get().asFile
                specAttributes[RESOURCES_SPEC_ATTR] = "['${syncDir.relativeTo(project.projectDir).path}']"
                project.tasks.named("podInstall").configure {
                    it.doFirst {
                        syncDir.mkdirs()
                    }
                }
            }
        }
    }
}

private fun SyncIosResourcesContext.configureSyncResourcesTasks() {
    val lazyTasksDependencies = LazyTasksDependencyConfigurator(project.tasks)
    configureEachIosFramework { framework ->
        val frameworkClassifier = framework.namePrefix.uppercaseFirstChar()
        val syncResourcesTaskName = "sync${frameworkClassifier}ComposeResourcesForIos"
        val syncTask = framework.project.tasks.registerOrConfigure<SyncComposeResourcesForIosTask>(syncResourcesTaskName) {
            outputDir.set(syncDirFor(framework))
            iosTargets.add(iosTargetResourcesProvider(framework))
        }
        with (lazyTasksDependencies) {
            if (framework.isCocoapodsFramework) {

Review comment (suggestion):
We should describe API changes (throwing 2 errors) and what users should do in the PR message. We will add this to the CHANGELOG.

Code after:
                    framework.project.objects.directoryProperty().apply { set(File(it)) }
                }
        }
    }


    fun configureEachIosFramework(fn: (Framework) -> Unit) {
        mppExt.targets.all { target ->
            target.asIosNativeTargetOrNull()?.let { iosTarget ->
                iosTarget.binaries.withType(Framework::class.java).configureEach { framework ->
                    fn(framework)
                }
            }
        }
    }
}

private const val RESOURCES_SPEC_ATTR = "resources"
private fun SyncIosResourcesContext.configureCocoapodsResourcesAttribute() {
    project.withCocoapodsPlugin {
        project.gradle.taskGraph.whenReady {
            val cocoapodsExt = mppExt.cocoapodsExt
            val specAttributes = cocoapodsExt.extraSpecAttributes
            val resourcesSpec = specAttributes[RESOURCES_SPEC_ATTR]
            if (!resourcesSpec.isNullOrBlank()) {
                error("""
                    |Kotlin.cocoapods.extraSpecAttributes["resources"] is not compatible with Compose Multiplatform's resources management for iOS.
                    |  * Recommended action: remove extraSpecAttributes["resources"] from '${project.buildFile}' and run '${project.path}:podInstall' once;
                    |  * Alternative action: turn off Compose Multiplatform's resources management for iOS by adding '${IosGradleProperties.SYNC_RESOURCES_PROPERTY}=false' to your gradle.properties;
                """.trimMargin())
            }
            cocoapodsExt.framework {
                val syncDir = syncDirFor(this).get().asFile
                specAttributes[RESOURCES_SPEC_ATTR] = "['${syncDir.relativeTo(project.projectDir).path}']"
                project.tasks.named("podInstall").configure {
                    it.doFirst {
                        syncDir.mkdirs()
                    }
                }
            }
        }
    }
}

private fun SyncIosResourcesContext.configureSyncResourcesTasks() {
    val lazyTasksDependencies = LazyTasksDependencyConfigurator(project.tasks)
    configureEachIosFramework { framework ->
        val frameworkClassifier = framework.namePrefix.uppercaseFirstChar()
        val syncResourcesTaskName = "sync${frameworkClassifier}ComposeResourcesForIos"
        val syncTask = framework.project.tasks.registerOrConfigure<SyncComposeResourcesForIosTask>(syncResourcesTaskName) {
            outputDir.set(syncDirFor(framework))