[gateway] use the proper client build number when launching the client for a backend with a snapshot version (GTW-6851)

When a backend has a snapshot version, CodeWithMeClientDownloader.createSessionInfo computes the latest available build of the client, and it is downloaded. However, code which launches the client used 'xxx.SNAPSHOT' version and failed to run it. Now the exact version of the client is propagated via JetBrainsClientDownloadInfo.clientBuildNumber and ExtractedJetBrainsClientData.version and used to run the downloaded client.

GitOrigin-RevId: bfceb6fc4e40ef4b7177ba109615a1250b355eb7
This commit is contained in:
Nikolay Chashnikov
2024-08-14 13:43:45 +02:00
committed by intellij-monorepo-bot
parent a97159b158
commit 968ae2429c
3 changed files with 7 additions and 5 deletions

View File

@@ -5,6 +5,7 @@ import org.jetbrains.annotations.ApiStatus
@ApiStatus.Experimental
open class JetBrainsClientDownloadInfo(
val hostBuildNumber: String,
val clientBuildNumber: String = hostBuildNumber,
val compatibleClientUrl: String,
val compatibleJreUrl: String?,
val downloadPgpPublicKeyUrl: String?

View File

@@ -226,6 +226,7 @@ object CodeWithMeClientDownloader {
val sessionInfo = JetBrainsClientDownloadInfo(
hostBuildNumber = hostBuildNumber,
clientBuildNumber = clientBuildNumber,
compatibleClientUrl = clientDownloadUrl,
compatibleJreUrl = jreDownloadUrl,
downloadPgpPublicKeyUrl = pgpPublicKeyUrl
@@ -346,9 +347,9 @@ object CodeWithMeClientDownloader {
progressIndicator: ProgressIndicator): ExtractedJetBrainsClientData {
ApplicationManager.getApplication().assertIsNonDispatchThread()
val embeddedClientLauncher = createEmbeddedClientLauncherIfAvailable(sessionInfoResponse.hostBuildNumber)
val embeddedClientLauncher = createEmbeddedClientLauncherIfAvailable(sessionInfoResponse.clientBuildNumber)
if (embeddedClientLauncher != null) {
return ExtractedJetBrainsClientData(Path(PathManager.getHomePath()), null, sessionInfoResponse.hostBuildNumber)
return ExtractedJetBrainsClientData(Path(PathManager.getHomePath()), null, sessionInfoResponse.clientBuildNumber)
}
val tempDir = FileUtil.createTempDirectory("jb-cwm-dl", null).toPath()
@@ -359,7 +360,7 @@ object CodeWithMeClientDownloader {
url = clientUrl,
tempDir = tempDir,
cachesDir = config.clientCachesDir,
includeInManifest = getJetBrainsClientManifestFilter(sessionInfoResponse.hostBuildNumber),
includeInManifest = getJetBrainsClientManifestFilter(sessionInfoResponse.clientBuildNumber),
)
val jdkUrl = sessionInfoResponse.compatibleJreUrl?.let { URI(it) }
@@ -527,7 +528,7 @@ object CodeWithMeClientDownloader {
if (!guestSucceeded || !jdkSucceeded) error("Guest or jdk was not downloaded")
LOG.info("Download of guest and jdk succeeded")
return ExtractedJetBrainsClientData(clientDir = guestData.targetPath, jreDir = jdkData?.targetPath, version = sessionInfoResponse.hostBuildNumber)
return ExtractedJetBrainsClientData(clientDir = guestData.targetPath, jreDir = jdkData?.targetPath, version = sessionInfoResponse.clientBuildNumber)
}
catch(e: ProcessCanceledException) {
LOG.info("Download was canceled")

View File

@@ -142,7 +142,7 @@ object CodeWithMeGuestLauncher {
url = clientUrl,
tempDir = tempDir,
cachesDir = service<JetBrainsClientDownloaderConfigurationProvider>().clientCachesDir,
includeInManifest = CodeWithMeClientDownloader.getJetBrainsClientManifestFilter(sessionInfo.hostBuildNumber),
includeInManifest = CodeWithMeClientDownloader.getJetBrainsClientManifestFilter(sessionInfo.clientBuildNumber),
)
val lifetime = aLifetime ?: project?.createLifetime() ?: Lifetime.Eternal
val clientLifetime = CodeWithMeClientDownloader.runCwmGuestProcessFromDownload(