[native] Fix kotlin.native.home properties order.

This commit is contained in:
Pavel Punegov
2021-03-18 14:41:03 +00:00
committed by Space
parent 44d03bc727
commit cae95b1ba0
@@ -91,23 +91,21 @@ fun Project.redirectIfEnabled(url: String):String = if (cacheRedirectorEnabled)
} else } else
url url
val validPropertiesNames = listOf("kotlin.native.home", val validPropertiesNames = listOf("konan.home",
"org.jetbrains.kotlin.native.home", "org.jetbrains.kotlin.native.home",
"konan.home") "kotlin.native.home")
val Project.kotlinNativeDist val Project.kotlinNativeDist
get() = rootProject.currentKotlinNativeDist get() = rootProject.currentKotlinNativeDist
val Project.currentKotlinNativeDist val Project.currentKotlinNativeDist
get() = file(validPropertiesNames.firstOrNull{ hasProperty(it) }?.let{ findProperty(it) } ?: "dist") get() = file(validPropertiesNames.firstOrNull { hasProperty(it) }?.let { findProperty(it) } ?: "dist")
val kotlinNativeHome val kotlinNativeHome
get() = validPropertiesNames.mapNotNull(System::getProperty).first() get() = validPropertiesNames.mapNotNull(System::getProperty).first()
val Project.useCustomDist val Project.useCustomDist
get() = hasProperty("kotlin.native.home") || get() = validPropertiesNames.any { hasProperty(it) }
hasProperty("org.jetbrains.kotlin.native.home") ||
hasProperty("konan.home")
private val libraryRegexp = Regex("""^import\s+platform\.(\S+)\..*$""") private val libraryRegexp = Regex("""^import\s+platform\.(\S+)\..*$""")
fun File.dependencies() = fun File.dependencies() =