From d99f8ac9b4c0f2839e37fc73014f820f26c0be08 Mon Sep 17 00:00:00 2001 From: Stanislav Erokhin Date: Tue, 1 Aug 2023 11:15:51 +0200 Subject: [PATCH] [mpp] Test that every deprecated pre-HMPP property triggers an Error Previously all these properties were put together, so only one of them could have triggered the Error #KT-59304 Verification Pending --- .../kotlin/gradle/mpp/MppDiagnosticsIt.kt | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/mpp/MppDiagnosticsIt.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/mpp/MppDiagnosticsIt.kt index 640c91f2066..701f9492997 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/mpp/MppDiagnosticsIt.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/mpp/MppDiagnosticsIt.kt @@ -26,24 +26,22 @@ class MppDiagnosticsIt : KGPBaseTest() { @GradleTest fun testDeprecatedMppProperties(gradleVersion: GradleVersion) { - project("mppDeprecatedProperties", gradleVersion) { - checkDeprecatedProperties(isDeprecationExpected = false) + for (deprecatedProperty in this.deprecatedFlags) { + project("mppDeprecatedProperties", gradleVersion) { + checkDeprecatedProperties(isDeprecationExpected = false) - this.gradleProperties.appendText( - defaultFlags.entries.joinToString( - prefix = System.lineSeparator(), - postfix = System.lineSeparator(), - separator = System.lineSeparator(), - ) { (prop, value) -> "$prop=$value" } - ) - checkDeprecatedProperties(isDeprecationExpected = true) + this.gradleProperties.appendText( + "${deprecatedProperty.key}=${deprecatedProperty.value}${System.lineSeparator()}" + ) + checkDeprecatedProperties(isDeprecationExpected = true) - // remove the MPP plugin from the top-level project and check the warnings are still reported in subproject - this.buildGradleKts.writeText("") - checkDeprecatedProperties(isDeprecationExpected = true) + // remove the MPP plugin from the top-level project and check the warnings are still reported in subproject + this.buildGradleKts.writeText("") + checkDeprecatedProperties(isDeprecationExpected = true) - this.gradleProperties.appendText("kotlin.internal.suppressGradlePluginErrors=PreHMPPFlagsError${System.lineSeparator()}") - checkDeprecatedProperties(isDeprecationExpected = false) + this.gradleProperties.appendText("kotlin.internal.suppressGradlePluginErrors=PreHMPPFlagsError${System.lineSeparator()}") + checkDeprecatedProperties(isDeprecationExpected = false) + } } } @@ -202,7 +200,7 @@ class MppDiagnosticsIt : KGPBaseTest() { } } - private val defaultFlags: Map + private val deprecatedFlags: Map get() = mapOf( "kotlin.mpp.enableGranularSourceSetsMetadata" to "true", "kotlin.mpp.enableCompatibilityMetadataVariant" to "false",