improved build_win_premake.bat, package_win.bat, rebuild_win.bat and recreate_venv_win.bat and and fixed a sign_helper error that didn't find the input file

This commit is contained in:
Sak32009 2024-08-25 11:30:19 +02:00
parent 85335e7628
commit 5700a5f886
8 changed files with 316 additions and 300 deletions

View File

@ -21,7 +21,7 @@ set /a "BUILD_DEPS=0"
) else if "%~1" equ "--help" ( ) else if "%~1" equ "--help" (
goto :help_page goto :help_page
) else ( ) else (
1>&2 echo: invalid arg %~1 1>&2 echo:invalid arg %~1
goto :end_script_with_err goto :end_script_with_err
) )
@ -32,15 +32,14 @@ set /a "BUILD_DEPS=0"
:: check premake :: check premake
set "PREMAKE_EXE=third-party\common\win\premake\premake5.exe" set "PREMAKE_EXE=third-party\common\win\premake\premake5.exe"
if not exist "%PREMAKE_EXE%" ( if not exist "%PREMAKE_EXE%" (
1>&2 echo: premake wasn't found 1>&2 echo:premake wasn't found
goto :end_script_with_err goto :end_script_with_err
) )
:: build deps :: build deps
if %BUILD_DEPS% equ 1 ( if %BUILD_DEPS% equ 1 (
set "CMAKE_GENERATOR=Visual Studio 17 2022" set "CMAKE_GENERATOR=Visual Studio 17 2022"
call "%PREMAKE_EXE%" --file="premake5-deps.lua" --64-build --32-build --all-ext --all-build --j=2 --verbose --clean --os=windows vs2022 call "%PREMAKE_EXE%" --file="premake5-deps.lua" --64-build --32-build --all-ext --all-build --j=2 --verbose --clean --os=windows vs2022 || (
if !errorlevel! neq 0 (
goto :end_script_with_err goto :end_script_with_err
) )
goto :end_script goto :end_script
@ -49,7 +48,7 @@ set /a "BUILD_DEPS=0"
:: check vswhere :: check vswhere
set "VSWHERE_EXE=third-party\common\win\vswhere\vswhere.exe" set "VSWHERE_EXE=third-party\common\win\vswhere\vswhere.exe"
if not exist "%VSWHERE_EXE%" ( if not exist "%VSWHERE_EXE%" (
1>&2 echo: vswhere wasn't found 1>&2 echo:vswhere wasn't found
goto :end_script_with_err goto :end_script_with_err
) )
@ -59,20 +58,19 @@ set /a "BUILD_DEPS=0"
set "MSBUILD_EXE=%%~A\MSBuild\Current\Bin\MSBuild.exe" set "MSBUILD_EXE=%%~A\MSBuild\Current\Bin\MSBuild.exe"
) )
if not exist "%MSBUILD_EXE%" ( if not exist "%MSBUILD_EXE%" (
1>&2 echo: MSBuild wasn't found 1>&2 echo:MSBuild wasn't found
goto :end_script_with_err goto :end_script_with_err
) )
:: create .sln :: create .sln
call "%PREMAKE_EXE%" --file="premake5.lua" --genproto --dosstub --winrsrc --winsign --os=windows vs2022 call "%PREMAKE_EXE%" --file="premake5.lua" --genproto --dosstub --winrsrc --winsign --os=windows vs2022 || (
if %errorlevel% neq 0 (
goto :end_script_with_err goto :end_script_with_err
) )
:: check .sln :: check .sln
set "SLN_FILE=build\project\vs2022\win\gbe.sln" set "SLN_FILE=build\project\vs2022\win\gbe.sln"
if not exist "%SLN_FILE%" ( if not exist "%SLN_FILE%" (
1>&2 echo: .sln file wasn't found 1>&2 echo:.sln file wasn't found
goto :end_script_with_err goto :end_script_with_err
) )
@ -87,9 +85,8 @@ set /a "BUILD_DEPS=0"
set "BUILD_PLATFORM=%%B" set "BUILD_PLATFORM=%%B"
for %%C in (%BUILD_TARGETS%) do ( for %%C in (%BUILD_TARGETS%) do (
set "BUILD_TARGET=%%C" set "BUILD_TARGET=%%C"
echo. & echo: building !BUILD_TARGET! !BUILD_TYPE! !BUILD_PLATFORM! echo. & echo:building !BUILD_TARGET! !BUILD_TYPE! !BUILD_PLATFORM!
call "%MSBUILD_EXE%" /nologo -m:%MAX_THREADS% -v:n /p:Configuration=!BUILD_TYPE!,Platform=!BUILD_PLATFORM! /target:!BUILD_TARGET! "%SLN_FILE%" call "%MSBUILD_EXE%" /nologo -m:%MAX_THREADS% -v:n /p:Configuration=!BUILD_TYPE!,Platform=!BUILD_PLATFORM! /target:!BUILD_TARGET! "%SLN_FILE%" || (
if !errorlevel! neq 0 (
goto :end_script_with_err goto :end_script_with_err
) )
) )
@ -98,20 +95,18 @@ set /a "BUILD_DEPS=0"
goto :end_script goto :end_script
:: exit without error
:end_script :end_script
endlocal endlocal
exit /b 0 exit /b 0
:: exit with error
:end_script_with_err :end_script_with_err
endlocal endlocal
exit /b 1 exit /b 1
:: show help page :: show help page
:help_page :help_page
echo: "%~nx0" [switches] echo:"%~nx0" [switches]
echo: switches: echo:switches:
echo: --deps: rebuild third-party dependencies echo: --deps: rebuild third-party dependencies
echo: --help: show this page echo: --help: show this page
goto :end_script goto :end_script

