Mark API for direct access to declared project properties with opt-in
KT-55891
This commit is contained in:
committed by
Space Team
parent
26e160d4ce
commit
3b9aac067a
+6
@@ -45,12 +45,14 @@ import org.jetbrains.kotlin.gradle.utils.SingleWarningPerBuild
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import org.jetbrains.kotlin.konan.target.presetName
|
||||
import org.jetbrains.kotlin.statistics.metrics.StringMetrics
|
||||
import org.jetbrains.kotlin.tooling.core.UnsafeApi
|
||||
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toUpperCaseAsciiOnly
|
||||
import org.jetbrains.kotlin.util.prefixIfNot
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
@OptIn(UnsafeApi::class)
|
||||
internal class PropertiesProvider private constructor(private val project: Project) {
|
||||
private val localProperties: Properties by lazy {
|
||||
Properties().apply {
|
||||
@@ -526,7 +528,11 @@ internal class PropertiesProvider private constructor(private val project: Proje
|
||||
* Looks up the property in the following sources with decreasing priority:
|
||||
* 1. Project properties (-P, gradle.properties, etc...)
|
||||
* 2. `local.properties`
|
||||
*
|
||||
* Please prefer using dedicated properties for proper defaults handling.
|
||||
* Use this API only if you specifically need declared project properties disregarding defaults.
|
||||
*/
|
||||
@UnsafeApi
|
||||
internal fun property(propName: String): String? =
|
||||
if (project.hasProperty(propName)) {
|
||||
project.property(propName) as? String
|
||||
|
||||
+2
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.gradle.utils.SingleWarningPerBuild
|
||||
import org.jetbrains.kotlin.gradle.utils.hasSyncErrors
|
||||
import org.jetbrains.kotlin.gradle.utils.runProjectConfigurationHealthCheckWhenEvaluated
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import org.jetbrains.kotlin.tooling.core.UnsafeApi
|
||||
|
||||
internal fun checkAndReportDeprecatedNativeTargets(project: Project) {
|
||||
project.runProjectConfigurationHealthCheckWhenEvaluated {
|
||||
@@ -41,6 +42,7 @@ internal fun checkAndReportDeprecatedMppProperties(project: Project) {
|
||||
if (projectProperties.ignoreHmppDeprecationWarnings == true) return
|
||||
|
||||
val warnings = deprecatedMppProperties.mapNotNull { propertyName ->
|
||||
@OptIn(UnsafeApi::class)
|
||||
projectProperties.property(propertyName)?.let { getMppDeprecationWarningMessageForProperty(propertyName) }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user