From 76e9c864959020c4c9d8df08ec9b66cb86487a7b Mon Sep 17 00:00:00 2001 From: "konstantin.annikov" Date: Tue, 21 Feb 2023 14:53:54 +0100 Subject: [PATCH] IDEA-313364 [Repair Utility] - link generation code style changes GitOrigin-RevId: d0c6425e8d2dc55d732aeba2b620326b7b0bbafe --- .../repair-utility/helpers/hashes_worker.go | 6 ++-- native/repair-utility/helpers/ide.go | 32 ++++++++++++------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/native/repair-utility/helpers/hashes_worker.go b/native/repair-utility/helpers/hashes_worker.go index 8a565a9ea3ea..435b4e635dfa 100644 --- a/native/repair-utility/helpers/hashes_worker.go +++ b/native/repair-utility/helpers/hashes_worker.go @@ -222,7 +222,7 @@ func downloadManifest(ide IDE) (json []byte, err error) { } func generateManifestUrl(ide IDE) string { - url := ide.GetDownloadUrl() + ".manifest" + url := ide.GetManifestDownloadUrl() return url } @@ -248,8 +248,8 @@ func GenerateFilesInfo() (distrFiles []fileInfo) { manifestGenerationWorkGroup.Wait() distrFiles = distrFilesThreaded.distrFiles sort.Slice(distrFiles[:], func(i, j int) bool { - return strings.Compare(distrFiles[i].Path, distrFiles[j].Path) == -1 - }) + return strings.Compare(distrFiles[i].Path, distrFiles[j].Path) == -1 + }) logger.InfoLogger.Printf("File struct size: %d, Time %d sec", len(distrFiles), time.Now().Unix()-timebeginning) return distrFiles } diff --git a/native/repair-utility/helpers/ide.go b/native/repair-utility/helpers/ide.go index 2de5e6b7c7db..c30769db1e53 100644 --- a/native/repair-utility/helpers/ide.go +++ b/native/repair-utility/helpers/ide.go @@ -14,18 +14,22 @@ import ( ) type IdeInfo struct { - Name string - Version string // 2022.2.1 - BuildNumber string - ProductCode string - DataDirectoryName string + Name string `json:"name"` + Version string `json:"version"` + BuildNumber string `json:"buildNumber"` + ProductCode string `json:"productCode"` + DataDirectoryName string `json:"dataDirectoryName"` IsRepairBundled bool Launch []struct { - Os string `json:"os"` - LauncherPath string `json:"launcherPath"` - JavaExecutablePath string `json:"javaExecutablePath"` - VmOptionsFilePath string `json:"vmOptionsFilePath"` + Os string `json:"os"` + Arch string `json:"arch"` + LauncherPath string `json:"launcherPath"` + JavaExecutablePath string `json:"javaExecutablePath"` + VmOptionsFilePath string `json:"vmOptionsFilePath"` + BootClassPathJarNames []string `json:"bootClassPathJarNames"` + AdditionalJvmArguments []string `json:"additionalJvmArguments"` } `json:"launch"` + BundledPlugins []string `json:"bundledPlugins"` } type IDE struct { Binary string @@ -67,7 +71,7 @@ func (ide *IDE) GetInfo() IdeInfo { } return ide.Info } -func (ide *IDE) GetDownloadUrl() string { +func (ide *IDE) GetManifestDownloadUrl() string { if //goland:noinspection ALL len(EmbeededDownloadUrl) > 0 && CurrentIde.IsRepairBundled() { logger.DebugLogger.Println("Embedded download URL = " + EmbeededDownloadUrl) @@ -82,7 +86,13 @@ func (ide *IDE) GetDownloadUrl() string { architectureSuffix = "-aarch64" } //For example https://download.jetbrains.com/idea/ideaIU-2022.2.1.exe.manifest - url := downloadsURL + "/" + ideBinary + "/" + ideBinary + ideInfo.ProductCode + "-" + ideInfo.Version + architectureSuffix + archiveExtension[runtime.GOOS] + url := downloadsURL + "/" + + ideBinary + "/" + + ideBinary + + ideInfo.ProductCode + "-" + ideInfo.Version + + architectureSuffix + + archiveExtension[runtime.GOOS] + + ".manifest" logger.DebugLogger.Println("No embedded download URL found. Generated download URL = " + url) return url }