diff --git a/deploy.bat b/deploy.bat index 4cf54e6..8e01dbb 100644 --- a/deploy.bat +++ b/deploy.bat @@ -1,53 +1,57 @@ -@echo off -setlocal enabledelayedexpansion - -echo. -echo ================================================================================ -echo Commonwealth Online - Qt Host Deployment -echo ================================================================================ -echo. - -set QT6_PATH= -if exist "C:\Qt\6.11.1\msvc2022_64\bin" set QT6_PATH=C:\Qt\6.11.1\msvc2022_64 -if "!QT6_PATH!"=="" if exist "C:\Qt\6.10.2\msvc2022_64\bin" set QT6_PATH=C:\Qt\6.10.2\msvc2022_64 -if "!QT6_PATH!"=="" if exist "C:\Qt\6.8.0\msvc2022_64\bin" set QT6_PATH=C:\Qt\6.8.0\msvc2022_64 -if "!QT6_PATH!"=="" ( - echo ERROR: Could not find Qt6 installation. - exit /b 1 -) - -set DEPLOY_DIR=%cd%\build\bin\Release -if not exist "!DEPLOY_DIR!\CommonwealthOnlineHost.exe" ( - echo ERROR: Host executable not found. Run build.bat first. - exit /b 1 -) - -set DLLS=Qt6Core.dll Qt6Gui.dll Qt6Widgets.dll Qt6Network.dll Qt6Concurrent.dll Qt6DBus.dll Qt6Xml.dll -for %%D in (%DLLS%) do ( - if exist "!QT6_PATH!\bin\%%D" copy /Y "!QT6_PATH!\bin\%%D" "!DEPLOY_DIR!\%%D" >nul -) - -if not exist "!DEPLOY_DIR!\plugins" mkdir "!DEPLOY_DIR!\plugins" -xcopy /Y /Q /I "!QT6_PATH!\plugins\platforms" "!DEPLOY_DIR!\plugins\platforms\" >nul -xcopy /Y /Q /I "!QT6_PATH!\plugins\styles" "!DEPLOY_DIR!\plugins\styles\" >nul 2>&1 -xcopy /Y /Q /I "!QT6_PATH!\plugins\imageformats" "!DEPLOY_DIR!\plugins\imageformats\" >nul 2>&1 - -set SERVER_DIR=!DEPLOY_DIR!\server -if not exist "!SERVER_DIR!\CommonwealthOnline.Server.exe" ( - echo ERROR: Self-contained C# server is not staged beside the Host GUI. - echo Run build.bat. CMake publishes the server during the Host GUI build. - exit /b 1 -) - -if exist "!SERVER_DIR!\*.py" ( - echo ERROR: Python source found in staged server package. - exit /b 1 -) - -echo. -echo Deployment complete: -echo !DEPLOY_DIR!\CommonwealthOnlineHost.exe -echo !SERVER_DIR!\CommonwealthOnline.Server.exe -echo. -echo Copy the entire Release directory when distributing. Python and a separate .NET runtime are not required. -exit /b 0 +@echo off +setlocal enabledelayedexpansion + +echo. +echo ================================================================================ +echo Commonwealth Online - Qt Host Deployment +echo ================================================================================ +echo. + +set QT6_PATH= +if exist "C:\Qt\6.11.1\msvc2022_64\bin" set QT6_PATH=C:\Qt\6.11.1\msvc2022_64 +if "!QT6_PATH!"=="" if exist "C:\Qt\6.10.2\msvc2022_64\bin" set QT6_PATH=C:\Qt\6.10.2\msvc2022_64 +if "!QT6_PATH!"=="" if exist "C:\Qt\6.8.0\msvc2022_64\bin" set QT6_PATH=C:\Qt\6.8.0\msvc2022_64 +if "!QT6_PATH!"=="" ( + echo ERROR: Could not find Qt6 installation. + exit /b 1 +) + +set DEPLOY_DIR=%cd%\build\bin\Release +if not exist "!DEPLOY_DIR!\CommonwealthOnlineHost.exe" ( + echo ERROR: Host executable not found. Run build.bat first. + exit /b 1 +) + +set DLLS=Qt6Core.dll Qt6Gui.dll Qt6Widgets.dll Qt6Network.dll Qt6Concurrent.dll Qt6DBus.dll Qt6Xml.dll +for %%D in (%DLLS%) do ( + if exist "!QT6_PATH!\bin\%%D" copy /Y "!QT6_PATH!\bin\%%D" "!DEPLOY_DIR!\%%D" >nul +) + +if not exist "!DEPLOY_DIR!\plugins" mkdir "!DEPLOY_DIR!\plugins" +xcopy /Y /Q /I "!QT6_PATH!\plugins\platforms" "!DEPLOY_DIR!\plugins\platforms\" >nul +xcopy /Y /Q /I "!QT6_PATH!\plugins\styles" "!DEPLOY_DIR!\plugins\styles\" >nul 2>&1 +xcopy /Y /Q /I "!QT6_PATH!\plugins\imageformats" "!DEPLOY_DIR!\plugins\imageformats\" >nul 2>&1 + +set SERVER_DIR=!DEPLOY_DIR!\server +if not exist "!SERVER_DIR!\CommonwealthOnline.Server.exe" ( + echo ERROR: Self-contained C# server is not staged beside the Host GUI. + echo Run build.bat. CMake publishes the server during the Host GUI build. + exit /b 1 +) + +set PROHIBITED_FOUND=0 +for /r "!SERVER_DIR!" %%F in (*.py *.pyw *.pyi *.pyc *.pyo *.whl *.egg requirements*.txt Pipfile Pipfile.lock pyproject.toml poetry.lock setup.py setup.cfg tox.ini) do ( + if exist "%%F" ( + echo ERROR: Prohibited legacy runtime artifact found in staged package: %%F + set PROHIBITED_FOUND=1 + ) +) +if "!PROHIBITED_FOUND!"=="1" exit /b 1 + +echo. +echo Deployment complete: +echo !DEPLOY_DIR!\CommonwealthOnlineHost.exe +echo !SERVER_DIR!\CommonwealthOnline.Server.exe +echo. +echo Copy the entire Release directory when distributing. The bundled server is self-contained. +exit /b 0