[mpp] Fix reporting of pre-HMPP dependencies from intermediate source sets
It's an unfortunate clash between introduction of KotlinPluginLifecycle and changes in 'deprecationDiagnostics.kt'. It used 'afterEvaluate', but with KotlinPluginLifecycle later stages are effectively invoked in multiple nested afterEvaluate, making them invisible for single afterEvaluate. Specifically in this case, configuration of metadata compilations for intermediate source sets is executed in 'FinaliseCompilations' stage, which is simply not executed by the time checker runs in its single afterEvaluate. The fix is trivial -- wrap diagnostic checks runs into launchInStage ^KT-58470 Fixed
This commit is contained in:
committed by
Space Team
parent
4dd54e4de4
commit
6f584bcbe7
+6
@@ -17,6 +17,12 @@ class PreHmppDependenciesDeprecationIT : KGPBaseTest() {
|
||||
checkDiagnostics(gradleVersion, "simpleReport", tempDir, expectReportForDependency = "preHmppLibrary")
|
||||
}
|
||||
|
||||
@GradleTest
|
||||
fun testReportFromIntermediateSourceSet(gradleVersion: GradleVersion, @TempDir tempDir: Path) {
|
||||
publishLibrary("preHmppLibrary", gradleVersion, tempDir)
|
||||
checkDiagnostics(gradleVersion, "reportFromIntermediateSourceSet", tempDir, expectReportForDependency = "preHmppLibrary")
|
||||
}
|
||||
|
||||
@GradleTest
|
||||
fun testTransitiveDependencyUpgradesVersion(gradleVersion: GradleVersion, @TempDir tempDir: Path) {
|
||||
// 0.1
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
maven("<localRepo>")
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
linuxX64()
|
||||
js()
|
||||
|
||||
sourceSets {
|
||||
val commonMain by getting
|
||||
|
||||
val intermediate by creating {
|
||||
dependsOn(commonMain)
|
||||
dependencies {
|
||||
implementation("org.jetbrains.kotlin.tests:preHmppLibrary:0.1")
|
||||
}
|
||||
}
|
||||
|
||||
val jvmMain by getting {
|
||||
dependsOn(intermediate)
|
||||
}
|
||||
|
||||
val linuxX64Main by getting {
|
||||
dependsOn(intermediate)
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -56,9 +56,9 @@ private fun reportTargetsWithNonUniqueConsumableConfigurations(project: Project)
|
||||
}
|
||||
|
||||
SingleWarningPerBuild.show(
|
||||
project,"w: The following targets are not distinguishable:\n$nonUniqueTargetsString" +
|
||||
"\nUse distinguish attribute. " +
|
||||
"See https://kotlinlang.org/docs/multiplatform-set-up-targets.html#distinguish-several-targets-for-one-platform for more details."
|
||||
project, "w: The following targets are not distinguishable:\n$nonUniqueTargetsString" +
|
||||
"\nUse distinguish attribute. " +
|
||||
"See https://kotlinlang.org/docs/multiplatform-set-up-targets.html#distinguish-several-targets-for-one-platform for more details."
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -9,8 +9,10 @@ import org.gradle.api.Project
|
||||
import org.gradle.api.internal.project.ProjectInternal
|
||||
import org.gradle.api.provider.Provider
|
||||
import org.gradle.tooling.model.kotlin.dsl.KotlinDslModelsParameters
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginLifecycle
|
||||
import org.jetbrains.kotlin.gradle.plugin.internal.configurationTimePropertiesAccessor
|
||||
import org.jetbrains.kotlin.gradle.plugin.internal.usedAtConfigurationTime
|
||||
import org.jetbrains.kotlin.gradle.plugin.launchInStage
|
||||
import org.jetbrains.kotlin.gradle.plugin.whenEvaluated
|
||||
|
||||
/**
|
||||
@@ -97,7 +99,7 @@ private fun Project.inLenientMode() =
|
||||
* @see runProjectConfigurationHealthCheck
|
||||
*/
|
||||
internal inline fun Project.runProjectConfigurationHealthCheckWhenEvaluated(crossinline check: Project.() -> Unit) {
|
||||
whenEvaluated {
|
||||
launchInStage(KotlinPluginLifecycle.Stage.ReadyForExecution) {
|
||||
runProjectConfigurationHealthCheck(check)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user