From d52a3abb14c107ae90d1e86d079a829b3bb575ef Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 23 Apr 2026 20:38:51 -0500 Subject: [PATCH] Add a rough build all parallel batch script --- buildAllParallel.bat | 35 +++++++++++++++++++++++++++++++++++ build_worker.bat | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 buildAllParallel.bat create mode 100644 build_worker.bat diff --git a/buildAllParallel.bat b/buildAllParallel.bat new file mode 100644 index 000000000..c99a0f8ab --- /dev/null +++ b/buildAllParallel.bat @@ -0,0 +1,35 @@ +@echo off & setlocal enabledelayedexpansion + + +echo ==================== Getting versions to build... ==================== +mkdir _buildAllJars 2>nul +del _buildAllJars\* /Q 2>nul + +set "ROOT=%~dp0" +set "WORK_DIR=%ROOT%_buildWorkers" +mkdir "%WORK_DIR%" 2>nul + + +REM get the number of versions to compile +set count=0 +for %%f in (versionProperties\*) do set /a count+=1 +echo ==================== Found %count% versions to build in parallel ==================== + +REM Launch a parallel job for each version +for %%f in (%ROOT%versionProperties\*) do ( + set version=%%~nf + + echo starting [!version!]... + start "Build !version!" cmd /c ""%ROOT%build_worker.bat" "!version!" "%ROOT%" "%WORK_DIR%" ""..\..\_buildAllJars""" + + REM Minor timeout between launches so we can stop the build early if we only want + REM to test part of the script and to reduce startup load + timeout /t 3 /nobreak + +REM 2>nul to supress a harmless warning that the for loop +REM "cannot find the drive specified" +) 2>nul + + +echo ==================== All builds started... Completed Jars will be in _buildAllJars ==================== +endlocal \ No newline at end of file diff --git a/build_worker.bat b/build_worker.bat new file mode 100644 index 000000000..ae0bc33d1 --- /dev/null +++ b/build_worker.bat @@ -0,0 +1,41 @@ +@echo off & setlocal enabledelayedexpansion + +set "VERSION=%~1" +set "ROOT=%~2" +set "WORK_DIR=%~3" +set "WORKER=%WORK_DIR%\%VERSION%" +set "JAR_OUTPUT_DIR=%~4" + +REM remove the ending "\" from the root folder, otherwise the final quote +REM in the robocopy command will be escaped and it won't run +if "%ROOT:~-1%"=="\" set "ROOT=%ROOT:~0,-1%" +set "WORKER=%~3\%~1" + +set "BUILT_JAR_DIR=%WORKER%\build\forgix" + + + +echo ==================== [%VERSION%] Copying workspace ==================== +mkdir "%WORKER%" +robocopy "%ROOT%" "%WORKER%" /E /XD "%WORKER%" "_buildWorkers" "buildAllJars" ".gradle" "build" ".git" ".idea" ".gitlab" "run" "testScripts" /NFL /NDL + +echo ==================== [%VERSION%] Cleaning ==================== +cd /d "%WORKER%" +call .\gradlew.bat clean +REM optional arg that can be added if we want to log the result to a file +REM >"%WORK_DIR%\build_%VERSION%.log" 2>&1 + +echo ==================== [%VERSION%] Assembling ==================== +call .\gradlew.bat assemble -PmcVer="%VERSION%" +REM optional arg that can be added if we want to log the result to a file +REM >>"%WORK_DIR%\build_%VERSION%.log" 2>&1 + +echo ==================== [%VERSION%] Exporting ==================== +mkdir "%JAR_OUTPUT_DIR%" +robocopy "%BUILT_JAR_DIR%" "%JAR_OUTPUT_DIR%" /NFL /NDL + +echo ==================== [%VERSION%] Done ==================== +endlocal + +REM can be uncommented for debugging +REM pause \ No newline at end of file