[Gradle, MPP] Make publishing compatible with configuration cache
Capture artifact coordinates more accurately to conform with configuration cache #KT-47611 In Progress
This commit is contained in:
+11
-10
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
|
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinTargetComponent
|
import org.jetbrains.kotlin.gradle.plugin.KotlinTargetComponent
|
||||||
import org.jetbrains.kotlin.gradle.utils.dashSeparatedName
|
import org.jetbrains.kotlin.gradle.utils.dashSeparatedName
|
||||||
|
import org.jetbrains.kotlin.gradle.utils.getValue
|
||||||
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
||||||
|
|
||||||
internal interface KotlinTargetComponentWithPublication : KotlinTargetComponent {
|
internal interface KotlinTargetComponentWithPublication : KotlinTargetComponent {
|
||||||
@@ -27,25 +28,25 @@ internal fun getCoordinatesFromPublicationDelegateAndProject(
|
|||||||
publication: MavenPublication?,
|
publication: MavenPublication?,
|
||||||
project: Project,
|
project: Project,
|
||||||
target: KotlinTarget?
|
target: KotlinTarget?
|
||||||
): ModuleVersionIdentifier =
|
): ModuleVersionIdentifier {
|
||||||
object : ModuleVersionIdentifier {
|
val moduleNameProvider = project.provider { publication?.artifactId ?: dashSeparatedName(project.name, target?.name?.toLowerCase()) }
|
||||||
private val moduleName: String
|
val moduleGroupProvider = project.provider { publication?.groupId ?: project.group.toString() }
|
||||||
get() =
|
val moduleVersionProvider = project.provider { publication?.version ?: project.version.toString() }
|
||||||
publication?.artifactId ?: dashSeparatedName(project.name, target?.name?.toLowerCase())
|
return object : ModuleVersionIdentifier {
|
||||||
|
private val moduleName: String by moduleNameProvider
|
||||||
private val moduleGroup: String
|
private val moduleGroup: String by moduleGroupProvider
|
||||||
get() =
|
private val moduleVersion: String by moduleVersionProvider
|
||||||
publication?.groupId ?: project.group.toString()
|
|
||||||
|
|
||||||
override fun getGroup() = moduleGroup
|
override fun getGroup() = moduleGroup
|
||||||
override fun getName() = moduleName
|
override fun getName() = moduleName
|
||||||
override fun getVersion() = publication?.version ?: project.version.toString()
|
override fun getVersion() = moduleVersion
|
||||||
|
|
||||||
override fun getModule(): ModuleIdentifier = object : ModuleIdentifier {
|
override fun getModule(): ModuleIdentifier = object : ModuleIdentifier {
|
||||||
override fun getGroup(): String = moduleGroup
|
override fun getGroup(): String = moduleGroup
|
||||||
override fun getName(): String = moduleName
|
override fun getName(): String = moduleName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private interface KotlinTargetComponentWithCoordinatesAndPublication :
|
private interface KotlinTargetComponentWithCoordinatesAndPublication :
|
||||||
KotlinTargetComponentWithPublication,
|
KotlinTargetComponentWithPublication,
|
||||||
|
|||||||
Reference in New Issue
Block a user