[Gradle] Read more system properties through Gradle providers

Related to #KT-43605
This commit is contained in:
Alexander Likhachev
2021-04-01 20:51:54 +03:00
parent ccfc16c84a
commit 16dc0a7d29
4 changed files with 18 additions and 9 deletions
@@ -16,6 +16,7 @@
package org.jetbrains.kotlin.daemon.common
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
import java.io.File
@@ -26,7 +27,7 @@ enum class OSKind {
Unknown;
companion object {
val current: OSKind = System.getProperty("os.name").toLowerCaseAsciiOnly().let {
val current: OSKind = CompilerSystemProperties.OS_NAME.safeValue.toLowerCaseAsciiOnly().let {
when {
// partly taken from http://www.code4copy.com/java/post/detecting-os-type-in-java
it.startsWith("windows") -> Windows
@@ -57,8 +58,8 @@ private fun String?.orDefault(v: String): String =
object FileSystem {
val userHomePath: String get() = System.getProperty("user.home")
val tempPath: String get() = System.getProperty("java.io.tmpdir")
val userHomePath: String get() = CompilerSystemProperties.USER_HOME.safeValue
val tempPath: String get() = CompilerSystemProperties.TMP_DIR.safeValue
val logFilesPath: String get() = tempPath