@echo off
setlocal

if exist build rmdir /s /q build
if exist dist rmdir /s /q dist
if exist OandMProjectManager.spec del /q OandMProjectManager.spec
if exist __pycache__ rmdir /s /q __pycache__

python -m pip install -r requirements.txt
if errorlevel 1 (
  echo Failed to install dependencies.
  pause
  exit /b 1
)

python -m PyInstaller --clean --noconfirm --onefile --windowed --name OandMProjectManager app.py
if errorlevel 1 (
  echo Failed to build exe.
  pause
  exit /b 1
)

echo.
echo Build finished. Please check dist\OandMProjectManager.exe
pause
