Visual Studio Projects: Cleanup Windows-Binaries procedure for new commit id

- New Commit-Id with Commit-Time
- Properly execute when the Win32-Development-Binaries needs to be cloned
- Properly limit parallel builds if the local system has more than 8 Threads
This commit is contained in:
Mark Pizzolato 2018-03-20 22:29:02 -07:00
parent 3f7f92682d
commit 94727159e8

View file

@ -97,30 +97,29 @@ rem This procedure must be located in the "Visual Studio Projects\Win32-Develop
rem The git repository directory (.git) is located relative to that directory.
cd %~p0
SET GIT_COMMIT_ID=
if not exist ..\..\.git\hooks\post-commit copy ..\git-hooks\post* ..\..\.git\hooks\ > NUL 2>&1
if not exist ..\..\.git\hooks\post-commit copy /y ..\git-hooks\post* ..\..\.git\hooks\ > NUL 2>&1
pushd ..\..
git checkout -q master
git fetch -q origin master
git log -1 --pretty="SIM_GIT_COMMIT_ID %%H%%nSIM_GIT_COMMIT_TIME %%aI" >.git-commit-id
popd
pushd ..
for /F "usebackq tokens=3" %%i in (`findstr /C:SIM_GIT_COMMIT_ID ..\.git-commit-id`) do set GIT_COMMIT_ID=%%i
for /F "usebackq tokens=3" %%i in (`findstr /C:SIM_GIT_COMMIT_TIME ..\.git-commit-id`) do set GIT_COMMIT_TIME=%%i
for /F "tokens=3 delims=-T" %%i in ("%GIT_COMMIT_TIME%") do set D_YYYY=%%i
for /F "tokens=3 delims=-T" %%i in ("%GIT_COMMIT_TIME%") do set D_MM=%%j
for /F "tokens=3 delims=-T" %%i in ("%GIT_COMMIT_TIME%") do set D_DD=%%k
for /F "usebackq tokens=2" %%i in (`findstr /C:SIM_GIT_COMMIT_ID ..\.git-commit-id`) do set GIT_COMMIT_ID=%%i
for /F "usebackq tokens=2" %%i in (`findstr /C:SIM_GIT_COMMIT_TIME ..\.git-commit-id`) do set GIT_COMMIT_TIME=%%i
for /F "tokens=1 delims=-T" %%i in ("%GIT_COMMIT_TIME%") do set D_YYYY=%%i
for /F "tokens=2 delims=-T" %%i in ("%GIT_COMMIT_TIME%") do set D_MM=%%i
for /F "tokens=3 delims=-T" %%i in ("%GIT_COMMIT_TIME%") do set D_DD=%%i
for /F "usebackq tokens=3" %%i in (`findstr/C:"#define SIM_MAJOR" ..\sim_rev.h`) do set _SIM_MAJOR=%%i
for /F "usebackq tokens=3" %%i in (`findstr/C:"#define SIM_MINOR" ..\sim_rev.h`) do set _SIM_MINOR=%%i
for /F "usebackq tokens=3" %%i in (`findstr/C:"#define SIM_PATCH" ..\sim_rev.h`) do set _SIM_PATCH=-%%i
for /F "usebackq tokens=3" %%i in (`findstr/C:"#define SIM_VERSION_MODE" ..\sim_rev.h`) do set _SIM_VERSION_MODE=-%%~i
if "%_SIM_PATCH%" equ "-0" set _SIM_PATCH=
set _ZipName=simh-%_SIM_MAJOR%.%_SIM_MINOR%%_SIM_PATCH%%_SIM_VERSION_MODE%--%D_YYYY%-%D_MM%-%D_DD%-%GIT_COMMIT_ID:~0,8%.zip
set _ZipPath=..\..\%BIN_REPO%
if not exist "%_ZipPath%" mkdir "%_ZipPath%"
set _ZipPath=%_ZipPath%\
if not exist "%_ZipPath%%_ZipName%" vcbuild /M%NUMBER_OF_PROCESSORS% /useenv /rebuild Simh.sln "Release|Win32"
7z a -tzip -x!BuildROMs.exe "%_ZipPath%%_ZipName%" "..\BIN\NT\Win32-Release\*.exe"
popd
pushd ..\%_ZipPath%
if "%1" neq "reset" goto GitAddNew
@ -137,6 +136,14 @@ git push -u origin %BIN_REPO%
:GitAddNew
if not exist .git git clone "%REMOTE_REPO%" ./
git pull
pushd %~p0\..
set _SIM_PARALLEL=8
if %_SIM_PARALLEL% GTR %NUMBER_OF_PROCESSORS% set _SIM_PARALLEL=%NUMBER_OF_PROCESSORS%
if not exist "%_ZipPath%%_ZipName%" vcbuild /M%_SIM_PARALLEL% /useenv /rebuild Simh.sln "Release|Win32"
7z a -tzip -x!BuildROMs.exe "%_ZipPath%%_ZipName%" "..\BIN\NT\Win32-Release\*.exe"
popd
git add %_ZipName%
git commit -m "Build results on %D_YYYY%-%D_MM%-%D_DD% for simh Commit: https://github.com/simh/simh/commit/%GIT_COMMIT_ID%"
git push -u origin %BIN_REPO%