Revert "CocoaPods: Skip synthetic task on non-mac hosts"
This reverts commit ce029822
This commit is contained in:
+1
-24
@@ -11,7 +11,6 @@ import org.jetbrains.kotlin.gradle.plugin.cocoapods.KotlinCocoapodsPlugin.Compan
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.cocoapods.KotlinCocoapodsPlugin.Companion.POD_SETUP_BUILD_TASK_NAME
|
import org.jetbrains.kotlin.gradle.plugin.cocoapods.KotlinCocoapodsPlugin.Companion.POD_SETUP_BUILD_TASK_NAME
|
||||||
import org.jetbrains.kotlin.gradle.util.modify
|
import org.jetbrains.kotlin.gradle.util.modify
|
||||||
import org.jetbrains.kotlin.konan.target.HostManager
|
import org.jetbrains.kotlin.konan.target.HostManager
|
||||||
import org.junit.Assume.assumeFalse
|
|
||||||
import org.junit.Assume.assumeTrue
|
import org.junit.Assume.assumeTrue
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@@ -169,28 +168,6 @@ class CocoaPodsIT : BaseGradleIT() {
|
|||||||
mapOf("kotlin-library" to "foobaz")
|
mapOf("kotlin-library" to "foobaz")
|
||||||
)
|
)
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testSkippingTasksOnOtherHosts() {
|
|
||||||
assumeFalse(HostManager.hostIsMac)
|
|
||||||
|
|
||||||
with(transformProjectWithPluginsDsl(cocoapodsSingleKtPod, gradleVersion)) {
|
|
||||||
val syntheticTasks = arrayOf(
|
|
||||||
":podInstall",
|
|
||||||
":kotlin-library:generateDummyFramework",
|
|
||||||
":kotlin-library:podGenIOS",
|
|
||||||
":kotlin-library:podSetupBuildIOS",
|
|
||||||
":kotlin-library:podBuildDependenciesIOS",
|
|
||||||
":kotlin-library:podImport"
|
|
||||||
)
|
|
||||||
|
|
||||||
build(*syntheticTasks, "-Pkotlin.native.cocoapods.generate.wrapper=true") {
|
|
||||||
// Check that tasks working with synthetic projects are skipped on non-mac hosts.
|
|
||||||
assertSuccessful()
|
|
||||||
assertTasksSkipped(*syntheticTasks)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun BaseGradleIT.Project.useCustomFrameworkName(subproject: String, frameworkName: String, iosAppLocation: String? = null) {
|
private fun BaseGradleIT.Project.useCustomFrameworkName(subproject: String, frameworkName: String, iosAppLocation: String? = null) {
|
||||||
// Change the name at the Gradle side.
|
// Change the name at the Gradle side.
|
||||||
gradleBuildScript(subproject).appendText(
|
gradleBuildScript(subproject).appendText(
|
||||||
@@ -257,7 +234,7 @@ class CocoaPodsIT : BaseGradleIT() {
|
|||||||
subprojectsToFrameworkNamesMap: Map<String, String?>,
|
subprojectsToFrameworkNamesMap: Map<String, String?>,
|
||||||
) {
|
) {
|
||||||
assumeTrue(HostManager.hostIsMac)
|
assumeTrue(HostManager.hostIsMac)
|
||||||
assumeTrue(KotlinCocoapodsPlugin.isAvailableToProduceSynthetic)
|
assumeTrue(KotlinCocoapodsPlugin.isAvailableToProduceSynthetic())
|
||||||
|
|
||||||
val subprojects = subprojectsToFrameworkNamesMap.keys
|
val subprojects = subprojectsToFrameworkNamesMap.keys
|
||||||
val gradleProject = transformProjectWithPluginsDsl(projectName, gradleVersion)
|
val gradleProject = transformProjectWithPluginsDsl(projectName, gradleVersion)
|
||||||
|
|||||||
+13
-24
@@ -213,8 +213,8 @@ open class KotlinCocoapodsPlugin : Plugin<Project> {
|
|||||||
interop.packageName = "cocoapods.${pod.moduleName}"
|
interop.packageName = "cocoapods.${pod.moduleName}"
|
||||||
|
|
||||||
|
|
||||||
if (
|
if (//TODO ychernyshev improve first check
|
||||||
isAvailableToProduceSynthetic
|
isAvailableToProduceSynthetic()
|
||||||
&& project.findProperty(TARGET_PROPERTY) == null
|
&& project.findProperty(TARGET_PROPERTY) == null
|
||||||
&& project.findProperty(CONFIGURATION_PROPERTY) == null
|
&& project.findProperty(CONFIGURATION_PROPERTY) == null
|
||||||
) {
|
) {
|
||||||
@@ -239,8 +239,8 @@ open class KotlinCocoapodsPlugin : Plugin<Project> {
|
|||||||
// Since we cannot expand the configuration phase of interop tasks
|
// Since we cannot expand the configuration phase of interop tasks
|
||||||
// receiving the required environment variables happens on execution phase.
|
// receiving the required environment variables happens on execution phase.
|
||||||
// TODO This needs to be fixed to improve UP-TO-DATE checks.
|
// TODO This needs to be fixed to improve UP-TO-DATE checks.
|
||||||
if (
|
if (// TODO ychernyshev improve first check
|
||||||
isAvailableToProduceSynthetic
|
isAvailableToProduceSynthetic()
|
||||||
&& project.findProperty(TARGET_PROPERTY) == null
|
&& project.findProperty(TARGET_PROPERTY) == null
|
||||||
&& project.findProperty(CONFIGURATION_PROPERTY) == null
|
&& project.findProperty(CONFIGURATION_PROPERTY) == null
|
||||||
) {
|
) {
|
||||||
@@ -305,8 +305,6 @@ open class KotlinCocoapodsPlugin : Plugin<Project> {
|
|||||||
it.group = TASK_GROUP
|
it.group = TASK_GROUP
|
||||||
it.description = "Invokes `pod install` call within Podfile location directory"
|
it.description = "Invokes `pod install` call within Podfile location directory"
|
||||||
it.cocoapodsExtension = cocoapodsExtension
|
it.cocoapodsExtension = cocoapodsExtension
|
||||||
it.onlyIf { isAvailableToProduceSynthetic }
|
|
||||||
|
|
||||||
//TODO avoid subproject task management here
|
//TODO avoid subproject task management here
|
||||||
project.allprojects.map { it.tasks.named(POD_SPEC_TASK_NAME, PodspecTask::class.java) }
|
project.allprojects.map { it.tasks.named(POD_SPEC_TASK_NAME, PodspecTask::class.java) }
|
||||||
.forEach { podspecTaskProvider ->
|
.forEach { podspecTaskProvider ->
|
||||||
@@ -330,7 +328,6 @@ open class KotlinCocoapodsPlugin : Plugin<Project> {
|
|||||||
it.kotlinNativeTarget = target
|
it.kotlinNativeTarget = target
|
||||||
it.cocoapodsExtension = cocoapodsExtension
|
it.cocoapodsExtension = cocoapodsExtension
|
||||||
it.dependsOn(podspecTaskProvider)
|
it.dependsOn(podspecTaskProvider)
|
||||||
it.onlyIf { isAvailableToProduceSynthetic }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -355,7 +352,6 @@ open class KotlinCocoapodsPlugin : Plugin<Project> {
|
|||||||
val podGenTaskProvider = project.tasks.named(target.toPodGenTaskName, PodGenTask::class.java)
|
val podGenTaskProvider = project.tasks.named(target.toPodGenTaskName, PodGenTask::class.java)
|
||||||
it.podsXcodeProjDirProvider = podGenTaskProvider.get().podsXcodeProjDirProvider
|
it.podsXcodeProjDirProvider = podGenTaskProvider.get().podsXcodeProjDirProvider
|
||||||
it.dependsOn(podGenTaskProvider)
|
it.dependsOn(podGenTaskProvider)
|
||||||
it.onlyIf { isAvailableToProduceSynthetic }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -378,7 +374,6 @@ open class KotlinCocoapodsPlugin : Plugin<Project> {
|
|||||||
it.podsXcodeProjDirProvider = podSetupBuildTaskProvider.get().podsXcodeProjDirProvider
|
it.podsXcodeProjDirProvider = podSetupBuildTaskProvider.get().podsXcodeProjDirProvider
|
||||||
it.buildSettingsFileProvider = podSetupBuildTaskProvider.get().buildSettingsFileProvider
|
it.buildSettingsFileProvider = podSetupBuildTaskProvider.get().buildSettingsFileProvider
|
||||||
it.dependsOn(podSetupBuildTaskProvider)
|
it.dependsOn(podSetupBuildTaskProvider)
|
||||||
it.onlyIf { isAvailableToProduceSynthetic }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -393,7 +388,6 @@ open class KotlinCocoapodsPlugin : Plugin<Project> {
|
|||||||
it.group = TASK_GROUP
|
it.group = TASK_GROUP
|
||||||
it.description = "Called on Gradle sync, depends on Cinterop tasks for every used pod"
|
it.description = "Called on Gradle sync, depends on Cinterop tasks for every used pod"
|
||||||
it.dependsOn(podInstallTaskProvider)
|
it.dependsOn(podInstallTaskProvider)
|
||||||
it.onlyIf { isAvailableToProduceSynthetic }
|
|
||||||
|
|
||||||
kotlinExtension.supportedTargets().all { target ->
|
kotlinExtension.supportedTargets().all { target ->
|
||||||
target.compilations.getByName(KotlinCompilation.MAIN_COMPILATION_NAME).cinterops.all { interop ->
|
target.compilations.getByName(KotlinCompilation.MAIN_COMPILATION_NAME).cinterops.all { interop ->
|
||||||
@@ -414,14 +408,13 @@ open class KotlinCocoapodsPlugin : Plugin<Project> {
|
|||||||
registerDummyFrameworkTask(project, cocoapodsExtension)
|
registerDummyFrameworkTask(project, cocoapodsExtension)
|
||||||
createSyncTask(project, kotlinExtension)
|
createSyncTask(project, kotlinExtension)
|
||||||
registerPodspecTask(project, cocoapodsExtension)
|
registerPodspecTask(project, cocoapodsExtension)
|
||||||
|
if (isAvailableToProduceSynthetic()) {
|
||||||
registerPodGenTask(project, kotlinExtension, cocoapodsExtension)
|
registerPodGenTask(project, kotlinExtension, cocoapodsExtension)
|
||||||
registerPodInstallTask(project, cocoapodsExtension)
|
registerPodInstallTask(project, cocoapodsExtension)
|
||||||
registerPodSetupBuildTasks(project, kotlinExtension, cocoapodsExtension)
|
registerPodSetupBuildTasks(project, kotlinExtension, cocoapodsExtension)
|
||||||
registerPodBuildTasks(project, kotlinExtension, cocoapodsExtension)
|
registerPodBuildTasks(project, kotlinExtension, cocoapodsExtension)
|
||||||
registerPodImportTask(project, kotlinExtension)
|
registerPodImportTask(project, kotlinExtension)
|
||||||
|
} else {
|
||||||
if (HostManager.hostIsMac && !isAvailableToProduceSynthetic) {
|
|
||||||
logger.quiet(
|
logger.quiet(
|
||||||
"""
|
"""
|
||||||
To take advantage of the new functionality for Cocoapods Integration like synchronizing with the Xcode project
|
To take advantage of the new functionality for Cocoapods Integration like synchronizing with the Xcode project
|
||||||
@@ -464,17 +457,13 @@ open class KotlinCocoapodsPlugin : Plugin<Project> {
|
|||||||
const val KOTLIN_TARGET_FOR_IOS_DEVICE = "ios_arm"
|
const val KOTLIN_TARGET_FOR_IOS_DEVICE = "ios_arm"
|
||||||
const val KOTLIN_TARGET_FOR_WATCHOS_DEVICE = "watchos_arm"
|
const val KOTLIN_TARGET_FOR_WATCHOS_DEVICE = "watchos_arm"
|
||||||
|
|
||||||
val isAvailableToProduceSynthetic: Boolean by lazy {
|
fun isAvailableToProduceSynthetic(): Boolean {
|
||||||
if (!HostManager.hostIsMac) {
|
|
||||||
return@lazy false
|
|
||||||
}
|
|
||||||
|
|
||||||
val gemListProcess = ProcessBuilder("gem", "list").start()
|
val gemListProcess = ProcessBuilder("gem", "list").start()
|
||||||
val gemListRetCode = gemListProcess.waitFor()
|
val gemListRetCode = gemListProcess.waitFor()
|
||||||
val gemListOutput = gemListProcess.inputStream.use {
|
val gemListOutput = gemListProcess.inputStream.use {
|
||||||
it.reader().readText()
|
it.reader().readText()
|
||||||
}
|
}
|
||||||
gemListRetCode == 0 && gemListOutput.contains("cocoapods-generate")
|
return gemListRetCode == 0 && gemListOutput.contains("cocoapods-generate")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user