CocoaPods: Generate wrapper if the corresponding property enabled
This commit is contained in:
+6
@@ -163,6 +163,10 @@ open class KotlinCocoapodsPlugin: Plugin<Project> {
|
||||
it.description = "Generates a podspec file for CocoaPods import"
|
||||
it.settings = cocoapodsExtension
|
||||
it.dependsOn(dummyFrameworkTask)
|
||||
val generateWrapper = project.findProperty(GENERATE_WRAPPER_PROPERTY)?.toString()?.toBoolean() ?: false
|
||||
if (generateWrapper) {
|
||||
it.dependsOn(":wrapper")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,6 +235,8 @@ open class KotlinCocoapodsPlugin: Plugin<Project> {
|
||||
const val HEADER_PATHS_PROPERTY = "kotlin.native.cocoapods.paths.headers"
|
||||
const val FRAMEWORK_PATHS_PROPERTY = "kotlin.native.cocoapods.paths.frameworks"
|
||||
|
||||
const val GENERATE_WRAPPER_PROPERTY = "kotlin.native.cocoapods.generate.wrapper"
|
||||
|
||||
// Used in Xcode script phase to indicate that the framework is being built for a device
|
||||
// so we should generate a fat framework with arm32 and arm64 binaries.
|
||||
const val KOTLIN_TARGET_FOR_DEVICE = "ios_arm"
|
||||
|
||||
+3
-2
@@ -10,6 +10,7 @@ import org.gradle.api.tasks.*
|
||||
import org.gradle.api.tasks.wrapper.Wrapper
|
||||
import org.jetbrains.kotlin.gradle.plugin.cocoapods.CocoapodsExtension
|
||||
import org.jetbrains.kotlin.gradle.plugin.cocoapods.KotlinCocoapodsPlugin
|
||||
import org.jetbrains.kotlin.gradle.plugin.cocoapods.KotlinCocoapodsPlugin.Companion.GENERATE_WRAPPER_PROPERTY
|
||||
import org.jetbrains.kotlin.gradle.plugin.cocoapods.KotlinCocoapodsPlugin.Companion.KOTLIN_TARGET_FOR_DEVICE
|
||||
import org.jetbrains.kotlin.gradle.plugin.cocoapods.asValidFrameworkName
|
||||
import org.jetbrains.kotlin.gradle.plugin.cocoapods.cocoapodsBuildDirs
|
||||
@@ -41,9 +42,9 @@ open class PodspecTask : DefaultTask() {
|
||||
val gradleWrapper = (project.rootProject.tasks.getByName("wrapper") as? Wrapper)?.scriptFile
|
||||
require(gradleWrapper != null && gradleWrapper.exists()) {
|
||||
"""
|
||||
The Gradle wrapper is required to run the build from Xcode. To generate the wrapper, run:
|
||||
The Gradle wrapper is required to run the build from Xcode.
|
||||
|
||||
gradle :wrapper
|
||||
Please run the same command with `-P$GENERATE_WRAPPER_PROPERTY=true` or run the `:wrapper` task to generate the wrapper manually.
|
||||
|
||||
See details about the wrapper at https://docs.gradle.org/current/userguide/gradle_wrapper.html
|
||||
""".trimIndent()
|
||||
|
||||
Reference in New Issue
Block a user