提交 b3cffcbb 编写于 作者: yanghye's avatar yanghye

energy command-line tools: windows package 7z, 7za

上级 c62d78a8
......@@ -16,7 +16,8 @@
"exclude": ["cache"],
"package": "com.{{.CompanyName}}.{{.CompanyName}}",
"homepage": "https://github.com/energye/energy",
"compress": "7zz"
"compress": "7zz",
"compressName": "framework.7z"
},
"author": {
"name": "yanghy",
......
......@@ -22,7 +22,8 @@
"license": "",
"language": "english",
"requestExecutionLevel": "admin",
"compress": "7za"
"compress": "7za",
"compressName": "framework.7z"
},
"author": {
"name": "yanghy",
......
......@@ -45,8 +45,8 @@ RequestExecutionLevel "${REQUEST_EXECUTION_LEVEL}" ; admin or ""
!macro energy.compressNsis7z
{{if .NSIS.UseCompress}} ;CEF
Nsis7z::ExtractWithCallback "$INSTDIR\CEF.7z"
Delete "$OUTDIR\CEF.7z"
Nsis7z::ExtractWithCallback "$INSTDIR\{{.NSIS.CompressName}}"
Delete "$OUTDIR\{{.NSIS.CompressName}}"
{{end}}
!macroend
......
......@@ -72,14 +72,13 @@ func GeneraInstaller(proj *project.Project) error {
}
func compressCEF7za(proj *project.Project) (string, error) {
cef7zFile := "CEF.7z"
term.Logger.Info("7za compress " + cef7zFile + ", This may take some time")
term.Logger.Info("7za compress " + proj.NSIS.CompressName + ", This may take some time")
buildWindowsPath := filepath.Join(assets.BuildOutPath(proj), "windows")
outFilePath := filepath.FromSlash(filepath.Join(buildWindowsPath, cef7zFile))
outFilePath := filepath.FromSlash(filepath.Join(buildWindowsPath, proj.NSIS.CompressName))
if proj.Clean {
os.Remove(outFilePath)
} else if tools.IsExist(outFilePath) {
term.Logger.Info(cef7zFile + " file exist")
term.Logger.Info(proj.NSIS.CompressName + " file exist")
return outFilePath, nil
}
......@@ -98,7 +97,10 @@ func compressCEF7za(proj *project.Project) (string, error) {
cmd := command.NewCMD()
cmd.IsPrint = false
var args = []string{"a", outFilePath, filepath.FromSlash(fmt.Sprintf("%s/*", proj.FrameworkPath))}
cmd.Command("7za", args...)
for _, exc := range proj.NSIS.Exclude {
args = append(args, "-xr!"+exc)
}
cmd.Command(proj.NSIS.Compress, args...)
cmd.Close()
return outFilePath, nil
}
......
......@@ -132,7 +132,8 @@ type NSIS struct {
License string `json:"license"` //安装包授权信息,(license.txt)文件路径
Language string `json:"language"` //安装包语言, 中文: SimpChinese, 英文: English, 语言在 NSIS_HOME/Contrib/Language files
RequestExecutionLevel string `json:"requestExecutionLevel"` //admin or ""
Compress string `json:"compress"` //压纹CEF, 当前仅支持7z/a压缩,""(空)时不启用压缩 默认: 7za
Compress string `json:"compress"` //压缩CEF, 当前仅支持7z/a压缩,""(空)时不启用压缩 默认: 7za
CompressName string `json:"compressName"` //压缩CEF后的7z包名称
UseCompress bool `json:"-"` //如果支持配置的, true=使用压缩
CompressFile string `json:"-"` //压缩后的文件完全目录
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册