[Gradle][MPP] Rename isSharedNative function to isNativeSourceSet
^KT-48135 Verification Pending
This commit is contained in:
committed by
Space
parent
4ddd23b09f
commit
c641ba5397
+3
-3
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.gradle.plugin.sources.KotlinDependencyScope
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.sources.sourceSetDependencyConfigurationByScope
|
import org.jetbrains.kotlin.gradle.plugin.sources.sourceSetDependencyConfigurationByScope
|
||||||
import org.jetbrains.kotlin.gradle.targets.metadata.dependsOnClosureWithInterCompilationDependencies
|
import org.jetbrains.kotlin.gradle.targets.metadata.dependsOnClosureWithInterCompilationDependencies
|
||||||
import org.jetbrains.kotlin.gradle.targets.metadata.getPublishedPlatformCompilations
|
import org.jetbrains.kotlin.gradle.targets.metadata.getPublishedPlatformCompilations
|
||||||
import org.jetbrains.kotlin.gradle.targets.metadata.isSharedNativeSourceSet
|
import org.jetbrains.kotlin.gradle.targets.metadata.isNativeSourceSet
|
||||||
import org.jetbrains.kotlin.gradle.targets.native.internal.CInteropCommonizerCompositeMetadataJarBundling.cinteropMetadataDirectoryPath
|
import org.jetbrains.kotlin.gradle.targets.native.internal.CInteropCommonizerCompositeMetadataJarBundling.cinteropMetadataDirectoryPath
|
||||||
import org.jetbrains.kotlin.gradle.utils.getOrPut
|
import org.jetbrains.kotlin.gradle.utils.getOrPut
|
||||||
import org.w3c.dom.Document
|
import org.w3c.dom.Document
|
||||||
@@ -180,7 +180,7 @@ private fun buildKotlinProjectStructureMetadata(extension: KotlinMultiplatformEx
|
|||||||
* published as API dependencies of the metadata module to get into the resolution result, see
|
* published as API dependencies of the metadata module to get into the resolution result, see
|
||||||
* [KotlinMetadataTargetConfigurator.exportDependenciesForPublishing].
|
* [KotlinMetadataTargetConfigurator.exportDependenciesForPublishing].
|
||||||
*/
|
*/
|
||||||
val isNativeSharedSourceSet = isSharedNativeSourceSet(sourceSet)
|
val isNativeSharedSourceSet = isNativeSourceSet(sourceSet)
|
||||||
val scopes = listOfNotNull(
|
val scopes = listOfNotNull(
|
||||||
KotlinDependencyScope.API_SCOPE,
|
KotlinDependencyScope.API_SCOPE,
|
||||||
KotlinDependencyScope.IMPLEMENTATION_SCOPE.takeIf { isNativeSharedSourceSet }
|
KotlinDependencyScope.IMPLEMENTATION_SCOPE.takeIf { isNativeSharedSourceSet }
|
||||||
@@ -197,7 +197,7 @@ private fun buildKotlinProjectStructureMetadata(extension: KotlinMultiplatformEx
|
|||||||
sourceSet.name to sourceSetExportedDependencies.map { ModuleIds.fromDependency(it) }.toSet()
|
sourceSet.name to sourceSetExportedDependencies.map { ModuleIds.fromDependency(it) }.toSet()
|
||||||
},
|
},
|
||||||
sourceSetCInteropMetadataDirectory = sourceSetsWithMetadataCompilations.keys
|
sourceSetCInteropMetadataDirectory = sourceSetsWithMetadataCompilations.keys
|
||||||
.filter { isSharedNativeSourceSet(it) }
|
.filter { isNativeSourceSet(it) }
|
||||||
.associate { sourceSet -> sourceSet.name to cinteropMetadataDirectoryPath(sourceSet.name) },
|
.associate { sourceSet -> sourceSet.name to cinteropMetadataDirectoryPath(sourceSet.name) },
|
||||||
hostSpecificSourceSets = getHostSpecificSourceSets(project)
|
hostSpecificSourceSets = getHostSpecificSourceSets(project)
|
||||||
.filter { it in sourceSetsWithMetadataCompilations }.map { it.name }
|
.filter { it in sourceSetsWithMetadataCompilations }.map { it.name }
|
||||||
|
|||||||
+2
-2
@@ -300,7 +300,7 @@ class KotlinMetadataTargetConfigurator :
|
|||||||
val platformCompilations = sourceSet.internal.compilations
|
val platformCompilations = sourceSet.internal.compilations
|
||||||
.filter { it.target.name != KotlinMultiplatformPlugin.METADATA_TARGET_NAME }
|
.filter { it.target.name != KotlinMultiplatformPlugin.METADATA_TARGET_NAME }
|
||||||
|
|
||||||
val isNativeSourceSet = isSharedNativeSourceSet(sourceSet)
|
val isNativeSourceSet = isNativeSourceSet(sourceSet)
|
||||||
|
|
||||||
val compilationFactory: KotlinCompilationFactory<out AbstractKotlinCompilation<*>> = when {
|
val compilationFactory: KotlinCompilationFactory<out AbstractKotlinCompilation<*>> = when {
|
||||||
isNativeSourceSet -> KotlinSharedNativeCompilationFactory(
|
isNativeSourceSet -> KotlinSharedNativeCompilationFactory(
|
||||||
@@ -568,7 +568,7 @@ internal fun createMetadataDependencyTransformationClasspath(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun isSharedNativeSourceSet(sourceSet: KotlinSourceSet): Boolean {
|
internal fun isNativeSourceSet(sourceSet: KotlinSourceSet): Boolean {
|
||||||
val compilations = sourceSet.internal.compilations.filterNot { it.platformType == KotlinPlatformType.common }
|
val compilations = sourceSet.internal.compilations.filterNot { it.platformType == KotlinPlatformType.common }
|
||||||
return compilations.isNotEmpty() && compilations.all { it.platformType == KotlinPlatformType.native }
|
return compilations.isNotEmpty() && compilations.all { it.platformType == KotlinPlatformType.native }
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -177,7 +177,7 @@ internal fun getHostSpecificFragments(
|
|||||||
internal fun getHostSpecificSourceSets(project: Project): Set<KotlinSourceSet> {
|
internal fun getHostSpecificSourceSets(project: Project): Set<KotlinSourceSet> {
|
||||||
return getHostSpecificElements(
|
return getHostSpecificElements(
|
||||||
project.kotlinExtension.sourceSets,
|
project.kotlinExtension.sourceSets,
|
||||||
isNativeShared = { sourceSet -> isSharedNativeSourceSet(sourceSet) },
|
isNativeShared = { sourceSet -> isNativeSourceSet(sourceSet) },
|
||||||
getKonanTargets = { sourceSet ->
|
getKonanTargets = { sourceSet ->
|
||||||
sourceSet.internal.compilations
|
sourceSet.internal.compilations
|
||||||
.filterIsInstance<KotlinNativeCompilation>()
|
.filterIsInstance<KotlinNativeCompilation>()
|
||||||
|
|||||||
Reference in New Issue
Block a user