View File

@ -11,17 +11,18 @@ if defined NUMBER_OF_PROCESSORS (
) )
) )
set "BUILD_DIR=build\win" set "ROOT=%cd%"
set "OUT_DIR=build\package\win" set "BUILD_DIR=%ROOT%\build\win"
set "OUT_DIR=%ROOT%\build\package\win"
if "%~1" equ "" ( if "%~1" equ "" (
1>&2 echo: missing build target folder arg 1>&2 echo:missing build target folder arg
goto :end_script_with_err goto :end_script_with_err
) )
set "TARGET_DIR=%BUILD_DIR%\%~1" set "TARGET_DIR=%BUILD_DIR%\%~1"
if not exist "%TARGET_DIR%\" ( if not exist "%TARGET_DIR%\" (
1>&2 echo: build target folder wasn't found 1>&2 echo:build target folder wasn't found
goto :end_script_with_err goto :end_script_with_err
) )
@ -34,39 +35,39 @@ set /a "PKG_EXE_MEM_PERCENT=90"
set /a "PKG_EXE_DICT_SIZE_MB=384" set /a "PKG_EXE_DICT_SIZE_MB=384"
set "PKG_EXE=third-party\deps\win\7za\7za.exe" set "PKG_EXE=third-party\deps\win\7za\7za.exe"
if not exist "%PKG_EXE%" ( if not exist "%PKG_EXE%" (
1>&2 echo: packager wasn't found 1>&2 echo:packager wasn't found
goto :end_script_with_err goto :end_script_with_err
) )
:::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::::
echo: // copying readmes + example files echo:// copying readmes + example files
xcopy /y /s /e /r "post_build\steam_settings.EXAMPLE\" "%TARGET_DIR%\steam_settings.EXAMPLE\" xcopy /y /s /e /r "%ROOT%\post_build\steam_settings.EXAMPLE\" "%TARGET_DIR%\steam_settings.EXAMPLE\"
copy /y "post_build\README.release.md" "%TARGET_DIR%\" copy /y "%ROOT%\post_build\README.release.md" "%TARGET_DIR%\"
copy /y "CHANGELOG.md" "%TARGET_DIR%\" copy /y "%ROOT%\CHANGELOG.md" "%TARGET_DIR%\"
copy /y "CREDITS.md" "%TARGET_DIR%\" copy /y "%ROOT%\CREDITS.md" "%TARGET_DIR%\"
if %BUILD_DEBUG% equ 1 ( if %BUILD_DEBUG% equ 1 (
copy /y "post_build\README.debug.md" "%TARGET_DIR%\" copy /y "%ROOT%\post_build\README.debug.md" "%TARGET_DIR%\"
) )
if exist "%TARGET_DIR%\experimental\" ( if exist "%TARGET_DIR%\experimental\" (
copy /y "post_build\README.experimental.md" "%TARGET_DIR%\experimental\" copy /y "%ROOT%\post_build\README.experimental.md" "%TARGET_DIR%\experimental\"
) )
if exist "%TARGET_DIR%\steamclient_experimental\" ( if exist "%TARGET_DIR%\steamclient_experimental\" (
xcopy /y /s /e /r "post_build\win\ColdClientLoader.EXAMPLE\" "%TARGET_DIR%\steamclient_experimental\dll_injection.EXAMPLE\" xcopy /y /s /e /r "%ROOT%\post_build\win\ColdClientLoader.EXAMPLE\" "%TARGET_DIR%\steamclient_experimental\dll_injection.EXAMPLE\"
copy /y "post_build\README.experimental_steamclient.md" "%TARGET_DIR%\steamclient_experimental\" copy /y "%ROOT%\post_build\README.experimental_steamclient.md" "%TARGET_DIR%\steamclient_experimental\"
copy /y "tools\steamclient_loader\win\ColdClientLoader.ini" "%TARGET_DIR%\steamclient_experimental\" copy /y "%ROOT%\tools\steamclient_loader\win\ColdClientLoader.ini" "%TARGET_DIR%\steamclient_experimental\"
) )
if exist "%TARGET_DIR%\tools\generate_interfaces\" ( if exist "%TARGET_DIR%\tools\generate_interfaces\" (
copy /y "post_build\README.generate_interfaces.md" "%TARGET_DIR%\tools\generate_interfaces\" copy /y "%ROOT%\post_build\README.generate_interfaces.md" "%TARGET_DIR%\tools\generate_interfaces\"
) )
if exist "%TARGET_DIR%\tools\lobby_connect\" ( if exist "%TARGET_DIR%\tools\lobby_connect\" (
copy /y "post_build\README.lobby_connect.md" "%TARGET_DIR%\tools\lobby_connect\" copy /y "%ROOT%\post_build\README.lobby_connect.md" "%TARGET_DIR%\tools\lobby_connect\"
) )
:::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::::
@ -88,19 +89,16 @@ if exist "%ACHIVE_FILE%" (
del /f /s /q "%ACHIVE_FILE%" del /f /s /q "%ACHIVE_FILE%"
) )
call "%PKG_EXE%" a "%ACHIVE_FILE%" ".\%TARGET_DIR%" -t7z -xr^^!*.lib -xr^^!*.exp -slp -ssw -mx -myx -mmemuse=p%PKG_EXE_MEM_PERCENT% -ms=on -mqs=off -mf=on -mhc+ -mhe- -m0=LZMA2:d=%PKG_EXE_DICT_SIZE_MB%m -mmt=%MAX_THREADS% -mmtf+ -mtm- -mtc- -mta- -mtr+ call "%PKG_EXE%" a "%ACHIVE_FILE%" "%TARGET_DIR%" -t7z -xr^^!*.lib -xr^^!*.exp -slp -ssw -mx -myx -mmemuse=p%PKG_EXE_MEM_PERCENT% -ms=on -mqs=off -mf=on -mhc+ -mhe- -m0=LZMA2:d=%PKG_EXE_DICT_SIZE_MB%m -mmt=%MAX_THREADS% -mmtf+ -mtm- -mtc- -mta- -mtr+ || (
if %errorlevel% neq 0 (
goto :end_script_with_err goto :end_script_with_err
) )
goto :end_script goto :end_script
:: exit without error
:end_script :end_script
endlocal endlocal
exit /b 0 exit /b 0
:: exit with error
:end_script_with_err :end_script_with_err
endlocal endlocal
exit /b 1 exit /b 1

