fix(desktop): 打包元数据还是 wails3 脚手架模板值,app 根本起不来

现象:wails3 package 出来的 .app 双击报「可执行文件不存在」,macOS 直接拒绝启动。

根因是我迁移 v3 时埋的:build/darwin/Info.plist 里 CFBundleExecutable 写着
"wails3ref"、bundle ID 是 "com.example.wails3ref",全是脚手架模板默认值,
而实际二进制叫 sundynix_desktop —— 对不上,macOS 认为 bundle 坏了。

我当时在 build/config.yml 里填了正确的产品信息(com.sundynix.agentix /
sundynix-agentix),但漏了那个文件顶部写明的一步:改了 info 要跑
`wails3 task common:update:build-assets` 重新生成资产。补跑之后不只 macOS,
Linux 的 desktop/nfpm、Windows 的 info.json/nsis/manifest 里的
"My Product"/"My Company"/"wails3ref" 也一并换成了真实产品信息 ——
这些留到打包分发才发现就麻烦了。

Assets.car/icons.icns 一并提交:体积变化大(1.63→2.03MB / 52→45KB)不是噪声,
是真被重新生成了;但逐像素比对确认图案没变(平均差 0.6/255),无回归。

顺带删掉重生成又造出来的 build/ios —— 项目是 desktop-only。这次它只有
plist/storyboard/pbxproj、没有 .go 文件,不会像当初那样让 go build ./... 挂掉,
但也没必要留。已验 go build ./... 通过。

