Files
boss/scripts/build-boss-agent-mac-app.sh
2026-05-12 23:22:27 +08:00

79 lines
2.6 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/zsh
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
APP_DIR="$ROOT_DIR/dist/boss-agent.app"
CONTENTS_DIR="$APP_DIR/Contents"
MACOS_DIR="$CONTENTS_DIR/MacOS"
RESOURCES_DIR="$CONTENTS_DIR/Resources"
SOURCE_FILE="$ROOT_DIR/apps/boss-agent-mac/Sources/BossAgentApp.swift"
BINARY_PATH="$MACOS_DIR/boss-agent"
if ! command -v swiftc >/dev/null 2>&1; then
echo "swiftc not found. Install Xcode Command Line Tools first." >&2
exit 1
fi
rm -rf "$APP_DIR"
mkdir -p "$MACOS_DIR" "$RESOURCES_DIR"
swiftc "$SOURCE_FILE" \
-o "$BINARY_PATH" \
-framework Cocoa \
-framework WebKit \
-framework ApplicationServices \
-framework AVFoundation \
-framework Network \
-framework UserNotifications
chmod +x "$BINARY_PATH"
cat > "$CONTENTS_DIR/Info.plist" <<'PLIST'
<?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>boss-agent</string>
<key>CFBundleIdentifier</key>
<string>com.hyzq.boss.agent</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>boss-agent</string>
<key>CFBundleDisplayName</key>
<string>boss-agent</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>13.0</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSAppleEventsUsageDescription</key>
<string>boss-agent 需要通过自动化控制 Finder、浏览器和授权的企业应用以完成远程桌面级任务。</string>
<key>NSScreenCaptureUsageDescription</key>
<string>boss-agent 需要读取屏幕画面,用于识别桌面状态、系统弹窗和远程控制结果。</string>
<key>NSMicrophoneUsageDescription</key>
<string>boss-agent 需要麦克风权限,用于语音协作和远程指令输入。</string>
<key>NSCameraUsageDescription</key>
<string>boss-agent 需要摄像头权限,用于视觉协作和现场画面确认。</string>
<key>NSLocalNetworkUsageDescription</key>
<string>boss-agent 需要访问本地网络,用于发现和连接局域网设备、开发板和企业内网服务。</string>
<key>NSBonjourServices</key>
<array>
<string>_http._tcp</string>
<string>_boss-agent._tcp</string>
</array>
</dict>
</plist>
PLIST
plutil -lint "$CONTENTS_DIR/Info.plist" >/dev/null
echo "$APP_DIR"