-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-release-mac.sh
More file actions
114 lines (102 loc) · 3.08 KB
/
build-release-mac.sh
File metadata and controls
114 lines (102 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/usr/bin/env zsh
# Void Release Build Script
# Purpose: Build a production-ready release of Void for macOS
echo "========================================"
echo " Void Release Builder"
echo "========================================"
echo ""
# Check Xcode Command Line Tools (macOS equivalent of VS Build Tools)
echo "[Pre-check] Looking for Xcode Command Line Tools..."
if ! xcode-select -p &>/dev/null; then
echo "Warning: Xcode Command Line Tools not found!"
echo "Please install via: xcode-select --install"
echo ""
read -r "REPLY?Continue anyway? (y/n): "
if [[ "$REPLY" != "y" ]]; then
exit 1
fi
else
echo "Found Xcode tools at: $(xcode-select -p)"
fi
echo ""
# Step 1: Configure environment
echo "[1/5] Configuring environment..."
NODE_VERSION=$(node --version 2>/dev/null)
if [[ $? -ne 0 ]]; then
echo "Error: Node.js not found. Please install Node.js v20.18.2 via 'sudo n 20.18.2'"
exit 1
fi
REQUIRED="v20.18.2"
if [[ "$NODE_VERSION" != "$REQUIRED" ]]; then
echo "Switching to Node.js $REQUIRED via n..."
sudo n 20.18.2
fi
NODE_VERSION=$(node --version)
echo "Node.js version: $NODE_VERSION"
echo ""
# Step 2: Build React components
echo "[2/5] Building React components..."
NODE_OPTIONS="--max-old-space-size=8192" npm run buildreact
if [[ $? -ne 0 ]]; then
echo "Error: React build failed"
exit 1
fi
echo ""
# Step 3: Compile TypeScript
echo "[3/5] Compiling TypeScript..."
npm run compile
if [[ $? -ne 0 ]]; then
echo "Error: TypeScript compilation failed"
exit 1
fi
echo ""
# Step 4: Set build options
echo "[4/5] Setting build options..."
export NODE_OPTIONS="--max-old-space-size=8192"
echo "Memory limit set to 8GB"
echo ""
# Step 5: Build release for macOS (auto-detect arch)
echo "[5/5] Building macOS release..."
echo "This may take 20-30 minutes. Please be patient..."
echo ""
ARCH=$(uname -m)
if [[ "$ARCH" == "arm64" ]]; then
BUILD_TARGET="vscode-darwin-arm64"
echo "Detected Apple Silicon (arm64), building for darwin-arm64..."
else
BUILD_TARGET="vscode-darwin-x64"
echo "Detected Intel (x64), building for darwin-x64..."
fi
npm run gulp $BUILD_TARGET
# Check result
if [[ $? -eq 0 ]]; then
echo ""
echo "========================================"
echo " Build Successful!"
echo "========================================"
echo ""
OUTPUT_DIR="../VSCode-${BUILD_TARGET#vscode-}"
echo "Output location: $OUTPUT_DIR"
echo ""
if [[ -d "$OUTPUT_DIR" ]]; then
echo "Build contents:"
ls -lh "$OUTPUT_DIR"
echo ""
APP_NAME=$(ls "$OUTPUT_DIR" | grep "\.app$" | head -1)
if [[ -n "$APP_NAME" ]]; then
echo "To run: open $OUTPUT_DIR/$APP_NAME"
fi
fi
else
echo ""
echo "========================================"
echo " Build Failed!"
echo "========================================"
echo ""
echo "Please check the error messages above."
echo "Common issues:"
echo " - Xcode Command Line Tools not installed"
echo " - Insufficient disk space (need 10GB+)"
echo " - Network connectivity issues"
exit 1
fi