[MPP] Don't enable commonization in subprojects of a project where
CocoaPods plugin was applied ^KT-58712
This commit is contained in:
committed by
Space Team
parent
3c8c20f8d2
commit
5d8e23e971
+4
-1
@@ -387,7 +387,10 @@ internal class PropertiesProvider private constructor(private val project: Proje
|
||||
private val enableCInteropCommonizationSetByExternalPluginKey = "kotlin.internal.mpp.enableCInteropCommonization.setByExternalPlugin"
|
||||
|
||||
internal var enableCInteropCommonizationSetByExternalPlugin: Boolean?
|
||||
get() = booleanProperty(enableCInteropCommonizationSetByExternalPluginKey)
|
||||
get() {
|
||||
if (!project.extensions.extraProperties.has(enableCInteropCommonizationSetByExternalPluginKey)) return null
|
||||
return booleanProperty(enableCInteropCommonizationSetByExternalPluginKey)
|
||||
}
|
||||
set(value) {
|
||||
project.extensions.extraProperties.set(enableCInteropCommonizationSetByExternalPluginKey, "$value")
|
||||
}
|
||||
|
||||
+34
-3
@@ -10,10 +10,9 @@ package org.jetbrains.kotlin.gradle.unitTests
|
||||
import org.gradle.api.internal.project.ProjectInternal
|
||||
import org.gradle.testfixtures.ProjectBuilder
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeCompilation
|
||||
import org.jetbrains.kotlin.gradle.targets.native.internal.cInteropCommonizationEnabled
|
||||
import org.jetbrains.kotlin.gradle.util.*
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertNotNull
|
||||
import kotlin.test.assertNull
|
||||
import kotlin.test.*
|
||||
|
||||
class CommonizerTaskTests {
|
||||
|
||||
@@ -136,4 +135,36 @@ class CommonizerTaskTests {
|
||||
subproject.tasks.getByName("commonize").assertDependsOn(commonizeCInteropTask)
|
||||
rootProject.assertContainsNoTaskWithName(commonizeCInteropTaskName)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test applying CocoaPods plugin - enables commonization`() {
|
||||
val rootProject = ProjectBuilder.builder().build() as ProjectInternal
|
||||
rootProject.applyMultiplatformPlugin()
|
||||
|
||||
rootProject.runLifecycleAwareTest {
|
||||
assertFalse(rootProject.cInteropCommonizationEnabled())
|
||||
|
||||
rootProject.applyCocoapodsPlugin()
|
||||
|
||||
assertTrue(rootProject.cInteropCommonizationEnabled())
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test applying CocoaPods plugin - in a root project - enables commonization only in the root project`() {
|
||||
val rootProject = ProjectBuilder.builder().build() as ProjectInternal
|
||||
val subproject = ProjectBuilder.builder().withParent(rootProject).build() as ProjectInternal
|
||||
rootProject.applyMultiplatformPlugin()
|
||||
subproject.applyMultiplatformPlugin()
|
||||
|
||||
rootProject.runLifecycleAwareTest {
|
||||
assertFalse(rootProject.cInteropCommonizationEnabled())
|
||||
assertFalse(subproject.cInteropCommonizationEnabled())
|
||||
|
||||
rootProject.applyCocoapodsPlugin()
|
||||
|
||||
assertTrue(rootProject.cInteropCommonizationEnabled())
|
||||
assertFalse(subproject.cInteropCommonizationEnabled())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user