统一命名规范为 <namespace>-<action>[-<variant>] 格式: - 重命名 desktop-mac/win/linux → desktop-build-mac/win/linux - 重命名 backend-migrate-* → backend-db-* - 重命名 frontend-build-desktop → desktop-prepare-frontend - 重命名 embedfs-prepare → desktop-prepare-embedfs - 重命名 package-macos → desktop-package-mac 新增顶层便捷命令: - dev: 并行启动开发环境 - build: 构建所有产物 - test: 运行所有测试 - lint: 检查所有代码 - clean: 清理所有构建产物
69 lines
2.1 KiB
Bash
Executable File
69 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
VERSION="1.0.0"
|
|
APP_NAME="Nex"
|
|
BUNDLE_ID="io.nex.gateway"
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
|
|
BUILD_DIR="${PROJECT_ROOT}/build"
|
|
ASSETS_DIR="${PROJECT_ROOT}/assets"
|
|
|
|
echo "打包 macOS .app..."
|
|
|
|
mkdir -p "${BUILD_DIR}/${APP_NAME}.app/Contents/MacOS"
|
|
mkdir -p "${BUILD_DIR}/${APP_NAME}.app/Contents/Resources"
|
|
|
|
if [ -f "${BUILD_DIR}/nex-mac-arm64" ]; then
|
|
cp "${BUILD_DIR}/nex-mac-arm64" "${BUILD_DIR}/${APP_NAME}.app/Contents/MacOS/nex"
|
|
elif [ -f "${BUILD_DIR}/nex-mac-amd64" ]; then
|
|
cp "${BUILD_DIR}/nex-mac-amd64" "${BUILD_DIR}/${APP_NAME}.app/Contents/MacOS/nex"
|
|
else
|
|
echo "错误: 未找到 macOS 二进制文件,请先运行 make desktop-build-mac"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -f "${ASSETS_DIR}/AppIcon.icns" ]; then
|
|
cp "${ASSETS_DIR}/AppIcon.icns" "${BUILD_DIR}/${APP_NAME}.app/Contents/Resources/"
|
|
else
|
|
echo "警告: 未找到 AppIcon.icns"
|
|
fi
|
|
|
|
cat > "${BUILD_DIR}/${APP_NAME}.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>CFBundleDevelopmentRegion</key>
|
|
<string>zh_CN</string>
|
|
<key>CFBundleExecutable</key>
|
|
<string>nex</string>
|
|
<key>CFBundleIconFile</key>
|
|
<string>AppIcon</string>
|
|
<key>CFBundleIdentifier</key>
|
|
<string>${BUNDLE_ID}</string>
|
|
<key>CFBundleInfoDictionaryVersion</key>
|
|
<string>6.0</string>
|
|
<key>CFBundleName</key>
|
|
<string>${APP_NAME} Gateway</string>
|
|
<key>CFBundleDisplayName</key>
|
|
<string>${APP_NAME} Gateway</string>
|
|
<key>CFBundlePackageType</key>
|
|
<string>APPL</string>
|
|
<key>CFBundleShortVersionString</key>
|
|
<string>${VERSION}</string>
|
|
<key>CFBundleVersion</key>
|
|
<string>${VERSION}</string>
|
|
<key>LSMinimumSystemVersion</key>
|
|
<string>10.13</string>
|
|
<key>LSUIElement</key>
|
|
<true/>
|
|
<key>NSHighResolutionCapable</key>
|
|
<true/>
|
|
</dict>
|
|
</plist>
|
|
EOF
|
|
|
|
chmod +x "${BUILD_DIR}/${APP_NAME}.app/Contents/MacOS/nex"
|
|
|
|
echo "打包完成: ${BUILD_DIR}/${APP_NAME}.app"
|