From b374c8b472f8e1dda0ef723633eefad02d205b3b Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Sun, 28 Oct 2018 21:39:08 +0900 Subject: [PATCH 1/2] =?UTF-8?q?if=20errorlevel=20=E3=82=92=E4=BD=BF?= =?UTF-8?q?=E3=81=86=E3=82=88=E3=81=86=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build-chm.bat | 17 ++++++++++++----- build-gnu.bat | 11 ++++++++--- build-sln.bat | 11 ++++++++--- calc-hash-res.bat | 2 +- calc-hash.bat | 2 +- parse-buildlog.bat | 4 ++-- sakura/githash.bat | 4 ++-- tests/build-and-test.bat | 18 +++++++++--------- tools/zip/find-7z.bat | 2 +- 9 files changed, 44 insertions(+), 27 deletions(-) diff --git a/build-chm.bat b/build-chm.bat index d4aa196563..05a12efb00 100644 --- a/build-chm.bat +++ b/build-chm.bat @@ -6,12 +6,19 @@ if "%CMD_HHC%" == "" ( @rem hhc.exe returns 1 on success, and returns 0 on failure "%CMD_HHC%" help\macro\macro.HHP -if %errorlevel% equ 0 (echo error && exit /b 1) +if not errorlevel 1 ( + echo error macro.HHP errorlevel %errorlevel% + exit /b 1 +) "%CMD_HHC%" help\plugin\plugin.hhp -if %errorlevel% equ 0 (echo error && exit /b 1) - +if not errorlevel 1 ( + echo error plugin.hhp errorlevel %errorlevel% + exit /b 1 +) "%CMD_HHC%" help\sakura\sakura.hhp -if %errorlevel% equ 0 (echo error && exit /b 1) - +if not errorlevel 1 ( + echo error sakura.hhp errorlevel %errorlevel% + exit /b 1 +) exit /b 0 diff --git a/build-gnu.bat b/build-gnu.bat index b46d92999b..daaccd9e42 100644 --- a/build-gnu.bat +++ b/build-gnu.bat @@ -30,11 +30,16 @@ path=C:\msys64\mingw64\bin;%path% @echo mingw32-make -C sakura_core MYDEFINES="%MYDEFINES%" MYCFLAGS="%MYCFLAGS%" MYLIBS="%MYLIBS%" mingw32-make -C sakura_core MYDEFINES="%MYDEFINES%" MYCFLAGS="%MYCFLAGS%" MYLIBS="%MYLIBS%" githash stdafx Funccode_enum.h Funccode_define.h -if %errorlevel% neq 0 (popd && exit /b 1) +if errorlevel 1 ( + echo error 1 errorlevel %errorlevel% + exit /b %errorlevel% +) mingw32-make -C sakura_core MYDEFINES="%MYDEFINES%" MYCFLAGS="%MYCFLAGS%" MYLIBS="%MYLIBS%" -j4 -if %errorlevel% neq 0 (popd && exit /b 1) - +if errorlevel 1 ( + echo error 2 errorlevel %errorlevel% + exit /b %errorlevel% +) exit /b 0 diff --git a/build-sln.bat b/build-sln.bat index b6183f6097..0e10142546 100644 --- a/build-sln.bat +++ b/build-sln.bat @@ -41,12 +41,17 @@ set LOG_OPTION=/flp:logfile=%LOG_FILE% @echo "%CMD_MSBUILD%" %SLN_FILE% /p:Platform=%platform% /p:Configuration=%configuration% /t:"Build" %EXTRA_CMD% %LOG_OPTION% "%CMD_MSBUILD%" %SLN_FILE% /p:Platform=%platform% /p:Configuration=%configuration% /t:"Build" %EXTRA_CMD% %LOG_OPTION% -if %errorlevel% neq 0 (echo error && exit /b 1) +if errorlevel 1 ( + echo ERROR in msbuild.exe errorlevel %errorlevel% + exit /b %errorlevel% +) @echo call parse-buildlog.bat %LOG_FILE% call parse-buildlog.bat %LOG_FILE% -if %errorlevel% neq 0 (echo error && exit /b 1) - +if errorlevel 1 ( + echo ERROR in parse-buildlog.bat errorlevel %errorlevel% + exit /b %errorlevel% +) exit /b 0 @rem ------------------------------------------------------------------------------ diff --git a/calc-hash-res.bat b/calc-hash-res.bat index 1f343037a4..3a05ee8b12 100644 --- a/calc-hash-res.bat +++ b/calc-hash-res.bat @@ -19,7 +19,7 @@ if not exist "%SRCDIR%" ( ) where python --version 1>nul 2>&1 -if not "%ERRORLEVEL%" == "0" ( +if errorlevel 1 ( @echo NOTE: No python command ) else ( python calc-hash.py %OUTHASHFILE% %SRCDIR% .res diff --git a/calc-hash.bat b/calc-hash.bat index 545e150209..d5ada6bfa7 100644 --- a/calc-hash.bat +++ b/calc-hash.bat @@ -19,7 +19,7 @@ if not exist "%SRCDIR%" ( ) where python --version 1>nul 2>&1 -if not "%ERRORLEVEL%" == "0" ( +if errorlevel 1 ( @echo NOTE: No python command ) else ( python calc-hash.py %OUTHASHFILE% %SRCDIR% diff --git a/parse-buildlog.bat b/parse-buildlog.bat index 10e32cd290..b27ebdb8c9 100644 --- a/parse-buildlog.bat +++ b/parse-buildlog.bat @@ -25,7 +25,7 @@ if "%APPVEYOR%" == "True" ( set ERROR_RESULT=0 where python --version 1>nul 2>&1 -if not "%ERRORLEVEL%" == "0" ( +if errorlevel 1 ( @echo NOTE: No python command ) else ( python appveyor_env.py @@ -37,7 +37,7 @@ exit /b %ERROR_RESULT% :openpyxl_install where pip 1>nul 2>&1 -if not "%ERRORLEVEL%" == "0" ( +if errorlevel 1 ( @echo NOTE: No pip command ) else ( @echo NOTE: found pip command diff --git a/sakura/githash.bat b/sakura/githash.bat index bc1aea582b..5f8eea6a7d 100644 --- a/sakura/githash.bat +++ b/sakura/githash.bat @@ -19,7 +19,7 @@ pushd "%~dp0" : Git enabled checking set GIT_ENABLED=1 where git 1>nul 2>&1 -if not "%ERRORLEVEL%" == "0" ( +if errorlevel 1 ( set GIT_ENABLED=0 @echo NOTE: No git command ) @@ -120,7 +120,7 @@ if "%VALID_CREATE_GITHASH%" == "0" ( call :output_githash > %GITHASH_H_TMP% fc %GITHASH_H% %GITHASH_H_TMP% 1>nul 2>&1 -if "%ERRORLEVEL%" == "0" ( +if not errorlevel 1 ( del %GITHASH_H_TMP% @echo %GITHASH_H% was not updated. ) else ( diff --git a/tests/build-and-test.bat b/tests/build-and-test.bat index ebf294e626..a66e966f5c 100644 --- a/tests/build-and-test.bat +++ b/tests/build-and-test.bat @@ -9,24 +9,24 @@ if "%platform%" == "MinGW" ( @echo ---- start create-project.bat ---- call %~dp0create-project.bat %platform% %configuration% -if %ERRORLEVEL% neq 0 ( - @echo ERROR in create-project.bat - exit /b 1 +if errorlevel 1 ( + @echo ERROR in create-project.bat %errorlevel% + exit /b %errorlevel% ) @echo ---- end create-project.bat ---- @echo ---- start build-project.bat ---- call %~dp0build-project.bat %platform% %configuration% -if %ERRORLEVEL% neq 0 ( - @echo ERROR in build-project.bat - exit /b 1 +if errorlevel 1 ( + @echo ERROR in build-project.bat %errorlevel% + exit /b %errorlevel% ) @echo ---- end build-project.bat ---- @echo ---- start run-tests.bat ---- call %~dp0run-tests.bat %platform% %configuration% -if %ERRORLEVEL% neq 0 ( - @echo ERROR in run-tests.bat - exit /b 1 +if errorlevel 1 ( + @echo ERROR in run-tests.bat %errorlevel% + exit /b %errorlevel% ) @echo ---- end run-tests.bat ---- diff --git a/tools/zip/find-7z.bat b/tools/zip/find-7z.bat index fce82f297e..2cbe8c474e 100644 --- a/tools/zip/find-7z.bat +++ b/tools/zip/find-7z.bat @@ -18,7 +18,7 @@ set RESULT_PATH_7Z_2=-- set RESULT_PATH_7Z_3=-- where 7z 1>nul 2>&1 -if "%ERRORLEVEL%" == "0" ( +if not errorlevel 1 ( set RESULT_PATH_7Z_0=OK set CMD_7Z=7z ) else if exist "%PATH_7Z_1%" ( From 598c67990e59a026972486f11b75119af41920b5 Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Sun, 4 Nov 2018 10:28:48 +0900 Subject: [PATCH 2/2] =?UTF-8?q?exit=20/b=20%errorlevel%=20=E3=81=A7=20%err?= =?UTF-8?q?orlevel%=20=E3=82=92=E8=BF=94=E3=81=99=E3=81=AE=E3=82=92?= =?UTF-8?q?=E3=82=84=E3=82=81=E3=81=A6=E5=9B=BA=E5=AE=9A=E5=80=A4=E3=82=92?= =?UTF-8?q?=E8=BF=94=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build-gnu.bat | 4 ++-- build-sln.bat | 4 ++-- tests/build-and-test.bat | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build-gnu.bat b/build-gnu.bat index daaccd9e42..95641040ed 100644 --- a/build-gnu.bat +++ b/build-gnu.bat @@ -32,13 +32,13 @@ path=C:\msys64\mingw64\bin;%path% mingw32-make -C sakura_core MYDEFINES="%MYDEFINES%" MYCFLAGS="%MYCFLAGS%" MYLIBS="%MYLIBS%" githash stdafx Funccode_enum.h Funccode_define.h if errorlevel 1 ( echo error 1 errorlevel %errorlevel% - exit /b %errorlevel% + exit /b 1 ) mingw32-make -C sakura_core MYDEFINES="%MYDEFINES%" MYCFLAGS="%MYCFLAGS%" MYLIBS="%MYLIBS%" -j4 if errorlevel 1 ( echo error 2 errorlevel %errorlevel% - exit /b %errorlevel% + exit /b 1 ) exit /b 0 diff --git a/build-sln.bat b/build-sln.bat index 0e10142546..f363cd7506 100644 --- a/build-sln.bat +++ b/build-sln.bat @@ -43,14 +43,14 @@ set LOG_OPTION=/flp:logfile=%LOG_FILE% "%CMD_MSBUILD%" %SLN_FILE% /p:Platform=%platform% /p:Configuration=%configuration% /t:"Build" %EXTRA_CMD% %LOG_OPTION% if errorlevel 1 ( echo ERROR in msbuild.exe errorlevel %errorlevel% - exit /b %errorlevel% + exit /b 1 ) @echo call parse-buildlog.bat %LOG_FILE% call parse-buildlog.bat %LOG_FILE% if errorlevel 1 ( echo ERROR in parse-buildlog.bat errorlevel %errorlevel% - exit /b %errorlevel% + exit /b 1 ) exit /b 0 diff --git a/tests/build-and-test.bat b/tests/build-and-test.bat index a66e966f5c..734d26acd7 100644 --- a/tests/build-and-test.bat +++ b/tests/build-and-test.bat @@ -11,7 +11,7 @@ if "%platform%" == "MinGW" ( call %~dp0create-project.bat %platform% %configuration% if errorlevel 1 ( @echo ERROR in create-project.bat %errorlevel% - exit /b %errorlevel% + exit /b 1 ) @echo ---- end create-project.bat ---- @@ -19,7 +19,7 @@ if errorlevel 1 ( call %~dp0build-project.bat %platform% %configuration% if errorlevel 1 ( @echo ERROR in build-project.bat %errorlevel% - exit /b %errorlevel% + exit /b 1 ) @echo ---- end build-project.bat ---- @@ -27,6 +27,6 @@ if errorlevel 1 ( call %~dp0run-tests.bat %platform% %configuration% if errorlevel 1 ( @echo ERROR in run-tests.bat %errorlevel% - exit /b %errorlevel% + exit /b 1 ) @echo ---- end run-tests.bat ----