已知待办(非本次引入):app 图标至今是 Wails 默认的 "W" logo,从没做过自定义。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Blizzard
2026-07-16 11:42:21 +08:00
parent bfbca08d72
commit d52af12f3d
9 changed files with 82 additions and 80 deletions
Binary file not shown.
+32 -31
View File
@@ -1,34 +1,35 @@
<?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>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleName</key>
<string>My Product</string>
<key>CFBundleExecutable</key>
<string>wails3ref</string>
<key>CFBundleIdentifier</key>
<string>com.example.wails3ref</string>
<key>CFBundleVersion</key>
<string>0.1.0</string>
<key>CFBundleGetInfoString</key>
<string>This is a comment</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<key>CFBundleIconFile</key>
<string>icons</string>
<key>CFBundleIconName</key>
<string>appicon</string>
<key>LSMinimumSystemVersion</key>
<string>12.0.0</string>
<key>NSHighResolutionCapable</key>
<string>true</string>
<key>NSHumanReadableCopyright</key>
<string>© 2026, My Company</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsLocalNetworking</key>
<true/>
</dict>
</dict>
<dict>
<key>CFBundleExecutable</key>
<string>sundynix_desktop</string>
<key>CFBundleGetInfoString</key>
<string>sundynix-agentix desktop</string>
<key>CFBundleIconFile</key>
<string>icons</string>
<key>CFBundleIconName</key>
<string>appicon</string>
<key>CFBundleIdentifier</key>
<string>com.sundynix.agentix</string>
<key>CFBundleName</key>
<string>sundynix-agentix</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<key>CFBundleVersion</key>
<string>0.1.0</string>
<key>LSMinimumSystemVersion</key>
<string>12.0.0</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsLocalNetworking</key>
<true/>
</dict>
<key>NSHighResolutionCapable</key>
<string>true</string>
<key>NSHumanReadableCopyright</key>
<string>(c) 2026, sundynix</string>
</dict>
</plist>
+27 -26
View File
@@ -1,29 +1,30 @@
<?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>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleName</key>
<string>My Product</string>
<key>CFBundleExecutable</key>
<string>wails3ref</string>
<key>CFBundleIdentifier</key>
<string>com.example.wails3ref</string>
<key>CFBundleVersion</key>
<string>0.1.0</string>
<key>CFBundleGetInfoString</key>
<string>This is a comment</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<key>CFBundleIconFile</key>
<string>icons</string>
<key>CFBundleIconName</key>
<string>appicon</string>
<key>LSMinimumSystemVersion</key>
<string>12.0.0</string>
<key>NSHighResolutionCapable</key>
<string>true</string>
<key>NSHumanReadableCopyright</key>
<string>© 2026, My Company</string>
</dict>
<dict>
<key>CFBundleExecutable</key>
<string>sundynix_desktop</string>
<key>CFBundleGetInfoString</key>
<string>sundynix-agentix desktop</string>
<key>CFBundleIconFile</key>
<string>icons</string>
<key>CFBundleIconName</key>
<string>appicon</string>
<key>CFBundleIdentifier</key>
<string>com.sundynix.agentix</string>
<key>CFBundleName</key>
<string>sundynix-agentix</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<key>CFBundleVersion</key>
<string>0.1.0</string>
<key>LSMinimumSystemVersion</key>
<string>12.0.0</string>
<key>NSHighResolutionCapable</key>
<string>true</string>
<key>NSHumanReadableCopyright</key>
<string>(c) 2026, sundynix</string>
</dict>
</plist>
Binary file not shown.
+5 -5
View File
@@ -1,13 +1,13 @@
[Desktop Entry]
Version=1.0
Name=My Product
Comment=A wails3ref application
Name=sundynix-agentix
Comment=事件驱动的 AI Agent 工作台
# The Exec line includes %u to pass the URL to the application
Exec=/usr/local/bin/wails3ref %u
Exec=/usr/local/bin/sundynix_desktop %u
Terminal=false
Type=Application
Icon=wails3ref
Icon=sundynix_desktop
Categories=Utility;
StartupWMClass=wails3ref
StartupWMClass=sundynix_desktop
+8 -8
View File
@@ -3,26 +3,26 @@
#
# The lines below are called `modelines`. See `:help modeline`
name: "wails3ref"
name: "sundynix_desktop"
arch: ${GOARCH}
platform: "linux"
version: "0.1.0"
section: "default"
priority: "extra"
maintainer: ${GIT_COMMITTER_NAME} <${GIT_COMMITTER_EMAIL}>
description: "A wails3ref application"
vendor: "My Company"
description: "事件驱动的 AI Agent 工作台"
vendor: "sundynix"
homepage: "https://wails.io"
license: "MIT"
release: "1"
contents:
- src: "./bin/wails3ref"
dst: "/usr/local/bin/wails3ref"
- src: "./bin/sundynix_desktop"
dst: "/usr/local/bin/sundynix_desktop"
- src: "./build/appicon.png"
dst: "/usr/share/icons/hicolor/128x128/apps/wails3ref.png"
- src: "./build/linux/wails3ref.desktop"
dst: "/usr/share/applications/wails3ref.desktop"
dst: "/usr/share/icons/hicolor/128x128/apps/sundynix_desktop.png"
- src: "./build/linux/sundynix_desktop.desktop"
dst: "/usr/share/applications/sundynix_desktop.desktop"
# Default dependencies for the GTK4 + WebKitGTK 6.0 stack (Ubuntu 24.04+ / Debian 13+)
depends:
+5 -5
View File
@@ -5,11 +5,11 @@
"info": {
"0000": {
"ProductVersion": "0.1.0",
"CompanyName": "My Company",
"FileDescription": "A wails3ref application",
"LegalCopyright": "© 2026, My Company",
"ProductName": "My Product",
"Comments": "This is a comment"
"CompanyName": "sundynix",
"FileDescription": "事件驱动的 AI Agent 工作台",
"LegalCopyright": "(c) 2026, sundynix",
"ProductName": "sundynix-agentix",
"Comments": "sundynix-agentix desktop"
}
}
}
@@ -5,19 +5,19 @@
!include "FileFunc.nsh"
!ifndef INFO_PROJECTNAME
!define INFO_PROJECTNAME "wails3ref"
!define INFO_PROJECTNAME "sundynix_desktop"
!endif
!ifndef INFO_COMPANYNAME
!define INFO_COMPANYNAME "My Company"
!define INFO_COMPANYNAME "sundynix"
!endif
!ifndef INFO_PRODUCTNAME
!define INFO_PRODUCTNAME "My Product"
!define INFO_PRODUCTNAME "sundynix-agentix"
!endif
!ifndef INFO_PRODUCTVERSION
!define INFO_PRODUCTVERSION "0.1.0"
!endif
!ifndef INFO_COPYRIGHT
!define INFO_COPYRIGHT "© 2026, My Company"
!define INFO_COPYRIGHT "(c) 2026, sundynix"
!endif
!ifndef PRODUCT_EXECUTABLE
!define PRODUCT_EXECUTABLE "${INFO_PROJECTNAME}.exe"
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity type="win32" name="com.example.wails3ref" version="0.1.0" processorArchitecture="*"/>
<assemblyIdentity type="win32" name="com.sundynix.agentix" version="0.1.0" processorArchitecture="*"/>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>