Skip to content
This repository was archived by the owner on Oct 19, 2021. It is now read-only.

Allow Framework Configuration #4

Merged
merged 3 commits into from
May 1, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Split off defaults and check for debug frameworks
  • Loading branch information
samhill303 committed Apr 30, 2020
commit 2795525e2c98ed90a27f097481dd8f9e12cfb30b
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,16 @@ open class CocoapodsExtension(private val project: Project) {
@Input
var homepage: String? = null

internal var frameworkConfiguration: Framework.() -> Unit = {
private fun Framework.setDefaults(){
baseName = project.name.asValidFrameworkName()
isStatic = true
}

internal var frameworkConfiguration: Framework.() -> Unit = {}

internal fun configureFramework(framework: Framework){
frameworkConfiguration(framework)
framework.setDefaults()
framework.frameworkConfiguration()
}

@Optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,21 +166,23 @@ open class KotlinCocoapodsPlugin : Plugin<Project> {
kotlinExtension: KotlinMultiplatformExtension,
cocoapodsExtension: CocoapodsExtension
) {
val firstReleaseFramework = kotlinExtension.supportedTargets()
val firstFramework = kotlinExtension.supportedTargets()
.single()
.binaries
.getFramework(NativeBuildType.RELEASE)
.run {
findFramework(NativeBuildType.RELEASE) ?: getFramework(NativeBuildType.DEBUG)
}

val dummyFrameworkTask = project.tasks.create("generateDummyFramework", DummyFrameworkTask::class.java) {
it.settings = cocoapodsExtension
it.framework = firstReleaseFramework
it.framework = firstFramework
}

project.tasks.create("podspec", PodspecTask::class.java) {
it.group = TASK_GROUP
it.description = "Generates a podspec file for CocoaPods import"
it.settings = cocoapodsExtension
it.framework = firstReleaseFramework
it.framework = firstFramework
it.dependsOn(dummyFrameworkTask)
val generateWrapper = project.findProperty(GENERATE_WRAPPER_PROPERTY)?.toString()?.toBoolean() ?: false
if (generateWrapper) {
Expand Down