Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gradle] Create an empty resource dir with "podspec" task instead "podInstall" #4900

Merged
merged 2 commits into from
May 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package org.jetbrains.compose.resources

import org.gradle.api.DefaultTask
import org.gradle.api.Project
import org.gradle.api.file.Directory
import org.gradle.api.plugins.ExtensionAware
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.Copy
import org.gradle.api.tasks.TaskAction
import org.jetbrains.compose.desktop.application.internal.ComposeProperties
import org.jetbrains.compose.internal.utils.*
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
Expand Down Expand Up @@ -83,13 +86,16 @@ internal fun Project.configureSyncIosComposeResources(
framework { podFramework ->
val syncDir = podFramework.getFinalResourcesDir().get().asFile.relativeTo(projectDir)
val specAttr = "['${syncDir.path}']"
extraSpecAttributes["resources"] = specAttr
project.tasks.named("podInstall").configure {
val specAttributes = extraSpecAttributes
val buildFile = project.buildFile
val projectPath = project.path
specAttributes["resources"] = specAttr
project.tasks.named("podspec").configure {
it.doFirst {
if (extraSpecAttributes["resources"] != specAttr) error(
if (specAttributes["resources"] != specAttr) 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;
| * Recommended action: remove extraSpecAttributes["resources"] from '$buildFile' and run '$projectPath:podInstall' once;
| * Alternative action: turn off Compose Multiplatform's resources management for iOS by adding '${ComposeProperties.SYNC_RESOURCES_PROPERTY}=false' to your gradle.properties;
""".trimMargin()
)
Expand Down
Loading