[Gradle] Fix warnings in AddIntransitiveMetadataDependency.kt

^KT-56904 In Progress
This commit is contained in:
Yahor Berdnikau
2024-02-05 13:12:10 +01:00
committed by Space Team
parent a58d0dc237
commit 9a94ac5d20
@@ -7,20 +7,21 @@ package org.jetbrains.kotlin.gradle.targets.native.internal
import org.gradle.api.Project
import org.gradle.api.file.FileCollection
import org.jetbrains.kotlin.gradle.plugin.mpp.resolvableMetadataConfiguration
import org.jetbrains.kotlin.gradle.plugin.mpp.resolvableMetadataConfigurationName
import org.jetbrains.kotlin.gradle.plugin.sources.DefaultKotlinSourceSet
import org.jetbrains.kotlin.gradle.plugin.sources.internal
/**
* Dependencies here are using a special configuration called 'intransitiveMetadataConfiguration'.
* This special configuration can tell the IDE that this dependencies shall *not* be transitively be visible
* to dependsOn edges. This is necessary for the way the commonizer handles it's "expect refinement" approach.
* This special configuration can tell the IDE that these dependencies shall *not* be transitively visible
* to dependsOn edges.
* This is necessary for the way the commonizer handles its "expect refinement" approach.
* In this mode, every source set will receive exactly one commonized library to analyze its source code with.
*/
internal fun Project.addIntransitiveMetadataDependencyIfPossible(sourceSet: DefaultKotlinSourceSet, dependency: FileCollection) {
val dependencyConfigurationName =
if (project.isIntransitiveMetadataConfigurationEnabled) sourceSet.intransitiveMetadataConfigurationName
else sourceSet.implementationMetadataConfigurationName
val dependencyConfigurationName = if (project.isIntransitiveMetadataConfigurationEnabled) {
sourceSet.intransitiveMetadataConfigurationName
} else {
@Suppress("DEPRECATION")
sourceSet.implementationMetadataConfigurationName
}
project.dependencies.add(dependencyConfigurationName, dependency)
}