Complete C# server cutover

This commit is contained in:
Nomads_Reach
2026-08-16 02:36:32 -04:00
parent ddadf87423
commit 757e614cdd
79 changed files with 923 additions and 13129 deletions
+27 -79
View File
@@ -3,103 +3,51 @@ setlocal enabledelayedexpansion
echo.
echo ================================================================================
echo Commonwealth Online GUI - Qt6 DLL Deployment
echo Commonwealth Online - Qt Host Deployment
echo ================================================================================
echo.
REM Find Qt6 installation (prefer the newest match; do not overwrite).
set QT6_PATH=
if exist "C:\Qt\6.11.1\msvc2022_64\bin" (
set QT6_PATH=C:\Qt\6.11.1\msvc2022_64
) else if exist "C:\Qt\6.10.2\msvc2022_64\bin" (
set QT6_PATH=C:\Qt\6.10.2\msvc2022_64
) else if exist "C:\Qt\6.8.0\msvc2022_64\bin" (
set QT6_PATH=C:\Qt\6.8.0\msvc2022_64
)
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.
echo Please ensure Qt6 is installed to one of these paths:
echo - C:\Qt\6.11.1\msvc2022_64
echo - C:\Qt\6.10.2\msvc2022_64
echo - C:\Qt\6.8.0\msvc2022_64
pause
exit /b 1
)
echo Found Qt6 at: !QT6_PATH!
echo.
echo Deploying Qt6 DLLs to release directory...
echo.
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
)
REM Required DLLs
set DLLs=^
Qt6Core.dll ^
Qt6Gui.dll ^
Qt6Widgets.dll ^
Qt6Network.dll ^
Qt6Concurrent.dll ^
Qt6DBus.dll ^
Qt6Xml.dll
REM Copy DLLs
for %%D in (%DLLs%) do (
if exist "!QT6_PATH!\bin\%%D" (
echo Copying %%D...
copy /Y "!QT6_PATH!\bin\%%D" "!DEPLOY_DIR!\%%D" >nul
) else (
echo WARNING: %%D not found (may not be required)
)
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
)
REM Copy plugins directory
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
echo Copying Qt plugins...
xcopy /Y /Q "!QT6_PATH!\plugins\platforms" "!DEPLOY_DIR!\plugins\platforms\"
xcopy /Y /Q "!QT6_PATH!\plugins\styles" "!DEPLOY_DIR!\plugins\styles\" 2>nul
xcopy /Y /Q "!QT6_PATH!\plugins\imageformats" "!DEPLOY_DIR!\plugins\imageformats\" 2>nul
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
)
REM Stage Python relay server next to the executable (bundled from repo server\)
set SERVER_SRC=%cd%\server
set SERVER_DST=!DEPLOY_DIR!\server
set SERVER_CFG=!SERVER_DST!\commonwealth-server.json
set SERVER_CFG_BAK=%TEMP%\co-host-server-config.json
if exist "!SERVER_SRC!\consumer_server_cli.py" (
echo Copying Python server from "!SERVER_SRC!"...
if exist "!SERVER_CFG!" copy /Y "!SERVER_CFG!" "!SERVER_CFG_BAK!" >nul
if not exist "!SERVER_DST!" mkdir "!SERVER_DST!"
robocopy "!SERVER_SRC!" "!SERVER_DST!" /E /XD __pycache__ .pytest_cache /XF *.pyc /NFL /NDL /NJH /NJS /nc /ns /np
if errorlevel 8 (
echo WARNING: Failed to copy server directory from "!SERVER_SRC!"
) else (
if exist "!SERVER_CFG_BAK!" (
copy /Y "!SERVER_CFG_BAK!" "!SERVER_CFG!" >nul
del /Q "!SERVER_CFG_BAK!" >nul 2>&1
echo Preserved existing commonwealth-server.json
)
echo Server directory staged at: !SERVER_DST!
)
) else (
echo WARNING: Server source not found at "!SERVER_SRC!"
echo Expected repo-local server\consumer_server_cli.py.
echo Rebuild with CMake post-build copy, or copy server\ manually.
if exist "!SERVER_DIR!\*.py" (
echo ERROR: Python source found in staged server package.
exit /b 1
)
echo.
echo ================================================================================
echo Deployment Complete!
echo ================================================================================
echo.
echo Executable is now ready to run:
echo Deployment complete:
echo !DEPLOY_DIR!\CommonwealthOnlineHost.exe
echo !SERVER_DIR!\CommonwealthOnline.Server.exe
echo.
echo You can now:
echo 1. Double-click CommonwealthOnlineHost.exe to run
echo 2. Or copy the entire Release folder to another machine
echo 3. Include all DLLs, plugins\, and server\ when distributing
echo.
pause
echo Copy the entire Release directory when distributing. Python and a separate .NET runtime are not required.
exit /b 0