View File

@ -1,48 +1,52 @@
@echo off @echo off
setlocal EnableDelayedExpansion
cd /d "%~dp0"
setlocal set /a "MAX_THREADS=2"
pushd "%~dp0"
set /a last_code=0
set "build_dir=bin\win"
set "out_dir=bin\package\win"
set /a MEM_PERCENT=90
set /a DICT_SIZE_MB=384
set "packager=..\..\third-party\deps\win\7za\7za.exe"
:: use 70%
if defined NUMBER_OF_PROCESSORS ( if defined NUMBER_OF_PROCESSORS (
set /a THREAD_COUNT=NUMBER_OF_PROCESSORS*70/100 :: use 70%
) else ( set /a "MAX_THREADS=%NUMBER_OF_PROCESSORS% * 70 / 100"
set /a THREAD_COUNT=2 if %MAX_THREADS% lss 1 (
set /a "MAX_THREADS=1"
)
) )
if not exist "%packager%" ( set "ROOT=%cd%"
1>&2 echo "[X] packager app wasn't found" set "BUILD_DIR=%ROOT%\bin\win"
set /a last_code=1 set "OUT_DIR=%ROOT%\bin\package\win"
goto :script_end
set /a "PKG_EXE_MEM_PERCENT=90"
set /a "PKG_EXE_DICT_SIZE_MB=384"
set "PKG_EXE=..\..\third-party\deps\win\7za\7za.exe"
if not exist "%PKG_EXE%" (
1>&2 echo:packager wasn't found
goto :end_script_with_err
) )
if not exist "%build_dir%" ( if not exist "%BUILD_DIR%" (
1>&2 echo "[X] build folder wasn't found" 1>&2 echo:build folder wasn't found
set /a last_code=1 goto :end_script_with_err
goto :script_end
) )
mkdir "%out_dir%" if not exist "%OUT_DIR%" (
mkdir "%OUT_DIR%"
set "archive_file=%out_dir%\generate_emu_config-win.7z"
if exist "%archive_file%" (
del /f /q "%archive_file%"
) )
"%packager%" a "%archive_file%" ".\%build_dir%\*" -t7z -slp -ssw -mx -myx -mmemuse=p%MEM_PERCENT% -ms=on -mqs=off -mf=on -mhc+ -mhe- -m0=LZMA2:d=%DICT_SIZE_MB%m -mmt=%THREAD_COUNT% -mmtf+ -mtm- -mtc- -mta- -mtr+ set "ACHIVE_FILE=%OUT_DIR%\generate_emu_config-win.7z"
if exist "%ACHIVE_FILE%" (
del /f /s /q "%ACHIVE_FILE%"
:script_end
popd
endlocal & (
exit /b %last_code%
) )
call "%PKG_EXE%" a "%ACHIVE_FILE%" "%BUILD_DIR%\*" -t7z -slp -ssw -mx -myx -mmemuse=p%PKG_EXE_MEM_PERCENT% -ms=on -mqs=off -mf=on -mhc+ -mhe- -m0=LZMA2:d=%PKG_EXE_DICT_SIZE_MB%m -mmt=%MAX_THREADS% -mmtf+ -mtm- -mtc- -mta- -mtr+ || (
goto :end_script_with_err
)
goto :end_script
:end_script
endlocal
exit /b 0
:end_script_with_err
endlocal
exit /b 1

