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

command-line: add package for darwin

上级 8cf1ddf9
......@@ -4,15 +4,18 @@
"frameworkPath": "{{.FrameworkPath}}",
"assetsDir": "assets",
"outputFilename": "{{.OutputFilename}}",
"info": {
"icon": "{{.ProjectPath}}/resources/icon.ico",
"plist": {
"icon": "{{.ProjectPath}}/resources/icon.png",
"companyName": "{{.CompanyName}}",
"productName": "{{.ProductName}}",
"fileVersion": "1.0.0",
"productVersion": "1.0.0",
"locals": [
"zh_CN",
"en"
],
"cfBundleVersion": "1.0.0",
"cfBundleShortVersionString": "1.0.0",
"copyright": "Copyright.....",
"comments": "Built using ENERGY (https://github.com/energye/energy)",
"fileDescription": "Built using ENERGY (https://github.com/energye/energy)"
"comments": "Built using ENERGY (https://github.com/energye/energy)"
},
"author": {
"name": "yanghy",
......
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleName</key>
<string>{{.Info.ProductName}}</string>
<key>CFBundleExecutable</key>
<string>{{.Name}}</string>
<key>CFBundleIdentifier</key>
<string>com.energy.{{.Name}}</string>
<key>CFBundleVersion</key>
<string>{{.Info.ProductVersion}}</string>
<key>CFBundleGetInfoString</key>
<string>{{.Info.Comments}}</string>
<key>CFBundleShortVersionString</key>
<string>{{.Info.ProductVersion}}</string>
<key>CFBundleIconFile</key>
<string>iconfile</string>
<key>LSMinimumSystemVersion</key>
<string>10.13.0</string>
<key>NSHighResolutionCapable</key>
<string>true</string>
<key>NSHumanReadableCopyright</key>
<string>{{.Info.Copyright}}</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsLocalNetworking</key>
<true/>
</dict>
</dict>
</plist>
\ No newline at end of file
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleName</key>
<string>{{.Info.ProductName}}</string>
<key>CFBundleExecutable</key>
<string>{{.OutputFilename}}</string>
<key>CFBundleName</key>
<string>{{.Name}}</string>
<key>CFBundleLocalizations</key>
<array>
<string>{{.PList.Locales}}</string>
</array>
<key>CFBundleIdentifier</key>
<string>com.energy.{{.Name}}</string>
<string>com.{{.PList.CompanyName}}.{{.PList.ProductName}}</string>
<key>CFBundleVersion</key>
<string>{{.Info.ProductVersion}}</string>
<key>CFBundleGetInfoString</key>
<string>{{.Info.Comments}}</string>
<string>{{.PList.CFBundleVersion}}</string>
<key>CFBundleShortVersionString</key>
<string>{{.Info.ProductVersion}}</string>
<string>{{.PList.CFBundleShortVersionString}}</string>
<key>CFBundleGetInfoString</key>
<string>{{.PList.Comments}}</string>
<key>CFBundleIconFile</key>
<string>iconfile</string>
<string>{{.PList.Icon}}</string>
<key>NSHumanReadableCopyright</key>
<string>{{.PList.Copyright}}</string>
<key>LSUIElement</key>
<{{.PList.LSUIElement}}/>
<key>LSMinimumSystemVersion</key>
<string>10.13.0</string>
<key>NSHighResolutionCapable</key>
<string>true</string>
<key>NSHumanReadableCopyright</key>
<string>{{.Info.Copyright}}</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSPrincipalClass</key>
<string>TCrCocoaApplication</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>*</string>
</array>
<key>CFBundleTypeOSTypes</key>
<array>
<string>fold</string>
<string>disk</string>
<string>****</string>
</array>
</dict>
</array>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
\ No newline at end of file
......@@ -14,9 +14,30 @@
package packager
import (
"fmt"
"github.com/energye/energy/v2/cmd/internal/assets"
"github.com/energye/energy/v2/cmd/internal/project"
"github.com/energye/energy/v2/cmd/internal/tools"
"os"
"path/filepath"
)
func GeneraInstaller(projectData *project.Project) error {
const (
darwinInfoPList = "darwin/Info.plist"
)
var (
pkgInfo = []byte{0x41, 0x50, 0x50, 0x4C, 0x3F, 0x3F, 0x3F, 0x3F, 0x0D, 0x0A}
)
func GeneraInstaller(proj *project.Project) error {
appRoot := fmt.Sprintf("linux/%s-%s", proj.Name, proj.Info.ProductVersion)
buildOutDir := assets.BuildOutPath(proj)
buildOutDir = filepath.Join(buildOutDir, appRoot)
if !tools.IsExist(buildOutDir) {
if err := os.MkdirAll(buildOutDir, 0755); err != nil {
return fmt.Errorf("unable to create directory: %w", err)
}
}
return nil
}
......@@ -32,6 +32,7 @@ type Project struct {
Info Info `json:"info"` // 应用信息
NSIS NSIS `json:"nsis"` // windows nsis 安装包
Dpkg DPKG `json:"dpkg"` // linux dpkg 安装包
PList PList `json:"plist"` // darwin plist 安装包
Author Author `json:"author"` // 作者信息
}
......@@ -151,6 +152,19 @@ type DPKG struct {
CompressFile string `json:"-"` //压缩后的文件完全目录
}
type PList struct {
Icon string `json:"icon"` //应用图标, png 或 icns, 如果指定png则生成icns, 如果指定icns则直接使用
CompanyName string `json:"companyName"` //公司名称
ProductName string `json:"productName"` //产品名称
FileVersion string `json:"FileVersion"` //文件版本
Locals []string `json:"locals"` //语言
CFBundleVersion string `json:"cfBundleVersion"` //内部版本
CFBundleShortVersionString string `json:"cfBundleShortVersionString"` //发布版本号版本
Copyright *string `json:"copyright"` //版权
Comments *string `json:"comments"` //exe详情描述
}
type Author struct {
Name string `json:"name"`
Email string `json:"email"`
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册