[MPP] Do not postpone warning reporting for HMPP props to afterEvaluate
The check itself happens during application time, remove the health check wrapper for reporting to make the code more clear. One downside is that the warning could be reported on misconfigured projects, but it's a minor inconvenience. KT-55891
This commit is contained in:
committed by
Space Team
parent
a03db78ed2
commit
25668ddd01
+3
-7
@@ -16,7 +16,7 @@ import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLI
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
|
||||
import org.jetbrains.kotlin.gradle.plugin.whenEvaluated
|
||||
import org.jetbrains.kotlin.gradle.utils.SingleWarningPerBuild
|
||||
import org.jetbrains.kotlin.gradle.utils.hasSyncErrors
|
||||
import org.jetbrains.kotlin.gradle.utils.runProjectConfigurationHealthCheck
|
||||
import org.jetbrains.kotlin.gradle.utils.runProjectConfigurationHealthCheckWhenEvaluated
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import org.jetbrains.kotlin.tooling.core.UnsafeApi
|
||||
@@ -49,12 +49,8 @@ internal fun checkAndReportDeprecatedMppProperties(project: Project) {
|
||||
projectProperties.property(propertyName)?.let { getMppDeprecationWarningMessageForProperty(propertyName) }
|
||||
}
|
||||
|
||||
project.whenEvaluated {
|
||||
if (!project.hasSyncErrors()) {
|
||||
warnings.forEach { message ->
|
||||
SingleWarningPerBuild.show(project, message)
|
||||
}
|
||||
}
|
||||
warnings.forEach { message ->
|
||||
SingleWarningPerBuild.show(project, message)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-4
@@ -60,16 +60,13 @@ import org.jetbrains.kotlin.gradle.plugin.whenEvaluated
|
||||
*/
|
||||
internal inline fun Project.runProjectConfigurationHealthCheck(check: Project.() -> Unit) {
|
||||
/* Running configuration checks on a failed project will only lead to false positive error messages */
|
||||
if (project.hasSyncErrors()) {
|
||||
if (state.failure != null || (inLenientMode() && syncExceptionsAreNotEmpty())) {
|
||||
return
|
||||
}
|
||||
|
||||
check()
|
||||
}
|
||||
|
||||
internal fun Project.hasSyncErrors(): Boolean =
|
||||
state.failure != null || (inLenientMode() && syncExceptionsAreNotEmpty())
|
||||
|
||||
// ClassPathModeExceptionCollector is available only via 'gradleKotlinDsl()' dependency which brings in full Gradle jar
|
||||
private fun Project.syncExceptionsAreNotEmpty(): Boolean {
|
||||
val classPathModeExceptionCollectionClass = Class.forName("org.gradle.kotlin.dsl.provider.ClassPathModeExceptionCollector")
|
||||
|
||||
Reference in New Issue
Block a user