Skip to content

Commit

Permalink
#97 fix bundle search with cocoapods gradle plugin usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex009 committed Aug 28, 2020
1 parent db0c399 commit 70f05a3
Showing 1 changed file with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,27 +132,27 @@ class IosMRGenerator(
private fun setupFrameworkResources() {
val kotlinNativeTarget = compilation.target as KotlinNativeTarget

val frameworkBinaries: List<Framework> = kotlinNativeTarget.binaries
.filterIsInstance<Framework>()
.filter { it.compilation == compilation }

frameworkBinaries.forEach { framework ->
val linkTask = framework.linkTask

linkTask.doLast {
linkTask.libraries
.plus(linkTask.intermediateLibrary.get())
.filter { it.extension == "klib" }
.forEach {
project.logger.info("copy resources from $it")
val klibKonan = org.jetbrains.kotlin.konan.file.File(it.path)
val klib = KotlinLibraryLayoutImpl(klibKonan)
val layout = klib.extractingToTemp

File(layout.resourcesDir.path).copyRecursively(framework.outputFile, overwrite = true)
}
kotlinNativeTarget.binaries
.matching { it is Framework && it.compilation == compilation }
.configureEach {
val framework = this as Framework

val linkTask = framework.linkTask

linkTask.doLast {
linkTask.libraries
.plus(linkTask.intermediateLibrary.get())
.filter { it.extension == "klib" }
.forEach {
project.logger.info("copy resources from $it")
val klibKonan = org.jetbrains.kotlin.konan.file.File(it.path)
val klib = KotlinLibraryLayoutImpl(klibKonan)
val layout = klib.extractingToTemp

File(layout.resourcesDir.path).copyRecursively(framework.outputFile, overwrite = true)
}
}
}
}
}

companion object {
Expand Down

0 comments on commit 70f05a3

Please sign in to comment.