[Gradle] CInteropCommonizerDependent: Remove unused Project parameters

KT-55238
This commit is contained in:
Sebastian Sellmair
2022-12-05 11:24:34 +01:00
committed by Space Team
parent 1ec7e404fd
commit 2225816427
5 changed files with 10 additions and 18 deletions
@@ -8,9 +8,6 @@ package org.jetbrains.kotlin.gradle.plugin.mpp
import org.gradle.api.Project
import org.gradle.api.file.FileCollection
import org.jetbrains.kotlin.gradle.dsl.*
import org.jetbrains.kotlin.gradle.dsl.pm20ExtensionOrNull
import org.jetbrains.kotlin.gradle.dsl.topLevelExtension
import org.jetbrains.kotlin.gradle.dsl.topLevelExtensionOrNull
import org.jetbrains.kotlin.gradle.plugin.mpp.MetadataDependencyResolution.ChooseVisibleSourceSets.MetadataProvider.ProjectMetadataProvider
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.metadataCompilationRegistryByModuleId
import org.jetbrains.kotlin.gradle.targets.native.internal.*
@@ -55,7 +52,7 @@ private class ProjectMetadataProviderImpl(
}
val sourceSet = multiplatformExtension.sourceSets.findByName(sourceSetName) ?: return dependencyProject.files()
val dependent = CInteropCommonizerDependent.from(dependencyProject, sourceSet) ?: return dependencyProject.files()
val dependent = CInteropCommonizerDependent.from(sourceSet) ?: return dependencyProject.files()
return commonizeCInteropTask.get().commonizedOutputLibraries(dependent)
}
}
@@ -45,8 +45,8 @@ private fun Project.setupCInteropCommonizerDependenciesForIde(sourceSet: Default
val cinteropCommonizerTask = project.copyCommonizeCInteropForIdeTask ?: return
addIntransitiveMetadataDependencyIfPossible(sourceSet, filesProvider files@{
val directlyDependent = CInteropCommonizerDependent.from(project, sourceSet)
val associateDependent = CInteropCommonizerDependent.fromAssociateCompilations(project, sourceSet)
val directlyDependent = CInteropCommonizerDependent.from(sourceSet)
val associateDependent = CInteropCommonizerDependent.fromAssociateCompilations(sourceSet)
listOfNotNull(directlyDependent, associateDependent).map { cinteropCommonizerDependent ->
cinteropCommonizerTask.get().commonizedOutputLibraries(cinteropCommonizerDependent)
@@ -5,7 +5,6 @@
package org.jetbrains.kotlin.gradle.targets.native.internal
import org.gradle.api.Project
import org.jetbrains.kotlin.commonizer.SharedCommonizerTarget
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeCompilation
@@ -80,7 +79,7 @@ internal fun CInteropCommonizerDependent.Factory.from(compilation: KotlinSharedN
)
}
internal fun CInteropCommonizerDependent.Factory.from(project: Project, sourceSet: KotlinSourceSet): CInteropCommonizerDependent? {
internal fun CInteropCommonizerDependent.Factory.from(sourceSet: KotlinSourceSet): CInteropCommonizerDependent? {
return from(
target = getCommonizerTarget(sourceSet) as? SharedCommonizerTarget ?: return null,
compilations = sourceSet.internal.compilations
@@ -88,9 +87,7 @@ internal fun CInteropCommonizerDependent.Factory.from(project: Project, sourceSe
)
}
internal fun CInteropCommonizerDependent.Factory.fromAssociateCompilations(
project: Project, sourceSet: KotlinSourceSet
): CInteropCommonizerDependent? {
internal fun CInteropCommonizerDependent.Factory.fromAssociateCompilations(sourceSet: KotlinSourceSet): CInteropCommonizerDependent? {
return from(
target = getCommonizerTarget(sourceSet) as? SharedCommonizerTarget ?: return null,
compilations = sourceSet.internal.compilations
@@ -19,10 +19,8 @@ import org.jetbrains.kotlin.compilerRunner.GradleCliCommonizer
import org.jetbrains.kotlin.compilerRunner.KotlinNativeCommonizerToolRunner
import org.jetbrains.kotlin.compilerRunner.KotlinToolRunner
import org.jetbrains.kotlin.compilerRunner.konanHome
import org.jetbrains.kotlin.gradle.dsl.kotlinExtension
import org.jetbrains.kotlin.gradle.dsl.multiplatformExtension
import org.jetbrains.kotlin.gradle.dsl.multiplatformExtensionOrNull
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinSharedNativeCompilation
import org.jetbrains.kotlin.gradle.plugin.sources.DefaultKotlinSourceSet
@@ -130,7 +128,7 @@ internal open class CInteropCommonizerTask
val sourceSetsByTarget = multiplatformExtension.sourceSets.groupBy { sourceSet -> getCommonizerTarget(sourceSet) }
val sourceSetsByGroup = multiplatformExtension.sourceSets.groupBy { sourceSet ->
CInteropCommonizerDependent.from(project, sourceSet)?.let { findInteropsGroup(it) }
CInteropCommonizerDependent.from(sourceSet)?.let { findInteropsGroup(it) }
}
getAllInteropsGroups().associateWith { group ->
(group.targets + group.targets.allLeaves()).map { target ->
@@ -267,11 +265,11 @@ internal open class CInteropCommonizerTask
.toSet()
val fromSourceSets = multiplatformExtension.sourceSets
.mapNotNull { sourceSet -> CInteropCommonizerDependent.from(project, sourceSet) }
.mapNotNull { sourceSet -> CInteropCommonizerDependent.from(sourceSet) }
.toSet()
val fromSourceSetsAssociateCompilations = multiplatformExtension.sourceSets
.mapNotNull { sourceSet -> CInteropCommonizerDependent.fromAssociateCompilations(project, sourceSet) }
.mapNotNull { sourceSet -> CInteropCommonizerDependent.fromAssociateCompilations(sourceSet) }
.toSet()
return@lazy (fromSharedNativeCompilations + fromSourceSets + fromSourceSetsAssociateCompilations)
@@ -54,7 +54,7 @@ abstract class MultiplatformExtensionTest {
internal fun expectCInteropCommonizerDependent(sourceSet: KotlinSourceSet): CInteropCommonizerDependent {
return assertNotNull(
CInteropCommonizerDependent.from(project, sourceSet), "Can't find SharedInterops for ${sourceSet.name} source set"
CInteropCommonizerDependent.from(sourceSet), "Can't find SharedInterops for ${sourceSet.name} source set"
)
}
@@ -63,7 +63,7 @@ abstract class MultiplatformExtensionTest {
}
internal fun findCInteropCommonizerDependent(sourceSet: KotlinSourceSet): CInteropCommonizerDependent? {
return CInteropCommonizerDependent.from(project, sourceSet)
return CInteropCommonizerDependent.from(sourceSet)
}
internal fun expectSharedNativeCompilation(sourceSet: KotlinSourceSet): KotlinSharedNativeCompilation {