[perf-test] Update EnableKotlinDaemonLogCommand to use a canonical log path

This change modifies the command to use the canonical path for the Kotlin Daemon log file because this is the only format that it can consume. It is very important for Windows setups

^KTIJ-30958 Fixed

GitOrigin-RevId: edd15d28d0e0d78416b9b75feb0387b31ca19dfc
This commit is contained in:
Aleksei.Cherepanov
2024-08-12 21:19:04 +02:00
committed by intellij-monorepo-bot
parent 447b4dd1dd
commit 3335befd4c

View File

@@ -3,6 +3,7 @@ package com.intellij.performance.performancePlugin.commands
import com.intellij.openapi.application.PathManager
import com.intellij.openapi.ui.playback.PlaybackContext
import com.intellij.openapi.util.io.toCanonicalPath
import com.jetbrains.performancePlugin.commands.PerformanceCommandCoroutineAdapter
import org.jetbrains.kotlin.idea.compiler.configuration.KotlinCompilerWorkspaceSettings
import java.io.File
@@ -19,11 +20,12 @@ internal class EnableKotlinDaemonLogCommand(text: String, line: Int) : Performan
override suspend fun doExecute(context: PlaybackContext) {
val project = context.project
val kotlinDaemonLog: File = (PathManager.getLogDir() / "kotlin-daemon.log").toFile().apply { createNewFile() }
val kotlinDaemonLogFile: File = (PathManager.getLogDir() / "kotlin-daemon.log").toFile().apply { createNewFile() }
val compilerSettings = KotlinCompilerWorkspaceSettings.getInstance(project)
val daemonDefaultVmOptions = compilerSettings.daemonVmOptions
val kotlinDaemonLogPath = kotlinDaemonLogFile.toPath().toCanonicalPath()
compilerSettings.daemonVmOptions =
daemonDefaultVmOptions + (if (daemonDefaultVmOptions.isEmpty()) "" else " ") + "-Dkotlin.daemon.log.path=$kotlinDaemonLog"
daemonDefaultVmOptions + (if (daemonDefaultVmOptions.isEmpty()) "" else " ") + "-Dkotlin.daemon.log.path=$kotlinDaemonLogPath"
}
override fun getName(): String {