79 lines
2.6 KiB
Bash
79 lines
2.6 KiB
Bash
#!/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"
|