View File

@ -1,74 +1,71 @@
@echo off @echo off
setlocal EnableDelayedExpansion
cd /d "%~dp0"
setlocal set "ROOT=%cd%"
pushd "%~dp0" set "VENV=%ROOT%\.env-win"
set "OUT_DIR=%ROOT%\bin\win"
set "BUILD_TEMP_DIR=%ROOT%\bin\tmp\win"
set "ICON_FILE=%ROOT%\icon\Froyoshark-Enkel-Steam.ico"
set "venv=.env-win" set /a "LAST_ERR_CODE=0"
set "out_dir=bin\win"
set "build_temp_dir=bin\tmp\win"
:: relative to build_temp_dir
set "icon_file=..\..\..\icon\Froyoshark-Enkel-Steam.ico"
set "signer_tool=..\..\third-party\build\win\cert\sign_helper.bat"
set /a last_code=0 set "SIGNER_TOOL=..\..\third-party\build\win\cert\sign_helper.bat"
if not exist "%SIGNER_TOOL%" (
if not exist "%signer_tool%" ( 1>&2 echo:signing tool wasn't found
1>&2 echo "[X] signing tool wasn't found" set /a "LAST_ERR_CODE=1"
set /a last_code=1 goto :end_script
goto :script_end
) )
if exist "%out_dir%" ( if exist "%OUT_DIR%" (
rmdir /s /q "%out_dir%" rmdir /s /q "%OUT_DIR%"
) )
mkdir "%out_dir%" mkdir "%OUT_DIR%"
if exist "%build_temp_dir%" ( if exist "%BUILD_TEMP_DIR%" (
rmdir /s /q "%build_temp_dir%" rmdir /s /q "%BUILD_TEMP_DIR%"
) )
del /f /q "*.spec" call "%VENV%\Scripts\activate.bat"
call "%venv%\Scripts\activate.bat" echo:building generate_emu_config...
pyinstaller "generate_emu_config.py" --distpath "%OUT_DIR%" -y --clean --onedir --name "generate_emu_config" --noupx --console -i "%ICON_FILE%" --collect-submodules "steam" --workpath "%BUILD_TEMP_DIR%" --specpath "%BUILD_TEMP_DIR%" || (
echo building generate_emu_config... set /a "LAST_ERR_CODE=1"
pyinstaller "generate_emu_config.py" --distpath "%out_dir%" -y --clean --onedir --name "generate_emu_config" --noupx --console -i "%icon_file%" --collect-submodules "steam" --workpath "%build_temp_dir%" --specpath "%build_temp_dir%" || ( goto :end_script
set /a last_code=1
goto :script_end
) )
call "%signer_tool%" "%out_dir%\generate_emu_config\generate_emu_config.exe" call "%SIGNER_TOOL%" "%OUT_DIR%\generate_emu_config\generate_emu_config.exe"
echo building parse_controller_vdf... echo:building parse_controller_vdf...
pyinstaller "controller_config_generator\parse_controller_vdf.py" --distpath "%out_dir%" -y --clean --onedir --name "parse_controller_vdf" --noupx --console -i "NONE" --workpath "%build_temp_dir%" --specpath "%build_temp_dir%" || ( pyinstaller "controller_config_generator\parse_controller_vdf.py" --distpath "%OUT_DIR%" -y --clean --onedir --name "parse_controller_vdf" --noupx --console -i "NONE" --workpath "%BUILD_TEMP_DIR%" --specpath "%BUILD_TEMP_DIR%" || (
set /a last_code=1 set /a "LAST_ERR_CODE=1"
goto :script_end goto :end_script
) )
call "%signer_tool%" "%out_dir%\parse_controller_vdf\parse_controller_vdf.exe" call "%SIGNER_TOOL%" "%OUT_DIR%\parse_controller_vdf\parse_controller_vdf.exe"
echo building parse_achievements_schema... echo:building parse_achievements_schema...
pyinstaller "stats_schema_achievement_gen\achievements_gen.py" --distpath "%out_dir%" -y --clean --onedir --name "parse_achievements_schema" --noupx --console -i "NONE" --workpath "%build_temp_dir%" --specpath "%build_temp_dir%" || ( pyinstaller "stats_schema_achievement_gen\achievements_gen.py" --distpath "%OUT_DIR%" -y --clean --onedir --name "parse_achievements_schema" --noupx --console -i "NONE" --workpath "%BUILD_TEMP_DIR%" --specpath "%BUILD_TEMP_DIR%" || (
set /a last_code=1 set /a "LAST_ERR_CODE=1"
goto :script_end goto :end_script
) )
call "%signer_tool%" "%out_dir%\parse_achievements_schema\parse_achievements_schema.exe" call "%SIGNER_TOOL%" "%OUT_DIR%\parse_achievements_schema\parse_achievements_schema.exe"
copy /y "steam_default_icon_locked.jpg" "%out_dir%\generate_emu_config\" copy /y "steam_default_icon_locked.jpg" "%OUT_DIR%\generate_emu_config\"
copy /y "steam_default_icon_unlocked.jpg" "%out_dir%\generate_emu_config\" copy /y "steam_default_icon_unlocked.jpg" "%OUT_DIR%\generate_emu_config\"
copy /y "README.md" "%out_dir%\generate_emu_config\" copy /y "README.md" "%OUT_DIR%\generate_emu_config\"
1>"%out_dir%\generate_emu_config\my_login.EXAMPLE.txt" echo Check the README echo Check the README>> "%OUT_DIR%\generate_emu_config\my_login.EXAMPLE.txt"
1>"%out_dir%\generate_emu_config\top_owners_ids.EXAMPLE.txt" echo Check the README echo Check the README>> "%OUT_DIR%\generate_emu_config\top_owners_ids.EXAMPLE.txt"
1>>"%out_dir%\generate_emu_config\top_owners_ids.EXAMPLE.txt" echo You can use a website like: https://steamladder.com/games/ echo You can use a website like: https://steamladder.com/games/>> "%OUT_DIR%\generate_emu_config\top_owners_ids.EXAMPLE.txt"
echo: echo:
echo ============= echo:=============
echo Built inside: "%out_dir%\" echo:Built inside: "%OUT_DIR%\"
goto :end_script
:script_end :end_script
if exist "%build_temp_dir%" ( if exist "%BUILD_TEMP_DIR%" (
rmdir /s /q "%build_temp_dir%" rmdir /s /q "%BUILD_TEMP_DIR%"
) )
popd
endlocal & ( endlocal
exit /b %last_code% exit /b %LAST_ERR_CODE%
)

