[Gradle] Forbid manual pod install invocation when Kotlin framework is not yet built
^KT-59263 Verification Pending
This commit is contained in:
committed by
Space Team
parent
8ae0f61028
commit
2e5ae122ea
+20
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,9 @@ import org.gradle.work.DisableCachingByDefault
|
||||
import org.jetbrains.kotlin.gradle.plugin.cocoapods.CocoapodsExtension.CocoapodsDependency
|
||||
import org.jetbrains.kotlin.gradle.plugin.cocoapods.CocoapodsExtension.PodspecPlatformSettings
|
||||
import org.jetbrains.kotlin.gradle.plugin.cocoapods.KotlinCocoapodsPlugin
|
||||
import org.jetbrains.kotlin.gradle.plugin.cocoapods.KotlinCocoapodsPlugin.Companion.DUMMY_FRAMEWORK_TASK_NAME
|
||||
import org.jetbrains.kotlin.gradle.plugin.cocoapods.KotlinCocoapodsPlugin.Companion.GENERATE_WRAPPER_PROPERTY
|
||||
import org.jetbrains.kotlin.gradle.plugin.cocoapods.KotlinCocoapodsPlugin.Companion.POD_INSTALL_TASK_NAME
|
||||
import org.jetbrains.kotlin.gradle.plugin.cocoapods.KotlinCocoapodsPlugin.Companion.SYNC_TASK_NAME
|
||||
import org.jetbrains.kotlin.gradle.plugin.cocoapods.cocoapodsBuildDirs
|
||||
import org.jetbrains.kotlin.gradle.utils.getFile
|
||||
@@ -132,7 +134,22 @@ abstract class PodspecTask @Inject constructor(private val projectLayout: Projec
|
||||
|
||||
val frameworkDir = projectLayout.cocoapodsBuildDirs.framework.getFile().relativeTo(outputFile.parentFile)
|
||||
val vendoredFramework = if (publishing.get()) "${frameworkName.get()}.xcframework" else frameworkDir.resolve("${frameworkName.get()}.framework").invariantSeparatorsPath
|
||||
val vendoredFrameworks = if (extraSpecAttributes.get().containsKey("vendored_frameworks")) "" else "| spec.vendored_frameworks = '$vendoredFramework'"
|
||||
val vendoredFrameworksOverridden = extraSpecAttributes.get().containsKey("vendored_frameworks")
|
||||
val vendoredFrameworks = if (vendoredFrameworksOverridden) "" else "| spec.vendored_frameworks = '$vendoredFramework'"
|
||||
|
||||
val vendoredFrameworkExistenceCheck = if (vendoredFrameworksOverridden || publishing.get()) "" else
|
||||
""" |
|
||||
| if !Dir.exist?('$vendoredFramework') || Dir.empty?('$vendoredFramework')
|
||||
| raise "
|
||||
|
|
||||
| Kotlin framework '${frameworkName.get()}' doesn't exist yet, so a proper Xcode project can't be generated.
|
||||
| 'pod install' should be executed after running ':$DUMMY_FRAMEWORK_TASK_NAME' Gradle task:
|
||||
|
|
||||
| ./gradlew ${projectPath.get()}:$DUMMY_FRAMEWORK_TASK_NAME
|
||||
|
|
||||
| Alternatively, proper pod installation is performed during Gradle sync in the IDE (if Podfile location is set)"
|
||||
| end
|
||||
""".trimMargin()
|
||||
|
||||
val libraries = if (extraSpecAttributes.get().containsKey("libraries")) "" else "| spec.libraries = 'c++'"
|
||||
|
||||
@@ -184,6 +201,7 @@ abstract class PodspecTask @Inject constructor(private val projectLayout: Projec
|
||||
$libraries
|
||||
$deploymentTargets
|
||||
$dependencies
|
||||
$vendoredFrameworkExistenceCheck
|
||||
$xcConfig
|
||||
$scriptPhase
|
||||
$customSpec
|
||||
|
||||
Reference in New Issue
Block a user