Repository navigation
Expand file tree
/
Copy pathsetup.bat
More file actions
258 lines (234 loc) · 10.8 KB
/
Copy pathsetup.bat
File metadata and controls
258 lines (234 loc) · 10.8 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
@echo off
setlocal enabledelayedexpansion
rem =========================================================================
rem ReclaimArc -- Universal Environment and Dependency Bootstrap for Windows
rem =========================================================================
echo.
echo +=======================================================================+
echo ^| RECLAIMARC DEPENDENCY BOOTSTRAP ^|
echo ^| Automated Toolchain, Compiler, and Runtime Environment Setup ^|
echo +=======================================================================+
echo.
cd /d "%~dp0"
set "ALL_DEPS_OK=1"
rem -------------------------------------------------------------------------
rem 1. Check Operating System Architecture
rem -------------------------------------------------------------------------
echo [1/6] Checking Operating System Architecture...
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
echo [*] Architecture: x86_64 [64-bit AMD/Intel] - Supported.
) else if "%PROCESSOR_ARCHITEW6432%"=="AMD64" (
echo [*] Architecture: x86_64 [WOW64] - Supported.
) else if "%PROCESSOR_ARCHITECTURE%"=="ARM64" (
echo [*] Architecture: ARM64 [Windows on ARM] - Supported.
) else (
echo [!] Architecture: %PROCESSOR_ARCHITECTURE% [32-bit x86 is not recommended].
)
echo [OK] Operating System check passed.
echo.
rem -------------------------------------------------------------------------
rem 2. Check Visual Studio C++ Build Tools (Required for UnRAR C++ compilation)
rem -------------------------------------------------------------------------
echo [2/6] Checking Visual Studio C++ Build Tools [MSVC]...
set "MSVC_FOUND=0"
rem Check via vswhere if installed
set "VSWHERE_PATH=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if not exist "%VSWHERE_PATH%" set "VSWHERE_PATH=%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"
if exist "%VSWHERE_PATH%" (
for /f "usebackq tokens=*" %%i in (`"%VSWHERE_PATH%" -latest -products * -property installationPath 2^>nul`) do (
if exist "%%i" (
set "MSVC_FOUND=1"
echo [*] Found MSVC Build Tools at: %%i
)
)
)
if "!MSVC_FOUND!"=="0" (
where cl.exe >nul 2>nul
if not errorlevel 1 (
set "MSVC_FOUND=1"
echo [*] Found cl.exe in current PATH.
)
)
if "!MSVC_FOUND!"=="1" (
echo [OK] Visual Studio C++ Build Tools are installed.
) else (
echo [MISSING] Visual Studio C++ Build Tools are required to compile the vendored C++ UnRAR core.
echo [*] Attempting automated installation via winget...
where winget >nul 2>nul
if not errorlevel 1 (
winget install --id Microsoft.VisualStudio.2022.BuildTools --override "--passive --wait --add Microsoft.VisualStudio.Workload.VCTools;includeRecommended" --accept-source-agreements --accept-package-agreements
if not errorlevel 1 (
echo [SUCCESS] Visual Studio C++ Build Tools installed successfully.
set "MSVC_FOUND=1"
) else (
echo [!] winget install failed. Please manually install C++ Build Tools from:
echo https://visualstudio.microsoft.com/visual-cpp-build-tools/
set "ALL_DEPS_OK=0"
)
) else (
echo [!] winget not found. Please manually install Visual Studio C++ Build Tools:
echo https://visualstudio.microsoft.com/visual-cpp-build-tools/
set "ALL_DEPS_OK=0"
)
)
echo.
rem -------------------------------------------------------------------------
rem 3. Check Rust Toolchain (rustc and cargo)
rem -------------------------------------------------------------------------
echo [3/6] Checking Rust Compiler and Cargo Package Manager...
set "RUST_FOUND=0"
where cargo.exe >nul 2>nul
if not errorlevel 1 (
for /f "tokens=*" %%v in ('rustc --version 2^>nul') do set "RUSTC_VER=%%v"
for /f "tokens=*" %%v in ('cargo --version 2^>nul') do set "CARGO_VER=%%v"
echo [*] !RUSTC_VER!
echo [*] !CARGO_VER!
echo [*] Note: ReclaimArc requires Rust 1.88.0+ (run 'rustup update' if outdated).
set "RUST_FOUND=1"
echo [OK] Rust toolchain is installed and active.
) else (
rem Check default user rustup location
if exist "%USERPROFILE%\.cargo\bin\cargo.exe" (
set "PATH=%USERPROFILE%\.cargo\bin;!PATH!"
set "RUST_FOUND=1"
echo [*] Found Cargo in %USERPROFILE%\.cargo\bin [added to session PATH].
echo [*] Note: ReclaimArc requires Rust 1.88.0+ (run 'rustup update' if outdated).
echo [OK] Rust toolchain is ready.
) else (
echo [MISSING] Rust compiler [rustc/cargo] not detected.
echo [*] Downloading official rustup installer...
set "RUSTUP_TMP=%TEMP%\rustup-init.exe"
powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (New-Object Net.WebClient).DownloadFile('https://win.rustup.rs/x86_64', '!RUSTUP_TMP!')" 2>nul
if exist "!RUSTUP_TMP!" (
echo [*] Running rustup-init [targeting stable-x86_64-pc-windows-msvc]...
"!RUSTUP_TMP!" -y --default-toolchain stable --default-host x86_64-pc-windows-msvc
del "!RUSTUP_TMP!" >nul 2>nul
if exist "%USERPROFILE%\.cargo\bin\cargo.exe" (
set "PATH=%USERPROFILE%\.cargo\bin;!PATH!"
set "RUST_FOUND=1"
echo [SUCCESS] Rust toolchain installed successfully.
) else (
echo [!] Rust installation failed. Please install from https://rustup.rs
set "ALL_DEPS_OK=0"
)
) else (
echo [!] Could not download rustup-init.exe. Please install Rust from https://rustup.rs
set "ALL_DEPS_OK=0"
)
)
)
echo.
rem -------------------------------------------------------------------------
rem 4. Check Node.js and npm (Required for Desktop GUI build)
rem -------------------------------------------------------------------------
echo [4/6] Checking Node.js and npm Runtime...
set "NODE_FOUND=0"
where node.exe >nul 2>nul
if not errorlevel 1 (
for /f "tokens=*" %%v in ('node --version 2^>nul') do set "NODE_VER=%%v"
for /f "tokens=*" %%v in ('npm --version 2^>nul') do set "NPM_VER=%%v"
echo [*] Node.js: !NODE_VER!
echo [*] npm: v!NPM_VER!
set "NODE_FOUND=1"
echo [OK] Node.js and npm are installed.
) else (
echo [MISSING] Node.js is required for building the desktop user interface.
echo [*] Attempting automated installation via winget...
where winget >nul 2>nul
if not errorlevel 1 (
winget install --id OpenJS.NodeJS.LTS -e --accept-source-agreements --accept-package-agreements
if not errorlevel 1 (
echo [SUCCESS] Node.js LTS installed. Refreshing PATH...
set "PATH=%ProgramFiles%\nodejs;%APPDATA%\npm;!PATH!"
set "NODE_FOUND=1"
) else (
echo [!] winget install failed. Please manually install Node.js LTS from: https://nodejs.org
set "ALL_DEPS_OK=0"
)
) else (
echo [!] winget not available. Please install Node.js LTS from https://nodejs.org
set "ALL_DEPS_OK=0"
)
)
echo.
rem -------------------------------------------------------------------------
rem 5. Check Microsoft Edge WebView2 Runtime (Required for Tauri 2 GUI)
rem -------------------------------------------------------------------------
echo [5/6] Checking Microsoft Edge WebView2 Runtime...
set "WEBVIEW2_FOUND=0"
rem Check Registry for WebView2 Runtime
reg query "HKLM\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" >nul 2>nul
if not errorlevel 1 set "WEBVIEW2_FOUND=1"
if "!WEBVIEW2_FOUND!"=="0" (
reg query "HKCU\Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" >nul 2>nul
if not errorlevel 1 set "WEBVIEW2_FOUND=1"
)
if "!WEBVIEW2_FOUND!"=="0" (
if exist "%ProgramFiles(x86)%\Microsoft\EdgeWebView\Application" set "WEBVIEW2_FOUND=1"
if exist "%ProgramFiles%\Microsoft\EdgeWebView\Application" set "WEBVIEW2_FOUND=1"
)
if "!WEBVIEW2_FOUND!"=="1" (
echo [*] WebView2 Runtime is active.
echo [OK] Windows desktop UI host runtime is ready.
) else (
echo [MISSING] Microsoft Edge WebView2 Evergreen Runtime not detected.
echo [*] Downloading Evergreen Bootstrapper...
set "WV2_TMP=%TEMP%\MicrosoftEdgeWebview2Setup.exe"
powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (New-Object Net.WebClient).DownloadFile('https://go.microsoft.com/fwlink/p/?LinkId=2124703', '!WV2_TMP!')" 2>nul
if exist "!WV2_TMP!" (
echo [*] Installing WebView2 Runtime silently...
"!WV2_TMP!" /silent /install
del "!WV2_TMP!" >nul 2>nul
echo [SUCCESS] WebView2 Runtime installed.
) else (
echo [!] Could not download WebView2 bootstrapper. Install manually from:
echo https://developer.microsoft.com/en-us/microsoft-edge/webview2/
)
)
echo.
rem -------------------------------------------------------------------------
rem 6. Initialize Desktop Frontend and Verify Cargo Dependencies
rem -------------------------------------------------------------------------
echo [6/6] Initializing Project Modules and Verifying Packages...
if exist "apps\desktop" (
if not exist "apps\desktop\node_modules" (
echo [*] Installing desktop frontend npm packages...
pushd apps\desktop
call npm install
if errorlevel 1 (
echo [!] npm install encountered errors.
set "ALL_DEPS_OK=0"
) else (
echo [OK] npm packages installed successfully.
)
popd
) else (
echo [OK] Desktop frontend packages already present [apps\desktop\node_modules].
)
)
if "!RUST_FOUND!"=="1" (
echo [*] Verifying Rust workspace crates...
cargo check --workspace --quiet
if not errorlevel 1 (
echo [OK] All 6 workspace crates verified and ready to build.
) else (
echo [!] Cargo workspace check failed. Inspect compiler logs.
set "ALL_DEPS_OK=0"
)
)
echo.
echo +=======================================================================+
if "!ALL_DEPS_OK!"=="1" (
echo ^| ENVIRONMENT SETUP COMPLETE: ALL SYSTEMS READY ^|
echo +=======================================================================+
echo.
echo You can now run:
echo run.bat -- Launch the desktop GUI or CLI
echo cargo test --workspace -- Run the automated 76-test suite
echo.
) else (
echo ^| SETUP FINISHED WITH WARNINGS: REVIEW MISSING ITEMS ABOVE ^|
echo +=======================================================================+
echo.
)
endlocal