commonMain.co.touchlab.skie.phases.other.FixLibrariesShortNamePhase.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-compiler-linker-plugin-kgp_1.9.20 Show documentation
Show all versions of kotlin-compiler-linker-plugin-kgp_1.9.20 Show documentation
Kotlin compiler plugin that improves Swift interface of a Kotlin Multiplatform framework.
The newest version!
package co.touchlab.skie.phases.other
import co.touchlab.skie.phases.ClassExportPhase
import co.touchlab.skie.phases.descriptorProvider
import org.jetbrains.kotlin.library.KLIB_PROPERTY_SHORT_NAME
import org.jetbrains.kotlin.library.shortName
import org.jetbrains.kotlin.library.uniqueName
// Fix for some libraries having ":" in their short name which resulted in invalid Obj-C header
object FixLibrariesShortNamePhase : ClassExportPhase {
context(ClassExportPhase.Context)
override suspend fun execute() {
descriptorProvider.resolvedLibraries.forEach { library ->
if (library.shortName == null) {
library.manifestProperties.setProperty(
KLIB_PROPERTY_SHORT_NAME,
library.uniqueName.substringAfterLast(':'),
)
}
}
}
}