From 44768f79f9e382e465b12e00a9ca1835607d7312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E7=BA=A2=E5=B2=A9?= Date: Mon, 21 Aug 2023 16:32:42 +0800 Subject: [PATCH] U: upgrade command-line tool --- cmd/energy/build.bat | 6 +++--- cmd/internal/install.go | 12 +++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cmd/energy/build.bat b/cmd/energy/build.bat index d6efe239..1567889f 100644 --- a/cmd/energy/build.bat +++ b/cmd/energy/build.bat @@ -2,15 +2,15 @@ SET CGO_ENABLED=0 set GOARCH=386 set GOOS=windows -go build -ldflags "-s -w" -o energy-win-32.exe energy.go +go build -ldflags "-s -w" -o energy-windows-32.exe energy.go set GOARCH=amd64 set GOOS=windows -go build -ldflags "-s -w" -o energy-win-64.exe energy.go +go build -ldflags "-s -w" -o energy-windows-64.exe energy.go set GOARCH=arm64 set GOOS=windows -go build -ldflags "-s -w" -o energy-winarm-64.exe energy.go +go build -ldflags "-s -w" -o energy-windowsarm-64.exe energy.go set GOARCH=amd64 set GOOS=darwin diff --git a/cmd/internal/install.go b/cmd/internal/install.go index 9f910583..7c4e876b 100644 --- a/cmd/internal/install.go +++ b/cmd/internal/install.go @@ -59,6 +59,7 @@ type downloadInfo struct { url string success bool isSupport bool + module string } func init() { @@ -225,7 +226,7 @@ func runInstall(c *CommandConfig) error { downloadCefURL = replaceSource(downloadCefURL, ToString(cefModule["downloadSource"]), ToInt(cefModule["downloadSourceSelect"]), "cef") downloadCefURL = strings.ReplaceAll(downloadCefURL, "{version}", cefVersion) downloadCefURL = strings.ReplaceAll(downloadCefURL, "{OSARCH}", libCEFOS) - downloads[cefKey] = &downloadInfo{isSupport: isSupport, fileName: urlName(downloadCefURL), downloadPath: filepath.Join(c.Install.Path, frameworkCache, urlName(downloadCefURL)), frameworkPath: installPathName, url: downloadCefURL} + downloads[cefKey] = &downloadInfo{isSupport: isSupport, fileName: urlName(downloadCefURL), downloadPath: filepath.Join(c.Install.Path, frameworkCache, urlName(downloadCefURL)), frameworkPath: installPathName, url: downloadCefURL, module: cefModuleName} // liblcl // 如果选定的cef 106,在linux会指定liblcl gtk2 版本, 其它系统和版本以默认的形式区分 @@ -239,14 +240,14 @@ func runInstall(c *CommandConfig) error { downloadEnergyURL = strings.ReplaceAll(downloadEnergyURL, "{version}", liblclVersion) downloadEnergyURL = strings.ReplaceAll(downloadEnergyURL, "{module}", module) downloadEnergyURL = strings.ReplaceAll(downloadEnergyURL, "{OSARCH}", libEnergyOS) - downloads[liblclKey] = &downloadInfo{isSupport: isSupport, fileName: urlName(downloadEnergyURL), downloadPath: filepath.Join(c.Install.Path, frameworkCache, urlName(downloadEnergyURL)), frameworkPath: installPathName, url: downloadEnergyURL} + downloads[liblclKey] = &downloadInfo{isSupport: isSupport, fileName: urlName(downloadEnergyURL), downloadPath: filepath.Join(c.Install.Path, frameworkCache, urlName(downloadEnergyURL)), frameworkPath: installPathName, url: downloadEnergyURL, module: liblclModuleName} } // 在线下载框架二进制包 for key, dl := range downloads { fmt.Printf("Download %s: %s\n", key, dl.url) if !dl.isSupport { - println("module is not built or configured 【", dl.fileName, "]") + println("Warn module is not built or configured 【", dl.module, "】") continue } bar := progressbar.NewBar(100) @@ -257,7 +258,8 @@ func runInstall(c *CommandConfig) error { }) bar.PrintEnd("Download [" + dl.fileName + "] success") if err != nil { - println("Download [", dl.fileName, "] error", err) + println("Download [", dl.fileName, "] error:", err.Error()) + os.Exit(1) } dl.success = err == nil } @@ -266,7 +268,7 @@ func runInstall(c *CommandConfig) error { var removeFileList = make([]string, 0, 0) for key, di := range downloads { if !di.isSupport { - println("energy command line does not support the system architecture.") + println("Warn module is not built or configured 【", di.module, "】") continue } if di.success {