[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
@@ -299,7 +299,7 @@ object KotlinCompilerClient {
}
fun detectCompilerClasspath(): List<String>? =
System.getProperty("java.class.path")
CompilerSystemProperties.JAVA_CLASS_PATH.value
?.split(File.pathSeparator)
?.map { File(it).parentFile }
?.distinct()
@@ -368,13 +368,13 @@ object KotlinCompilerClient {
private fun startDaemon(compilerId: CompilerId, daemonJVMOptions: DaemonJVMOptions, daemonOptions: DaemonOptions, reportingTargets: DaemonReportingTargets): Boolean {
val javaExecutable = File(File(System.getProperty("java.home"), "bin"), "java")
val javaExecutable = File(File(CompilerSystemProperties.JAVA_HOME.safeValue, "bin"), "java")
val serverHostname = CompilerSystemProperties.JAVA_RMI_SERVER_HOSTNAME.value ?: error("${CompilerSystemProperties.JAVA_RMI_SERVER_HOSTNAME.property} is not set!")
val platformSpecificOptions = listOf(
// hide daemon window
"-Djava.awt.headless=true",
"-D$${CompilerSystemProperties.JAVA_RMI_SERVER_HOSTNAME.property}=$serverHostname")
val javaVersion = System.getProperty("java.specification.version")?.toIntOrNull()
val javaVersion = CompilerSystemProperties.JAVA_VERSION.value?.toIntOrNull()
val javaIllegalAccessWorkaround =
if (javaVersion != null && javaVersion >= 16)
listOf("--illegal-access=permit")