Skip to content

Commit

Permalink
AT-1768 Fix running tests via ExistingIdeInstaller on Windows
Browse files Browse the repository at this point in the history
(cherry picked from commit 68d1114c3ccb628695a38a69dd8753dd44315ee3)

IJ-CR-150829

GitOrigin-RevId: 1bf1546036844b9907c0fc3f478c0a7474e693b2
  • Loading branch information
emrzv authored and intellij-monorepo-bot committed Dec 4, 2024
1 parent 8376eca commit 8f74636
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import kotlin.io.path.listDirectoryEntries

class WindowsIdeDistribution : IdeDistribution() {
override fun installIde(unpackDir: Path, executableFileName: String): InstalledIde {
val (productCode, build) = readProductCodeAndBuildNumberFromBuildTxt(unpackDir.resolve("build.txt"))
val appHome = (unpackDir.toFile().listFiles()?.singleOrNull { it.isDirectory }?.toPath() ?: unpackDir).toAbsolutePath()
val (productCode, build) = readProductCodeAndBuildNumberFromBuildTxt(appHome.resolve("build.txt"))

val binDir = unpackDir / "bin"
val binDir = appHome / "bin"

val allBinFiles = binDir.listDirectoryEntries()

Expand All @@ -22,7 +23,7 @@ class WindowsIdeDistribution : IdeDistribution() {
} ?: error("Failed to detect executable ${executableFileName}64.exe:\n${allBinFiles.joinToString("\n")}")

return object : InstalledIde {
override val bundledPluginsDir = unpackDir.resolve("plugins")
override val bundledPluginsDir = appHome.resolve("plugins")

private val vmOptionsFinal: VMOptions = VMOptions(
ide = this,
Expand All @@ -33,24 +34,24 @@ class WindowsIdeDistribution : IdeDistribution() {
override val vmOptions: VMOptions
get() = vmOptionsFinal

override val patchedVMOptionsFile = unpackDir.parent.resolve("${unpackDir.fileName}.vmoptions")
override val patchedVMOptionsFile = appHome.parent.resolve("${appHome.fileName}.vmoptions")

override fun startConfig(vmOptions: VMOptions, logsDir: Path) = object : InstalledBackedIDEStartConfig(patchedVMOptionsFile,
vmOptions) {
override val workDir = unpackDir
override val workDir = appHome
override val commandLine = listOf(executablePath.toAbsolutePath().toString())
}

override val build = build
override val os = OS.Windows
override val productCode = productCode
override val isFromSources = false
override val installationPath: Path = unpackDir.toAbsolutePath()
override val installationPath: Path = appHome.toAbsolutePath()

override fun toString() = "IDE{$productCode, $build, $os, home=$unpackDir}"

override suspend fun resolveAndDownloadTheSameJDK(): Path {
val jbrHome = unpackDir / "jbr"
val jbrHome = appHome / "jbr"
require(jbrHome.isDirectory()) {
"JbrHome is not found under $jbrHome"
}
Expand Down

0 comments on commit 8f74636

Please sign in to comment.