View File

@ -1,19 +1,29 @@
@echo off @echo off
cd /d "%~dp0" cd /d "%~dp0"
set "venv=.env-win" set "ROOT=%cd%"
set "reqs_file=requirements.txt" set "VENV=%ROOT%\.env-win"
set "REQS_FILE=%ROOT%\requirements.txt"
if exist "%venv%" ( set /a "LAST_ERR_CODE=0"
rmdir /s /q "%venv%"
if exist "%VENV%" (
rmdir /s /q "%VENV%"
) )
python -m venv "%venv%" || exit /b 1 python -m venv "%VENV%" || (
timeout /t 1 /nobreak set /a "LAST_ERR_CODE=1"
call "%venv%\Scripts\activate.bat" goto :end_script
pip install -r "%reqs_file%" )
set /a exit_code=errorlevel
call "%venv%\Scripts\deactivate.bat" timeout /t 1 /nobreak
exit /b %exit_code%
call "%VENV%\Scripts\activate.bat"
pip install -r "%REQS_FILE%"
set /a "LAST_ERR_CODE=%ERRORLEVEL%"
call "%VENV%\Scripts\deactivate.bat"
goto :end_script
:end_script
exit /b %LAST_ERR_CODE%

View File

@ -1,48 +1,52 @@
@echo off @echo off
setlocal EnableDelayedExpansion
cd /d "%~dp0"
setlocal set /a "MAX_THREADS=2"
pushd "%~dp0"
set /a last_code=0
set "build_dir=bin\win"
set "out_dir=bin\package\win"
set /a MEM_PERCENT=90
set /a DICT_SIZE_MB=384
set "packager=..\..\third-party\deps\win\7za\7za.exe"
:: use 70%
if defined NUMBER_OF_PROCESSORS ( if defined NUMBER_OF_PROCESSORS (
set /a THREAD_COUNT=NUMBER_OF_PROCESSORS*70/100 :: use 70%
) else ( set /a "MAX_THREADS=%NUMBER_OF_PROCESSORS% * 70 / 100"
set /a THREAD_COUNT=2 if %MAX_THREADS% lss 1 (
set /a "MAX_THREADS=1"
)
) )
if not exist "%packager%" ( set "ROOT=%cd%"
1>&2 echo "[X] packager app wasn't found" set "BUILD_DIR=%ROOT%\bin\win"
set /a last_code=1 set "OUT_DIR=%ROOT%\bin\package\win"
goto :script_end
set /a "PKG_EXE_MEM_PERCENT=90"
set /a "PKG_EXE_DICT_SIZE_MB=384"
set "PKG_EXE=..\..\third-party\deps\win\7za\7za.exe"
if not exist "%PKG_EXE%" (
1>&2 echo:packager wasn't found
goto :end_script_with_err
) )
if not exist "%build_dir%" ( if not exist "%BUILD_DIR%" (
1>&2 echo "[X] build folder wasn't found" 1>&2 echo:build folder wasn't found
set /a last_code=1 goto :end_script_with_err
goto :script_end
) )
mkdir "%out_dir%" if not exist "%OUT_DIR%" (
mkdir "%OUT_DIR%"
set "archive_file=%out_dir%\migrate_gse-win.7z"
if exist "%archive_file%" (
del /f /q "%archive_file%"
) )
"%packager%" a "%archive_file%" ".\%build_dir%\*" -t7z -slp -ssw -mx -myx -mmemuse=p%MEM_PERCENT% -ms=on -mqs=off -mf=on -mhc+ -mhe- -m0=LZMA2:d=%DICT_SIZE_MB%m -mmt=%THREAD_COUNT% -mmtf+ -mtm- -mtc- -mta- -mtr+ set "ACHIVE_FILE=%OUT_DIR%\migrate_gse-win.7z"
if exist "%ACHIVE_FILE%" (
del /f /s /q "%ACHIVE_FILE%"
:script_end
popd
endlocal & (
exit /b %last_code%
) )
call "%PKG_EXE%" a "%ACHIVE_FILE%" "%BUILD_DIR%\*" -t7z -slp -ssw -mx -myx -mmemuse=p%PKG_EXE_MEM_PERCENT% -ms=on -mqs=off -mf=on -mhc+ -mhe- -m0=LZMA2:d=%PKG_EXE_DICT_SIZE_MB%m -mmt=%MAX_THREADS% -mmtf+ -mtm- -mtc- -mta- -mtr+ || (
goto :end_script_with_err
)
goto :end_script
:end_script
endlocal
exit /b 0
:end_script_with_err
endlocal
exit /b 1

