-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.bat
More file actions
61 lines (52 loc) · 1.78 KB
/
Copy pathbuild.bat
File metadata and controls
61 lines (52 loc) · 1.78 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
@echo off
setlocal enabledelayedexpansion
echo ===================================================
echo Phira-Render Build and Package Script
echo ===================================================
echo.
set "ROOT_DIR=%~dp0"
cd /d "%ROOT_DIR%"
echo [1/3] Building frontend assets (npm run build)...
call npm run build
if %ERRORLEVEL% neq 0 (
echo.
echo [ERROR] Frontend build failed. Please check your code.
pause
exit /b %ERRORLEVEL%
)
echo [OK] Frontend build succeeded.
echo.
echo [2/3] Setting up local Rust / Cargo environment...
set "RUSTUP_HOME=%ROOT_DIR%.rustup"
set "CARGO_HOME=%ROOT_DIR%.cargo"
if not exist "!CARGO_HOME!\bin\cargo.exe" (
if exist "%ROOT_DIR%..\..\.cargo\bin\cargo.exe" (
set "CARGO_HOME=%ROOT_DIR%..\..\.cargo"
set "RUSTUP_HOME=%ROOT_DIR%..\..\.rustup"
) else if exist "%ROOT_DIR%..\.cargo\bin\cargo.exe" (
set "CARGO_HOME=%ROOT_DIR%..\.cargo"
set "RUSTUP_HOME=%ROOT_DIR%..\.rustup"
)
)
if exist "!CARGO_HOME!\bin\cargo.exe" (
set "PATH=!CARGO_HOME!\bin;%PATH%"
)
echo [3/3] Building release binary (cargo build --release --features custom-protocol)...
cargo build --release --features custom-protocol --manifest-path "%ROOT_DIR%src-tauri\Cargo.toml"
if %ERRORLEVEL% neq 0 (
echo.
echo [ERROR] Rust backend build failed.
pause
exit /b %ERRORLEVEL%
)
if not exist "%ROOT_DIR%src-tauri\target\release\assets" (
echo Syncing assets directory...
xcopy /E /I /Y "%ROOT_DIR%src-tauri\assets" "%ROOT_DIR%src-tauri\target\release\assets" >nul
)
echo.
echo ===================================================
echo [SUCCESS] phira-render.exe built successfully!
echo Output: %ROOT_DIR%src-tauri\target\release\phira-render.exe
echo ===================================================
echo.
pause