Skip to content

Commit

Permalink
添加 build 脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankFang committed Oct 13, 2021
1 parent 94f09a1 commit c98101f
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
*.log
/go-demo-*
/synk*
node_modules
node_modules
/build
*.syso
Binary file added macres/synk.icns
Binary file not shown.
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:generate go-winres make --product-version=git-tag
package main

import (
Expand Down
22 changes: 22 additions & 0 deletions scripts/build_for_mac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

APP="Synk.app"
mkdir -p build/$APP/Contents/MacOS
mkdir -p build/$APP/Contents/Resources
GOOS=darwin GOARCH=amd64 go build -o build/$APP/Contents/MacOS/synk
cat > build/$APP/Contents/Info.plist << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>synk</string>
<key>CFBundleIconFile</key>
<string>icon.icns</string>
<key>CFBundleIdentifier</key>
<string>com.fangyinghang.synk</string>
</dict>
</plist>
EOF
cp macres/synk.icns build/$APP/Contents/Resources/icon.icns
find build/$APP
4 changes: 4 additions & 0 deletions scripts/build_for_win.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version=$(git describe --tags $(git rev-list --tags='v[0-9].[0-9]*' --max-count=1))

go generate
GOOS=windows GOARCH=amd64 go build -ldflags "-H windowsgui" -o build/synk-${version}.exe
1 change: 1 addition & 0 deletions version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.0
Binary file added winres/synk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions winres/winres.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"RT_GROUP_ICON": {
"APP": {
"0000": [
"synk.png"
]
}
},
"RT_MANIFEST": {
"#1": {
"0409": {
"identity": {
"name": "synk"
},
"description": "局域网同步传",
"minimum-os": "win7",
"execution-level": "as invoker",
"ui-access": false,
"auto-elevate": false,
"dpi-awareness": "system",
"disable-theming": false,
"disable-window-filtering": false,
"high-resolution-scrolling-aware": false,
"ultra-high-resolution-scrolling-aware": false,
"long-path-aware": false,
"printer-driver-isolation": false,
"gdi-scaling": false,
"segment-heap": false,
"use-common-controls-v6": false
}
}
},
"RT_VERSION": {
"#1": {
"0000": {
"fixed": {
"file_version": "0.1.0.0",
"product_version": "0.1.0.0"
},
"info": {
"0409": {
"Comments": "",
"CompanyName": "方应杭",
"FileDescription": "",
"FileVersion": "",
"InternalName": "synk",
"LegalCopyright": "",
"LegalTrademarks": "",
"OriginalFilename": "",
"PrivateBuild": "",
"ProductName": "同步传",
"ProductVersion": "0.1.0",
"SpecialBuild": ""
}
}
}
}
}
}

0 comments on commit c98101f

Please sign in to comment.