View File

@ -1,53 +1,51 @@
@echo off @echo off
setlocal EnableDelayedExpansion
cd /d "%~dp0"
setlocal set "ROOT=%cd%"
pushd "%~dp0" set "VENV=%ROOT%\.env-win"
set "OUT_DIR=%ROOT%\bin\win"
set "BUILD_TEMP_DIR=%ROOT%\bin\tmp\win"
set "venv=.env-win" set /a "LAST_ERR_CODE=0"
set "out_dir=bin\win"
set "build_temp_dir=bin\tmp\win"
set "signer_tool=..\..\third-party\build\win\cert\sign_helper.bat"
set /a last_code=0 set "SIGNER_TOOL=..\..\third-party\build\win\cert\sign_helper.bat"
if not exist "%SIGNER_TOOL%" (
if not exist "%signer_tool%" ( 1>&2 echo:signing tool wasn't found
1>&2 echo "[X] signing tool wasn't found" set /a "LAST_ERR_CODE=1"
set /a last_code=1 goto :end_script
goto :script_end
) )
if exist "%out_dir%" ( if exist "%OUT_DIR%" (
rmdir /s /q "%out_dir%" rmdir /s /q "%OUT_DIR%"
) )
mkdir "%out_dir%" mkdir "%OUT_DIR%"
if exist "%build_temp_dir%" ( if exist "%BUILD_TEMP_DIR%" (
rmdir /s /q "%build_temp_dir%" rmdir /s /q "%BUILD_TEMP_DIR%"
) )
del /f /q "*.spec" call "%VENV%\Scripts\activate.bat"
call "%venv%\Scripts\activate.bat" echo:building migrate_gse...
pyinstaller "main.py" --distpath "%OUT_DIR%" -y --clean --onedir --name "migrate_gse" --noupx --console -i "NONE" --workpath "%BUILD_TEMP_DIR%" --specpath "%BUILD_TEMP_DIR%" || (
echo building migrate_gse... set /a "LAST_ERR_CODE=1"
pyinstaller "main.py" --distpath "%out_dir%" -y --clean --onedir --name "migrate_gse" --noupx --console -i "NONE" --workpath "%build_temp_dir%" --specpath "%build_temp_dir%" || ( goto :end_script
set /a last_code=1
goto :script_end
) )
call "%signer_tool%" "%out_dir%\migrate_gse\migrate_gse.exe" call "%SIGNER_TOOL%" "%OUT_DIR%\migrate_gse\migrate_gse.exe"
copy /y README.md "%out_dir%\migrate_gse\" copy /y "README.md" "%out_dir%\migrate_gse\"
echo: echo:
echo ============= echo:=============
echo Built inside: "%out_dir%\" echo:Built inside: "%OUT_DIR%\"
goto :end_script
:script_end :end_script
if exist "%build_temp_dir%" ( if exist "%BUILD_TEMP_DIR%" (
rmdir /s /q "%build_temp_dir%" rmdir /s /q "%BUILD_TEMP_DIR%"
) )
popd
endlocal & ( endlocal
exit /b %last_code% exit /b %LAST_ERR_CODE%
)

View File

@ -1,19 +1,29 @@
@echo off @echo off
cd /d "%~dp0" cd /d "%~dp0"
set "venv=.env-win" set "ROOT=%cd%"
set "reqs_file=requirements.txt" set "VENV=%ROOT%\.env-win"
set "REQS_FILE=%ROOT%\requirements.txt"
if exist "%venv%" ( set /a "LAST_ERR_CODE=0"
rmdir /s /q "%venv%"
if exist "%VENV%" (
rmdir /s /q "%VENV%"
) )
python -m venv "%venv%" || exit /b 1 python -m venv "%VENV%" || (
timeout /t 1 /nobreak set /a "LAST_ERR_CODE=1"
call "%venv%\Scripts\activate.bat" goto :end_script
pip install -r "%reqs_file%" )
set /a exit_code=errorlevel
call "%venv%\Scripts\deactivate.bat" timeout /t 1 /nobreak
exit /b %exit_code%
call "%VENV%\Scripts\activate.bat"
pip install -r "%REQS_FILE%"
set /a "LAST_ERR_CODE=%ERRORLEVEL%"
call "%VENV%\Scripts\deactivate.bat"
goto :end_script
:end_script
exit /b %LAST_ERR_CODE%