Files
ObsiGate/desktop/build-windows.bat
T
bruno 004bf6f10b
CI / lint (push) Successful in 24s
CI / security (push) Successful in 14s
CI / test (push) Successful in 27s
CI / build (push) Successful in 6s
CI / e2e (push) Failing after 23s
Desktop Build / build-windows (push) Has been cancelled
Desktop Build / build-linux (push) Has been cancelled
fix: bundle MSI — copier backend/frontend dans desktop/ avant build Tauri
- tauri.conf.json: resources: backend/**/* + frontend/**/* (local, pas ../)
- build-windows.bat: étape 2b copie backend+frontend dans desktop/, clean après build
- .gitignore: desktop/backend/ + desktop/frontend/
2026-07-26 16:50:46 -04:00

85 lines
3.5 KiB
Batchfile

@echo off
REM ============================================================
REM ObsiGate Desktop — Build Windows (.msi + .exe)
REM Prérequis : Rust, Tauri CLI, NSIS, Python 3.11 embed
REM ============================================================
setlocal enabledelayedexpansion
echo ========================================
echo ObsiGate Desktop — Build Windows
echo ========================================
echo.
REM ── 0. Kill any leftover backend from a previous run ──────────
echo [0/6] Killing leftover Python processes...
taskkill /F /IM python.exe 2>nul
echo.
REM ── 1. Vérifier les prérequis ─────────────────────────────────
echo [1/6] Verifying prerequisites...
where cargo >nul 2>&1 || (echo ❌ Rust/Cargo not found. Install from https://rustup.rs & exit /b 1)
where tauri >nul 2>&1 || cargo install tauri-cli
echo ✅ Rust + Tauri OK
REM ── 2. Préparer Python 3.11 embed ─────────────────────────────
echo [2/6] Preparing Python embed...
echo 📥 Downloading Python 3.11 embed...
if exist "python-embed" rmdir /s /q "python-embed"
curl -L -o python-embed.zip "https://www.python.org/ftp/python/3.11.9/python-3.11.9-embed-amd64.zip"
powershell Expand-Archive -Path python-embed.zip -DestinationPath python-embed\
del python-embed.zip
REM Enable pip and site-packages + parent dir for 'import backend'
echo import site >> python-embed\python311._pth
echo ..>> python-embed\python311._pth
REM Download get-pip.py (embed Python doesn't include ensurepip)
echo 📥 Downloading get-pip.py...
curl -L -o get-pip.py "https://bootstrap.pypa.io/get-pip.py"
python-embed\python.exe get-pip.py --no-cache-dir
del get-pip.py
REM Install dependencies
python-embed\python.exe -m pip install --no-cache-dir -r ..\backend\requirements.txt
echo ✅ Python embed ready
REM ── 2b. Copier backend + frontend localement pour le bundle ────
echo [2b/6] Staging backend + frontend for bundle...
if exist "backend" rmdir /s /q "backend"
if exist "frontend" rmdir /s /q "frontend"
xcopy /E /I /Q /Y "..\backend" "backend"
xcopy /E /I /Q /Y "..\frontend" "frontend"
echo ✅ Staged
REM ── 3. Build Tauri ────────────────────────────────────────────
echo [3/6] Building Tauri application...
cargo tauri build --target x86_64-pc-windows-msvc --bundles msi,nsis
if errorlevel 1 (
echo ❌ Build failed!
goto :cleanup
)
echo ✅ Build successful
REM ── 4. Copier python-embed vers output dir (dev local) ─────────
echo [4/6] Copying python-embed to output dir...
set "OUTDIR=target\x86_64-pc-windows-msvc\release"
if exist "%OUTDIR%\python-embed" rmdir /s /q "%OUTDIR%\python-embed" 2>nul
xcopy /E /I /Q /Y "python-embed" "%OUTDIR%\python-embed"
echo ..>> "%OUTDIR%\python-embed\python311._pth"
echo ✅ Dev runtime ready
:cleanup
REM ── 5. Nettoyer les dossiers stagés ───────────────────────────
echo [5/6] Cleaning up staged dirs...
if exist "backend" rmdir /s /q "backend"
if exist "frontend" rmdir /s /q "frontend"
echo ✅ Cleaned
REM ── 6. Résultats ───────────────────────────────────────────────
echo [6/6] Results:
dir /b "%OUTDIR%\bundle\msi\*.msi" 2>nul
dir /b "%OUTDIR%\bundle\nsis\*.exe" 2>nul
echo.
echo ✅ Done! Check %OUTDIR%\bundle\
endlocal