fix: bundle MSI — copier backend/frontend dans desktop/ avant build Tauri
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

- 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/
This commit is contained in:
2026-07-26 16:50:46 -04:00
parent bbf23df6ab
commit 004bf6f10b
3 changed files with 30 additions and 21 deletions
+2
View File
@@ -24,4 +24,6 @@ playwright-report/
desktop/target/ desktop/target/
desktop/python-embed/ desktop/python-embed/
desktop/frontend-static/ desktop/frontend-static/
desktop/backend/
desktop/frontend/
+26 -19
View File
@@ -11,28 +11,26 @@ echo ========================================
echo. echo.
REM ── 0. Kill any leftover backend from a previous run ────────── REM ── 0. Kill any leftover backend from a previous run ──────────
echo [0/5] Killing leftover Python processes... echo [0/6] Killing leftover Python processes...
taskkill /F /IM python.exe 2>nul taskkill /F /IM python.exe 2>nul
echo. echo.
REM ── 1. Vérifier les prérequis ───────────────────────────────── REM ── 1. Vérifier les prérequis ─────────────────────────────────
echo [1/5] Verifying prerequisites... echo [1/6] Verifying prerequisites...
where cargo >nul 2>&1 || (echo ❌ Rust/Cargo not found. Install from https://rustup.rs & exit /b 1) 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 where tauri >nul 2>&1 || cargo install tauri-cli
echo ✅ Rust + Tauri OK echo ✅ Rust + Tauri OK
REM ── 2. Préparer Python 3.11 embed ───────────────────────────── REM ── 2. Préparer Python 3.11 embed ─────────────────────────────
echo [2/5] Preparing Python embed... echo [2/6] Preparing Python embed...
echo 📥 Downloading Python 3.11 embed... echo 📥 Downloading Python 3.11 embed...
if exist "python-embed" rmdir /s /q "python-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" 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\ powershell Expand-Archive -Path python-embed.zip -DestinationPath python-embed\
del python-embed.zip del python-embed.zip
REM Enable pip and site-packages in embedded Python REM Enable pip and site-packages + parent dir for 'import backend'
echo import site >> python-embed\python311._pth echo import site >> python-embed\python311._pth
REM Add parent dir to Python path so 'import backend' works at runtime (for bundle)
echo ..>> python-embed\python311._pth echo ..>> python-embed\python311._pth
REM Download get-pip.py (embed Python doesn't include ensurepip) REM Download get-pip.py (embed Python doesn't include ensurepip)
@@ -45,31 +43,40 @@ REM Install dependencies
python-embed\python.exe -m pip install --no-cache-dir -r ..\backend\requirements.txt python-embed\python.exe -m pip install --no-cache-dir -r ..\backend\requirements.txt
echo ✅ Python embed ready 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 ──────────────────────────────────────────── REM ── 3. Build Tauri ────────────────────────────────────────────
echo [3/5] Building Tauri application... echo [3/6] Building Tauri application...
cargo tauri build --target x86_64-pc-windows-msvc --bundles msi,nsis cargo tauri build --target x86_64-pc-windows-msvc --bundles msi,nsis
if errorlevel 1 ( if errorlevel 1 (
echo ❌ Build failed! echo ❌ Build failed!
exit /b 1 goto :cleanup
) )
echo ✅ Build successful echo ✅ Build successful
REM ── 4. Copier le runtime à côté de l'exécutable ─────────────── REM ── 4. Copier python-embed vers output dir (dev local) ─────────
echo [4/5] Copying runtime to output dir... echo [4/6] Copying python-embed to output dir...
set "OUTDIR=target\x86_64-pc-windows-msvc\release" set "OUTDIR=target\x86_64-pc-windows-msvc\release"
if exist "%OUTDIR%\python-embed" rmdir /s /q "%OUTDIR%\python-embed" 2>nul if exist "%OUTDIR%\python-embed" rmdir /s /q "%OUTDIR%\python-embed" 2>nul
if exist "%OUTDIR%\backend" rmdir /s /q "%OUTDIR%\backend" 2>nul
if exist "%OUTDIR%\frontend" rmdir /s /q "%OUTDIR%\frontend" 2>nul
xcopy /E /I /Q /Y "python-embed" "%OUTDIR%\python-embed" xcopy /E /I /Q /Y "python-embed" "%OUTDIR%\python-embed"
xcopy /E /I /Q /Y "..\backend" "%OUTDIR%\backend"
xcopy /E /I /Q /Y "..\frontend" "%OUTDIR%\frontend"
REM Add parent directory to Python path so 'import backend' works at runtime
echo ..>> "%OUTDIR%\python-embed\python311._pth" echo ..>> "%OUTDIR%\python-embed\python311._pth"
echo ✅ Runtime + frontend copied + sys.path fixed echo ✅ Dev runtime ready
REM ── 5. Résultats ─────────────────────────────────────────────── :cleanup
echo [5/5] Results: 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\msi\*.msi" 2>nul
dir /b "%OUTDIR%\bundle\nsis\*.exe" 2>nul dir /b "%OUTDIR%\bundle\nsis\*.exe" 2>nul
echo. echo.
+2 -2
View File
@@ -42,8 +42,8 @@
], ],
"resources": [ "resources": [
"python-embed/**/*", "python-embed/**/*",
"../backend/**/*", "backend/**/*",
"../frontend/**/*" "frontend/**/*"
], ],
"fileAssociations": [ "fileAssociations": [
{ {