diff --git a/.gitignore b/.gitignore index 4775b35..83c4de0 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,6 @@ playwright-report/ desktop/target/ desktop/python-embed/ desktop/frontend-static/ +desktop/backend/ +desktop/frontend/ diff --git a/desktop/build-windows.bat b/desktop/build-windows.bat index 9bdee72..464bbff 100644 --- a/desktop/build-windows.bat +++ b/desktop/build-windows.bat @@ -11,28 +11,26 @@ echo ======================================== echo. 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 echo. 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 tauri >nul 2>&1 || cargo install tauri-cli echo ✅ Rust + Tauri OK 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... 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 in embedded Python +REM Enable pip and site-packages + parent dir for 'import backend' 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 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 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/5] Building Tauri application... +echo [3/6] Building Tauri application... cargo tauri build --target x86_64-pc-windows-msvc --bundles msi,nsis if errorlevel 1 ( echo ❌ Build failed! - exit /b 1 + goto :cleanup ) echo ✅ Build successful -REM ── 4. Copier le runtime à côté de l'exécutable ─────────────── -echo [4/5] Copying runtime to output dir... +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 -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 "..\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 ✅ Runtime + frontend copied + sys.path fixed +echo ✅ Dev runtime ready -REM ── 5. Résultats ─────────────────────────────────────────────── -echo [5/5] Results: +: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. diff --git a/desktop/tauri.conf.json b/desktop/tauri.conf.json index b8bf978..77ef9a3 100644 --- a/desktop/tauri.conf.json +++ b/desktop/tauri.conf.json @@ -42,8 +42,8 @@ ], "resources": [ "python-embed/**/*", - "../backend/**/*", - "../frontend/**/*" + "backend/**/*", + "frontend/**/*" ], "fileAssociations": [ {