Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix cocoapods integration #5128

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
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
Expand Up @@ -86,8 +86,8 @@ internal fun Project.configureSyncIosComposeResources(
plugins.withId(COCOAPODS_PLUGIN_ID) {
(kotlinExtension as ExtensionAware).extensions.getByType(CocoapodsExtension::class.java).apply {
framework { podFramework ->
val syncDir = podFramework.getFinalResourcesDir().get().asFile.relativeTo(projectDir)
val specAttr = "['${syncDir.path}']"
val syncDir = podFramework.getFinalResourcesDir().get().asFile
val specAttr = "['${syncDir.relativeTo(projectDir).path}']"
val specAttributes = extraSpecAttributes
val buildFile = project.buildFile
val projectPath = project.path
Expand All @@ -97,7 +97,7 @@ internal fun Project.configureSyncIosComposeResources(
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 '$buildFile' and run '$projectPath:podInstall' once;
| * Recommended action: remove extraSpecAttributes["resources"] from '$buildFile' and run '$projectPath:podspec' 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
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,14 @@ class ResourcesTest : GradlePluginTestBase() {
)

with(TestProject("misc/iosResources", testEnv)) {
gradle(":podspec", "-Pkotlin.native.cocoapods.generate.wrapper=true").checks {
assertEqualTextFiles(
file("iosResources.podspec"),
file("expected/iosResources.podspec")
)
file("build/compose/cocoapods/compose-resources").checkExists()
}

gradle(
":syncFramework",
"-Pkotlin.native.cocoapods.platform=${iosEnv["PLATFORM_NAME"]}",
Expand Down Expand Up @@ -656,13 +664,6 @@ class ResourcesTest : GradlePluginTestBase() {
file("build/compose/cocoapods/compose-resources/composeResources/iosresources.generated.resources/drawable/compose-multiplatform.xml").checkExists()
file("build/compose/cocoapods/compose-resources/composeResources/iosresources.generated.resources/drawable/icon.xml").checkExists()
}

gradle(":podspec", "-Pkotlin.native.cocoapods.generate.wrapper=true").checks {
assertEqualTextFiles(
file("iosResources.podspec"),
file("expected/iosResources.podspec")
)
}
}
}

Expand Down
Loading