[MPP] Add a flag to disable warnings about deprecated HMPP properties

KT-55891
This commit is contained in:
Pavel Kirpichenkov
2023-01-17 15:38:51 +02:00
committed by Space Team
parent ec5f56584c
commit 26e160d4ce
3 changed files with 9 additions and 1 deletions
@@ -25,8 +25,10 @@ class MppDeprecatedPropertiesIt : KGPBaseTest() {
separator = System.lineSeparator(),
) { (prop, value) -> "$prop=$value" }
)
checkDeprecations(isDeprecationExpected = true)
this.gradleProperties.appendText("kotlin.mpp.deprecatedProperties.nowarn=true${System.lineSeparator()}")
checkDeprecations(isDeprecationExpected = false)
}
}
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLI
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_ENABLE_PLATFORM_INTEGER_COMMONIZATION
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_HIERARCHICAL_STRUCTURE_BY_DEFAULT
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_HIERARCHICAL_STRUCTURE_SUPPORT
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_DEPRECATED_PROPERTIES_NO_WARN
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_IMPORT_ENABLE_SLOW_SOURCES_JAR_RESOLVER
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_NATIVE_DEPENDENCY_PROPAGATION
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_NATIVE_USE_XCODE_MESSAGE_STYLE
@@ -259,6 +260,9 @@ internal class PropertiesProvider private constructor(private val project: Proje
val ignoreIncorrectNativeDependencies: Boolean?
get() = booleanProperty(KOTLIN_NATIVE_IGNORE_INCORRECT_DEPENDENCIES)
val ignoreHmppDeprecationWarnings: Boolean?
get() = booleanProperty(KOTLIN_MPP_DEPRECATED_PROPERTIES_NO_WARN)
/**
* Enables individual test task reporting for aggregated test tasks.
*
@@ -554,6 +558,7 @@ internal class PropertiesProvider private constructor(private val project: Proje
const val KOTLIN_MPP_ENABLE_CINTEROP_COMMONIZATION = "kotlin.mpp.enableCInteropCommonization"
const val KOTLIN_MPP_HIERARCHICAL_STRUCTURE_BY_DEFAULT = "kotlin.internal.mpp.hierarchicalStructureByDefault"
const val KOTLIN_MPP_HIERARCHICAL_STRUCTURE_SUPPORT = "kotlin.mpp.hierarchicalStructureSupport"
const val KOTLIN_MPP_DEPRECATED_PROPERTIES_NO_WARN = "kotlin.mpp.deprecatedProperties.nowarn"
const val KOTLIN_MPP_ANDROID_GRADLE_PLUGIN_COMPATIBILITY_NO_WARN = "kotlin.mpp.androidGradlePluginCompatibility.nowarn"
const val KOTLIN_MPP_ANDROID_SOURCE_SET_LAYOUT_VERSION = "kotlin.mpp.androidSourceSetLayoutVersion"
const val KOTLIN_MPP_ANDROID_SOURCE_SET_LAYOUT_VERSION_1_NO_WARN = "${KOTLIN_MPP_ANDROID_SOURCE_SET_LAYOUT_VERSION}1.nowarn"
@@ -38,6 +38,7 @@ internal fun checkAndReportDeprecatedNativeTargets(project: Project) {
*/
internal fun checkAndReportDeprecatedMppProperties(project: Project) {
val projectProperties = project.kotlinPropertiesProvider
if (projectProperties.ignoreHmppDeprecationWarnings == true) return
val warnings = deprecatedMppProperties.mapNotNull { propertyName ->
projectProperties.property(propertyName)?.let { getMppDeprecationWarningMessageForProperty(propertyName) }