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

Fix dynamic framework support and fix binary compatibility of SkikoUI… #763

Merged
merged 2 commits into from Jul 18, 2023

Conversation

AlexeyTsvetkov
Copy link
Collaborator

…View

This change configures Kotlin Gradle
plugin to include a CInterop def file
(https://kotlinlang.org/docs/native-c-interop.html) to fix linking a dynamic framework for iOS

Also helps with https://youtrack.jetbrains.com/issue/KT-60399 (at least in some cases). Internal discussion https://jetbrains.slack.com/archives/G017NLN12D8/p1689594898607469

…View

This change configures Kotlin Gradle
plugin to include a CInterop def file
(https://kotlinlang.org/docs/native-c-interop.html)
to fix linking a dynamic framework for iOS

Also helps with https://youtrack.jetbrains.com/issue/KT-60399
(at least in some cases). Internal discussion https://jetbrains.slack.com/archives/G017NLN12D8/p1689594898607469
skiko/buildSrc/src/main/kotlin/utils.kt Show resolved Hide resolved
@@ -427,6 +428,32 @@ kotlin {
}
}

fun configureCinterop(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the property enableCInteropCommonization for something else? (docs doesn't say its purpose clearly)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enableCInteropCommonization is used to tell Kotlin Gradle plugin to commonize multiple CInterop libraries.

So for example, for the following configuration:

kotlin {
    linuxX64 {
        compilations.getByName("main") {
             cinterops.create("foo").apply { ... }
        }
    }
    linuxArm64  {
        compilations.getByName("main") {
             cinterops.create("foo").apply { ... }
        }
    }

    sourceSets {
           val commonMain by getting
           val linuxCommonMain by creating { dependsOn(commonMain) }
           val linuxX64Main by getting { dependsOn(linuxCommonMain) }
           val linuxArm64Main by getting { dependsOn(linuxCommonMain) }
     }
}

cinterop creates two platform specific libraries: cinterop-foo-x64.klib and cinterop-foo-arm64.klib
By default, cinterop-foo declarations would be available only in platform specific source sets.
So consumers would not be able to use foo declarations in linuxCommon source sets.
kotlin.mpp.enableCInteropCommonization=true generates commonized klib with common declarations for linuxCommonMain (and its consumers).

I don't think we need this flag now, since we don't need to commonize any cinterop declarations.

skiko/build.gradle.kts Show resolved Hide resolved
@igordmn igordmn requested a review from pjBooms July 17, 2023 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants