From 3a7a0edbb5e276cc060bb295a2824e5c5d23249e Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Sun, 2 Sep 2018 16:30:16 +0900 Subject: [PATCH 01/12] =?UTF-8?q?hhc.exe=20=E3=81=AE=E3=83=91=E3=82=B9?= =?UTF-8?q?=E3=82=92=20Program=20Files=20=E9=96=A2=E9=80=A3=E3=81=AE?= =?UTF-8?q?=E7=92=B0=E5=A2=83=E5=A4=89=E6=95=B0=E3=82=92=E5=85=83=E3=81=AB?= =?UTF-8?q?=E6=A4=9C=E7=B4=A2=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build-chm.bat | 8 +++--- tools/hhc/find-hhc.bat | 32 ++++++++++++++++++++++++ tools/hhc/readme.md | 57 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+), 4 deletions(-) create mode 100644 tools/hhc/find-hhc.bat create mode 100644 tools/hhc/readme.md diff --git a/build-chm.bat b/build-chm.bat index a93cf7b995..fcb32f6256 100644 --- a/build-chm.bat +++ b/build-chm.bat @@ -1,13 +1,13 @@ -set HHC=C:\Program Files (x86)\HTML Help Workshop\hhc.exe +call %~dp0tools\hhc\find-hhc.bat @rem hhc.exe returns 1 on success, and returns 0 on failure -"%HHC%" help\macro\macro.HHP +%CMD_HHC% help\macro\macro.HHP if %errorlevel% equ 0 (echo error && exit /b 1) -"%HHC%" help\plugin\plugin.hhp +%CMD_HHC% help\plugin\plugin.hhp if %errorlevel% equ 0 (echo error && exit /b 1) -"%HHC%" help\sakura\sakura.hhp +%CMD_HHC% help\sakura\sakura.hhp if %errorlevel% equ 0 (echo error && exit /b 1) exit /b 0 diff --git a/tools/hhc/find-hhc.bat b/tools/hhc/find-hhc.bat new file mode 100644 index 0000000000..b3c3c2449d --- /dev/null +++ b/tools/hhc/find-hhc.bat @@ -0,0 +1,32 @@ +@rem see readme.md +@echo off +set CMD_HHC= +set PATH_HHC_1= +set PATH_HHC_2= +set PATH_HHC_3= + +if not "%ProgramFiles%" == "" set PATH_HHC_1=%ProgramFiles%\HTML Help Workshop\hhc.exe +if not "%ProgramFiles(x86)%" == "" set PATH_HHC_2=%ProgramFiles(x86)%\HTML Help Workshop\hhc.exe +if not "%ProgramW6432%" == "" set PATH_HHC_3=%ProgramW6432%\HTML Help Workshop\hhc.exe + +set RESULT_PATH_HHC_1=-- +set RESULT_PATH_HHC_2=-- +set RESULT_PATH_HHC_3=-- + +if exist "%PATH_HHC_1%" ( + set RESULT_PATH_HHC_1=OK + set CMD_HHC="%PATH_HHC_1%" +) else if exist "%PATH_HHC_2%" ( + set RESULT_PATH_HHC_2=OK + set CMD_HHC="%PATH_HHC_2%" +) else if exist "%PATH_HHC_3%" ( + set RESULT_PATH_HHC_3=OK + set CMD_HHC="%PATH_HHC_3%" +) + +@echo %RESULT_PATH_HHC_1% %PATH_HHC_1% +@echo %RESULT_PATH_HHC_2% %PATH_HHC_2% +@echo %RESULT_PATH_HHC_3% %PATH_HHC_3% +@echo. +@echo CMD_HHC %CMD_HHC% +@echo. diff --git a/tools/hhc/readme.md b/tools/hhc/readme.md new file mode 100644 index 0000000000..ad29462d0a --- /dev/null +++ b/tools/hhc/readme.md @@ -0,0 +1,57 @@ + + +- [HTML Help Compiler のパスを見つけるバッチファイル](#html-help-compiler-のパスを見つけるバッチファイル) + - [ロジック](#ロジック) + - [バッチファイルでのはまりポイント](#バッチファイルでのはまりポイント) + + + +# HTML Help Compiler のパスを見つけるバッチファイル + +hhc.exe のパスを見つけて 環境変数 `CMD_HHC` に設定する + +## ロジック + +以下の順番でパスを検索して、見つかったパスを環境変数 `CMD_HHC` にセットする。 +CMD_HHC にはダブルクオートを含む値が設定される。 + +- %ProgramFiles%\HTML Help Workshop\hhc.exe +- %ProgramFiles(x86)%\HTML Help Workshop\hhc.exe +- %ProgramW6432%\HTML Help Workshop\hhc.exe + +## バッチファイルでのはまりポイント + +たとえば以下のようなバッチファイルでの記述の場合 + +``` +if not "%ProgramFiles(x86)%" == "" set HHC_PATH2=%ProgramFiles(x86)%\HTML Help Workshop\hhc.exe +if exist "%HHC_PATH2%" ( + set CMD_HHC=%HHC_PATH2% +) +``` + +以下のような意味不明のエラーメッセージが出る + +``` +\HTML の使い方が誤っています。 +``` + +上記のバッチファイルは実行時に以下のような内容になる。 + +``` +if exist "C:\Program Files (x86)\HTML Help Workshop\hhc.exe" ( + set CMD_HHC=C:\Program Files (x86)\HTML Help Workshop\hhc.exe +) +``` + +if の構文の `(` が `C:\Program Files (x86)\HTML Help Workshop\hhc.exe` の `)` と対応すると +解釈されるので `\HTML` が if の条件が成立したときのコマンドと認識されるのでエラーになる。 + +このエラーを回避するために以下のように環境変数 `HHC_PATH2` の値を代入するときにダブルクオートで囲む。 +結果として 環境変数 `CMD_HHC` にはダブルクオートを含む値が設定されるが、仕方ない。 + +``` +if exist "%HHC_PATH2%" ( + set CMD_HHC="%HHC_PATH2%" +) +``` From 274361f4dc2ff511e64f16c7224a0bfce438be46 Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Sun, 2 Sep 2018 17:06:20 +0900 Subject: [PATCH 02/12] =?UTF-8?q?ISCC.exe=20=E3=81=AE=E3=83=91=E3=82=B9?= =?UTF-8?q?=E3=82=92=20Program=20Files=20=E9=96=A2=E9=80=A3=E3=81=AE?= =?UTF-8?q?=E7=92=B0=E5=A2=83=E5=A4=89=E6=95=B0=E3=82=92=E5=85=83=E3=81=AB?= =?UTF-8?q?=E6=A4=9C=E7=B4=A2=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build-installer.bat | 4 +++- tools/ISCC/find-ISCC.bat | 32 ++++++++++++++++++++++++++++++++ tools/ISCC/readme.md | 24 ++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 tools/ISCC/find-ISCC.bat create mode 100644 tools/ISCC/readme.md diff --git a/build-installer.bat b/build-installer.bat index 291e2b325e..907e9c8e2f 100644 --- a/build-installer.bat +++ b/build-installer.bat @@ -1,4 +1,6 @@ @echo off +call %~dp0tools\ISCC\find-ISCC.bat + set platform=%1 set configuration=%2 @@ -46,7 +48,7 @@ copy /Y /B %platform%\%configuration%\*.exe %INSTALLER_WORK%\ copy /Y /B %platform%\%configuration%\*.dll %INSTALLER_WORK%\ set SAKURA_ISS=installer\sakura-%platform%.iss -"C:\Program Files (x86)\Inno Setup 5\ISCC.exe" %SAKURA_ISS% || (echo error && exit /b 1) +%CMD_ISCC% %SAKURA_ISS% || (echo error && exit /b 1) exit /b 0 @rem ------------------------------------------------------------------------------ diff --git a/tools/ISCC/find-ISCC.bat b/tools/ISCC/find-ISCC.bat new file mode 100644 index 0000000000..a7ac9f4bd4 --- /dev/null +++ b/tools/ISCC/find-ISCC.bat @@ -0,0 +1,32 @@ +@rem see readme.md +@echo off +set CMD_ISCC= +set PATH_ISCC_1= +set PATH_ISCC_2= +set PATH_ISCC_3= + +if not "%ProgramFiles%" == "" set PATH_ISCC_1=%ProgramFiles%\Inno Setup 5\ISCC.exe +if not "%ProgramFiles(x86)%" == "" set PATH_ISCC_2=%ProgramFiles(x86)%\Inno Setup 5\ISCC.exe +if not "%ProgramW6432%" == "" set PATH_ISCC_3=%ProgramW6432%\Inno Setup 5\ISCC.exe + +set RESULT_PATH_ISCC_1=-- +set RESULT_PATH_ISCC_2=-- +set RESULT_PATH_ISCC_3=-- + +if exist "%PATH_ISCC_1%" ( + set RESULT_PATH_ISCC_1=OK + set CMD_ISCC="%PATH_ISCC_1%" +) else if exist "%PATH_ISCC_2%" ( + set RESULT_PATH_ISCC_2=OK + set CMD_ISCC="%PATH_ISCC_2%" +) else if exist "%PATH_ISCC_3%" ( + set RESULT_PATH_ISCC_3=OK + set CMD_ISCC="%PATH_ISCC_3%" +) + +@echo %RESULT_PATH_ISCC_1% %PATH_ISCC_1% +@echo %RESULT_PATH_ISCC_2% %PATH_ISCC_2% +@echo %RESULT_PATH_ISCC_3% %PATH_ISCC_3% +@echo. +@echo CMD_ISCC %CMD_ISCC% +@echo. diff --git a/tools/ISCC/readme.md b/tools/ISCC/readme.md new file mode 100644 index 0000000000..c93181533c --- /dev/null +++ b/tools/ISCC/readme.md @@ -0,0 +1,24 @@ + + +- [Inno Setup Compiler のパスを見つけるバッチファイル](#inno-setup-compiler-のパスを見つけるバッチファイル) + - [ロジック](#ロジック) + - [バッチファイルでのはまりポイント](#バッチファイルでのはまりポイント) + + + +# Inno Setup Compiler のパスを見つけるバッチファイル + +ISCC.exe のパスを見つけて 環境変数 `CMD_ISCC` に設定する + +## ロジック + +以下の順番でパスを検索して、見つかったパスを環境変数 `CMD_ISCC` にセットする。 +CMD_ISCC にはダブルクオートを含む値が設定される。 + +- %ProgramFiles%\Inno Setup 5\ISCC.exe +- %ProgramFiles(x86)%\Inno Setup 5\ISCC.exe +- %ProgramW6432%\Inno Setup 5\ISCC.exe + +## バッチファイルでのはまりポイント + +[hhc.exe の readme](../hhc/readme.md) を参照 From e2ac0d34dad4cc265bf864efd950bdd9a4f742f2 Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Sun, 2 Sep 2018 17:19:31 +0900 Subject: [PATCH 03/12] =?UTF-8?q?cppcheck.exe=20=E3=81=AE=E3=83=91?= =?UTF-8?q?=E3=82=B9=E3=82=92=20Program=20Files=20=E9=96=A2=E9=80=A3?= =?UTF-8?q?=E3=81=AE=E7=92=B0=E5=A2=83=E5=A4=89=E6=95=B0=E3=82=92=E5=85=83?= =?UTF-8?q?=E3=81=AB=E6=A4=9C=E7=B4=A2=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- run-cppcheck.bat | 9 +++++---- tools/CppCheck/find-CppCheck.bat | 32 ++++++++++++++++++++++++++++++++ tools/CppCheck/readme.md | 24 ++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 tools/CppCheck/find-CppCheck.bat create mode 100644 tools/CppCheck/readme.md diff --git a/run-cppcheck.bat b/run-cppcheck.bat index e18654b610..6ead13ff4c 100644 --- a/run-cppcheck.bat +++ b/run-cppcheck.bat @@ -1,4 +1,6 @@ @echo off +call %~dp0tools\CppCheck\find-CppCheck.bat + set platform=%1 @rem doesn't use set configuration=%2 @@ -21,7 +23,6 @@ if "%configuration%" == "Release" ( exit /b 1 ) -set CPPCHECK_EXE=C:\Program Files\Cppcheck\cppcheck.exe set CPPCHECK_OUT=cppcheck-%platform%-%configuration%.xml set CPPCHECK_LOG=cppcheck-%platform%-%configuration%.log @@ -53,9 +54,9 @@ set CPPCHECK_PARAMS=%CPPCHECK_PARAMS% -j %NUMBER_OF_PROCESSORS% set CPPCHECK_PARAMS=%CPPCHECK_PARAMS% %~dp0sakura_core set ERROR_RESULT=0 -if exist "%CPPCHECK_EXE%" ( - @echo "%CPPCHECK_EXE%" %CPPCHECK_PARAMS% - "%CPPCHECK_EXE%" %CPPCHECK_PARAMS% > %CPPCHECK_LOG% || set ERROR_RESULT=1 +if exist %CMD_CPPCHECK% ( + @echo %CMD_CPPCHECK% %CPPCHECK_PARAMS% + %CMD_CPPCHECK% %CPPCHECK_PARAMS% > %CPPCHECK_LOG% || set ERROR_RESULT=1 @echo. @echo The log files are %CPPCHECK_LOG% and %CPPCHECK_OUT% @echo cppcheck success diff --git a/tools/CppCheck/find-CppCheck.bat b/tools/CppCheck/find-CppCheck.bat new file mode 100644 index 0000000000..8d8b2c4b66 --- /dev/null +++ b/tools/CppCheck/find-CppCheck.bat @@ -0,0 +1,32 @@ +@rem see readme.md +@echo off +set CMD_CPPCHECK= +set PATH_CPPCHECK_1= +set PATH_CPPCHECK_2= +set PATH_CPPCHECK_3= + +if not "%ProgramFiles%" == "" set PATH_CPPCHECK_1=%ProgramFiles%\Cppcheck\cppcheck.exe +if not "%ProgramFiles(x86)%" == "" set PATH_CPPCHECK_2=%ProgramFiles(x86)%\Cppcheck\cppcheck.exe +if not "%ProgramW6432%" == "" set PATH_CPPCHECK_3=%ProgramW6432%\Cppcheck\cppcheck.exe + +set RESULT_PATH_CPPCHECK_1=-- +set RESULT_PATH_CPPCHECK_2=-- +set RESULT_PATH_CPPCHECK_3=-- + +if exist "%PATH_CPPCHECK_1%" ( + set RESULT_PATH_CPPCHECK_1=OK + set CMD_CPPCHECK="%PATH_CPPCHECK_1%" +) else if exist "%PATH_CPPCHECK_2%" ( + set RESULT_PATH_CPPCHECK_2=OK + set CMD_CPPCHECK="%PATH_CPPCHECK_2%" +) else if exist "%PATH_CPPCHECK_3%" ( + set RESULT_PATH_CPPCHECK_3=OK + set CMD_CPPCHECK="%PATH_CPPCHECK_3%" +) + +@echo %RESULT_PATH_CPPCHECK_1% %PATH_CPPCHECK_1% +@echo %RESULT_PATH_CPPCHECK_2% %PATH_CPPCHECK_2% +@echo %RESULT_PATH_CPPCHECK_3% %PATH_CPPCHECK_3% +@echo. +@echo CMD_CPPCHECK %CMD_CPPCHECK% +@echo. diff --git a/tools/CppCheck/readme.md b/tools/CppCheck/readme.md new file mode 100644 index 0000000000..88b429b52e --- /dev/null +++ b/tools/CppCheck/readme.md @@ -0,0 +1,24 @@ + + +- [cppcheck のパスを見つけるバッチファイル](#cppcheck-のパスを見つけるバッチファイル) + - [ロジック](#ロジック) + - [バッチファイルでのはまりポイント](#バッチファイルでのはまりポイント) + + + +# cppcheck のパスを見つけるバッチファイル + +cppcheck.exe のパスを見つけて 環境変数 `CMD_CPPCHECK` に設定する + +## ロジック + +以下の順番でパスを検索して、見つかったパスを環境変数 `CMD_CPPCHECK` にセットする。 +CMD_CPPCHECK にはダブルクオートを含む値が設定される。 + +- %ProgramFiles%\Cppcheck\cppcheck.exe +- %ProgramFiles(x86)%\Cppcheck\cppcheck.exe +- %ProgramW6432%\Cppcheck\cppcheck.exe + +## バッチファイルでのはまりポイント + +[hhc.exe の readme](../hhc/readme.md) を参照 From a151149b739a08d5cac1a1b6db866774971c3317 Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Sun, 2 Sep 2018 17:36:36 +0900 Subject: [PATCH 04/12] =?UTF-8?q?7z.exe=20=E3=81=AE=E3=83=91=E3=82=B9?= =?UTF-8?q?=E3=82=92=20Program=20Files=20=E9=96=A2=E9=80=A3=E3=81=AE?= =?UTF-8?q?=E7=92=B0=E5=A2=83=E5=A4=89=E6=95=B0=E3=82=92=E5=85=83=E3=81=AB?= =?UTF-8?q?=E6=A4=9C=E7=B4=A2=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/zip/find-7z.bat | 30 ++++++++++++++++++++++++++++-- tools/zip/listzip.bat | 5 +++-- tools/zip/unzip.bat | 5 +++-- tools/zip/zip.bat | 5 +++-- 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/tools/zip/find-7z.bat b/tools/zip/find-7z.bat index 56da898017..796f1a3db7 100644 --- a/tools/zip/find-7z.bat +++ b/tools/zip/find-7z.bat @@ -1,12 +1,38 @@ +@rem see readme.md @echo off set CMD_7Z= if "%FORCE_POWERSHELL_ZIP%" == "1" ( exit /b 0 ) +set PATH_7Z_1= +set PATH_7Z_2= +set PATH_7Z_3= + +if not "%ProgramFiles%" == "" set PATH_7Z_1=%ProgramFiles%\7-Zip\7z.exe +if not "%ProgramFiles(x86)%" == "" set PATH_7Z_2=%ProgramFiles(x86)%\7-Zip\7z.exe +if not "%ProgramW6432%" == "" set PATH_7Z_3=%ProgramW6432%\7-Zip\7z.exe + +set RESULT_PATH_7Z_1=-- +set RESULT_PATH_7Z_2=-- +set RESULT_PATH_7Z_3=-- where 7z 1>nul 2>&1 if "%ERRORLEVEL%" == "0" ( set CMD_7Z=7z -) else if exist "C:\Program Files\7-Zip\7z.exe" ( - set CMD_7Z=C:\Program Files\7-Zip\7z.exe +) else if exist "%PATH_7Z_1%" ( + set RESULT_PATH_7Z_1=OK + set CMD_7Z="%PATH_7Z_1%" +) else if exist "%PATH_7Z_2%" ( + set RESULT_PATH_7Z_2=OK + set CMD_7Z="%PATH_7Z_2%" +) else if exist "%PATH_7Z_3%" ( + set RESULT_PATH_7Z_3=OK + set CMD_7Z="%PATH_7Z_3%" ) + +@echo %RESULT_PATH_7Z_1% %PATH_7Z_1% +@echo %RESULT_PATH_7Z_2% %PATH_7Z_2% +@echo %RESULT_PATH_7Z_3% %PATH_7Z_3% +@echo. +@echo CMD_7Z %CMD_7Z% +@echo. diff --git a/tools/zip/listzip.bat b/tools/zip/listzip.bat index fd94398ffb..1dacef06f9 100644 --- a/tools/zip/listzip.bat +++ b/tools/zip/listzip.bat @@ -4,12 +4,13 @@ set SRCZIP=%1 call %~dp0find-7z.bat @echo examining %SRCZIP%. -if "%CMD_7Z%" == "" ( +@rem CMD_7Z contains double quotes. +if %CMD_7Z% == "" ( @echo ------------------------------------------------------- @echo ---- you can make this faster by installing 7-zip. ---- @echo ------------------------------------------------------- powershell -ExecutionPolicy RemoteSigned -File %~dp0listzip.ps1 %SRCZIP% ) else ( - "%CMD_7Z%" l "%SRCZIP%" + %CMD_7Z% l "%SRCZIP%" ) @echo on diff --git a/tools/zip/unzip.bat b/tools/zip/unzip.bat index 052ef759fb..8b99b048ac 100644 --- a/tools/zip/unzip.bat +++ b/tools/zip/unzip.bat @@ -7,12 +7,13 @@ if exist "%OUTDIR%" rmdir /s /q "%OUTDIR%" call %~dp0find-7z.bat @echo extracting %SRCZIP%. -if "%CMD_7Z%" == "" ( +@rem CMD_7Z contains double quotes. +if %CMD_7Z% == "" ( @echo ------------------------------------------------------- @echo ---- you can make this faster by installing 7-zip. ---- @echo ------------------------------------------------------- powershell -ExecutionPolicy RemoteSigned -File %~dp0unzip.ps1 %SRCZIP% %OUTDIR% ) else ( - "%CMD_7Z%" x "%SRCZIP%" -O"%OUTDIR%" + %CMD_7Z% x "%SRCZIP%" -O"%OUTDIR%" ) @echo on diff --git a/tools/zip/zip.bat b/tools/zip/zip.bat index eaa2f2b9be..598d02261d 100644 --- a/tools/zip/zip.bat +++ b/tools/zip/zip.bat @@ -7,12 +7,13 @@ if exist "%DSTZIP%" del "%DSTZIP%" call %~dp0find-7z.bat @echo archiving %SRCZIP%. -if "%CMD_7Z%" == "" ( +@rem CMD_7Z contains double quotes. +if %CMD_7Z% == "" ( @echo ------------------------------------------------------- @echo ---- you can make this faster by installing 7-zip. ---- @echo ------------------------------------------------------- powershell -ExecutionPolicy RemoteSigned -File %~dp0zip.ps1 %DSTZIP% %SRCDIR% ) else ( - "%CMD_7Z%" a "%DSTZIP%" -r "%SRCDIR%" + %CMD_7Z% a "%DSTZIP%" -r "%SRCDIR%" ) @echo on From 4d09feee021ad90cb8153a7ff56d42b6b440fabd Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Sun, 2 Sep 2018 18:01:01 +0900 Subject: [PATCH 05/12] =?UTF-8?q?msbuild.exe=20=E3=81=AE=E3=83=91=E3=82=B9?= =?UTF-8?q?=E3=82=92=20Program=20Files=20=E9=96=A2=E9=80=A3=E3=81=AE?= =?UTF-8?q?=E7=92=B0=E5=A2=83=E5=A4=89=E6=95=B0=E3=82=92=E5=85=83=E3=81=AB?= =?UTF-8?q?=E6=A4=9C=E7=B4=A2=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build-sln.bat | 7 +++---- tools/msbuild/find-msbuild.bat | 32 ++++++++++++++++++++++++++++++++ tools/msbuild/readme.md | 24 ++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 tools/msbuild/find-msbuild.bat create mode 100644 tools/msbuild/readme.md diff --git a/build-sln.bat b/build-sln.bat index af04b82f4d..4ef91cc53a 100644 --- a/build-sln.bat +++ b/build-sln.bat @@ -1,4 +1,5 @@ @echo off +call %~dp0tools\msbuild\find-msbuild.bat set platform=%1 set configuration=%2 @@ -34,10 +35,8 @@ set LOG_FILE=msbuild-%platform%-%configuration%.log @rem https://msdn.microsoft.com/ja-jp/library/ms171470.aspx set LOG_OPTION=/flp:logfile=%LOG_FILE% -set MSBUILD_EXE="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" - -@echo %MSBUILD_EXE% %SLN_FILE% /p:Platform=%platform% /p:Configuration=%configuration% /t:"Clean","Rebuild" %EXTRA_CMD% %LOG_OPTION% - %MSBUILD_EXE% %SLN_FILE% /p:Platform=%platform% /p:Configuration=%configuration% /t:"Clean","Rebuild" %EXTRA_CMD% %LOG_OPTION% +@echo %CMD_MSBUILD% %SLN_FILE% /p:Platform=%platform% /p:Configuration=%configuration% /t:"Clean","Rebuild" %EXTRA_CMD% %LOG_OPTION% + %CMD_MSBUILD% %SLN_FILE% /p:Platform=%platform% /p:Configuration=%configuration% /t:"Clean","Rebuild" %EXTRA_CMD% %LOG_OPTION% if %errorlevel% neq 0 (echo error && exit /b 1) @echo call parse-buildlog.bat %LOG_FILE% diff --git a/tools/msbuild/find-msbuild.bat b/tools/msbuild/find-msbuild.bat new file mode 100644 index 0000000000..09d26c9021 --- /dev/null +++ b/tools/msbuild/find-msbuild.bat @@ -0,0 +1,32 @@ +@rem see readme.md +@echo off +set CMD_MSBUILD= +set PATH_MSBUILD_1= +set PATH_MSBUILD_2= +set PATH_MSBUILD_3= + +if not "%ProgramFiles%" == "" set PATH_MSBUILD_1=%ProgramFiles%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe +if not "%ProgramFiles(x86)%" == "" set PATH_MSBUILD_2=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe +if not "%ProgramW6432%" == "" set PATH_MSBUILD_3=%ProgramW6432%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe + +set RESULT_PATH_MSBUILD_1=-- +set RESULT_PATH_MSBUILD_2=-- +set RESULT_PATH_MSBUILD_3=-- + +if exist "%PATH_MSBUILD_1%" ( + set RESULT_PATH_MSBUILD_1=OK + set CMD_MSBUILD="%PATH_MSBUILD_1%" +) else if exist "%PATH_MSBUILD_2%" ( + set RESULT_PATH_MSBUILD_2=OK + set CMD_MSBUILD="%PATH_MSBUILD_2%" +) else if exist "%PATH_MSBUILD_3%" ( + set RESULT_PATH_MSBUILD_3=OK + set CMD_MSBUILD="%PATH_MSBUILD_3%" +) + +@echo %RESULT_PATH_MSBUILD_1% %PATH_MSBUILD_1% +@echo %RESULT_PATH_MSBUILD_2% %PATH_MSBUILD_2% +@echo %RESULT_PATH_MSBUILD_3% %PATH_MSBUILD_3% +@echo. +@echo CMD_MSBUILD %CMD_MSBUILD% +@echo. diff --git a/tools/msbuild/readme.md b/tools/msbuild/readme.md new file mode 100644 index 0000000000..370904365d --- /dev/null +++ b/tools/msbuild/readme.md @@ -0,0 +1,24 @@ + + +- [msbuild のパスを見つけるバッチファイル](#msbuild-のパスを見つけるバッチファイル) + - [ロジック](#ロジック) + - [バッチファイルでのはまりポイント](#バッチファイルでのはまりポイント) + + + +# msbuild のパスを見つけるバッチファイル + +msbuild.exe のパスを見つけて 環境変数 `CMD_MSBUILD` に設定する + +## ロジック + +以下の順番でパスを検索して、見つかったパスを環境変数 `CMD_MSBUILD` にセットする。 +CMD_MSBUILD にはダブルクオートを含む値が設定される。 + +- %ProgramFiles%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe +- %ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe +- %ProgramW6432%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe + +## バッチファイルでのはまりポイント + +[hhc.exe の readme](../hhc/readme.md) を参照 From 109365ef929517a3344e7d53b95278317157bd8c Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Sun, 2 Sep 2018 18:03:05 +0900 Subject: [PATCH 06/12] =?UTF-8?q?appveyor=20=E3=81=A7=E3=81=AE=E3=83=AD?= =?UTF-8?q?=E3=82=B0=E7=94=A8=E3=81=AE=20DLL=20=E3=81=AE=E3=83=91=E3=82=B9?= =?UTF-8?q?=E3=81=A7=E7=92=B0=E5=A2=83=E5=A4=89=E6=95=B0=E3=82=92=E4=BD=BF?= =?UTF-8?q?=E3=81=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build-sln.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-sln.bat b/build-sln.bat index 4ef91cc53a..e46376c375 100644 --- a/build-sln.bat +++ b/build-sln.bat @@ -26,7 +26,7 @@ set SLN_FILE=sakura.sln @rem https://www.appveyor.com/docs/environment-variables/ if "%APPVEYOR%"=="True" ( - set EXTRA_CMD=/verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" + set EXTRA_CMD=/verbosity:minimal /logger:"%ProgramFiles%\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" ) else ( set EXTRA_CMD= ) From 94741044cf516a45bb1bd5b62a03c02b46aa6907 Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Sun, 2 Sep 2018 18:16:29 +0900 Subject: [PATCH 07/12] =?UTF-8?q?7z.exe=20=E3=81=AE=E3=83=91=E3=82=B9?= =?UTF-8?q?=E3=81=8C=E9=80=9A=E3=81=A3=E3=81=A6=E3=81=84=E3=82=8B=E3=81=8B?= =?UTF-8?q?=E3=81=AE=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF=E7=B5=90=E6=9E=9C?= =?UTF-8?q?=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/zip/find-7z.bat | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/zip/find-7z.bat b/tools/zip/find-7z.bat index 796f1a3db7..887e85a9c2 100644 --- a/tools/zip/find-7z.bat +++ b/tools/zip/find-7z.bat @@ -12,12 +12,14 @@ if not "%ProgramFiles%" == "" set PATH_7Z_1=%ProgramFiles%\7-Zip\7z.exe if not "%ProgramFiles(x86)%" == "" set PATH_7Z_2=%ProgramFiles(x86)%\7-Zip\7z.exe if not "%ProgramW6432%" == "" set PATH_7Z_3=%ProgramW6432%\7-Zip\7z.exe +set RESULT_PATH_7Z_0=-- set RESULT_PATH_7Z_1=-- set RESULT_PATH_7Z_2=-- set RESULT_PATH_7Z_3=-- where 7z 1>nul 2>&1 if "%ERRORLEVEL%" == "0" ( + set RESULT_PATH_7Z_0=OK set CMD_7Z=7z ) else if exist "%PATH_7Z_1%" ( set RESULT_PATH_7Z_1=OK @@ -30,6 +32,7 @@ if "%ERRORLEVEL%" == "0" ( set CMD_7Z="%PATH_7Z_3%" ) +@echo %RESULT_PATH_7Z_0% 7z.exe @echo %RESULT_PATH_7Z_1% %PATH_7Z_1% @echo %RESULT_PATH_7Z_2% %PATH_7Z_2% @echo %RESULT_PATH_7Z_3% %PATH_7Z_3% From bf0a3607902177944922fc54606b4f39cee0d331 Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Sun, 2 Sep 2018 21:56:01 +0900 Subject: [PATCH 08/12] =?UTF-8?q?=E5=A4=89=E6=95=B0=E3=81=AE=E4=BB=A3?= =?UTF-8?q?=E5=85=A5=E6=96=87=E3=81=A7=20=E5=A4=89=E6=95=B0=EF=BD=9E?= =?UTF-8?q?=E5=80=A4=E3=81=AE=E5=85=A8=E4=BD=93=E3=82=92=E3=83=80=E3=83=96?= =?UTF-8?q?=E3=83=AB=E3=82=AF=E3=82=AA=E3=83=BC=E3=83=88=E3=81=A7=E5=9B=B2?= =?UTF-8?q?=E3=82=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build-chm.bat | 6 +++--- build-installer.bat | 2 +- build-sln.bat | 4 ++-- run-cppcheck.bat | 6 +++--- tools/CppCheck/find-CppCheck.bat | 14 +++++++------- tools/ISCC/find-ISCC.bat | 14 +++++++------- tools/hhc/find-hhc.bat | 14 +++++++------- tools/hhc/readme.md | 5 ++--- tools/msbuild/find-msbuild.bat | 14 +++++++------- tools/zip/find-7z.bat | 14 +++++++------- tools/zip/listzip.bat | 4 ++-- tools/zip/unzip.bat | 4 ++-- tools/zip/zip.bat | 4 ++-- 13 files changed, 52 insertions(+), 53 deletions(-) diff --git a/build-chm.bat b/build-chm.bat index fcb32f6256..044407393c 100644 --- a/build-chm.bat +++ b/build-chm.bat @@ -1,13 +1,13 @@ call %~dp0tools\hhc\find-hhc.bat @rem hhc.exe returns 1 on success, and returns 0 on failure -%CMD_HHC% help\macro\macro.HHP +"%CMD_HHC%" help\macro\macro.HHP if %errorlevel% equ 0 (echo error && exit /b 1) -%CMD_HHC% help\plugin\plugin.hhp +"%CMD_HHC%" help\plugin\plugin.hhp if %errorlevel% equ 0 (echo error && exit /b 1) -%CMD_HHC% help\sakura\sakura.hhp +"%CMD_HHC%" help\sakura\sakura.hhp if %errorlevel% equ 0 (echo error && exit /b 1) exit /b 0 diff --git a/build-installer.bat b/build-installer.bat index 907e9c8e2f..c3349ce6dc 100644 --- a/build-installer.bat +++ b/build-installer.bat @@ -48,7 +48,7 @@ copy /Y /B %platform%\%configuration%\*.exe %INSTALLER_WORK%\ copy /Y /B %platform%\%configuration%\*.dll %INSTALLER_WORK%\ set SAKURA_ISS=installer\sakura-%platform%.iss -%CMD_ISCC% %SAKURA_ISS% || (echo error && exit /b 1) +"%CMD_ISCC%" %SAKURA_ISS% || (echo error && exit /b 1) exit /b 0 @rem ------------------------------------------------------------------------------ diff --git a/build-sln.bat b/build-sln.bat index e46376c375..aca7022cb8 100644 --- a/build-sln.bat +++ b/build-sln.bat @@ -35,8 +35,8 @@ set LOG_FILE=msbuild-%platform%-%configuration%.log @rem https://msdn.microsoft.com/ja-jp/library/ms171470.aspx set LOG_OPTION=/flp:logfile=%LOG_FILE% -@echo %CMD_MSBUILD% %SLN_FILE% /p:Platform=%platform% /p:Configuration=%configuration% /t:"Clean","Rebuild" %EXTRA_CMD% %LOG_OPTION% - %CMD_MSBUILD% %SLN_FILE% /p:Platform=%platform% /p:Configuration=%configuration% /t:"Clean","Rebuild" %EXTRA_CMD% %LOG_OPTION% +@echo "%CMD_MSBUILD%" %SLN_FILE% /p:Platform=%platform% /p:Configuration=%configuration% /t:"Clean","Rebuild" %EXTRA_CMD% %LOG_OPTION% + "%CMD_MSBUILD%" %SLN_FILE% /p:Platform=%platform% /p:Configuration=%configuration% /t:"Clean","Rebuild" %EXTRA_CMD% %LOG_OPTION% if %errorlevel% neq 0 (echo error && exit /b 1) @echo call parse-buildlog.bat %LOG_FILE% diff --git a/run-cppcheck.bat b/run-cppcheck.bat index 6ead13ff4c..d0b6749538 100644 --- a/run-cppcheck.bat +++ b/run-cppcheck.bat @@ -54,9 +54,9 @@ set CPPCHECK_PARAMS=%CPPCHECK_PARAMS% -j %NUMBER_OF_PROCESSORS% set CPPCHECK_PARAMS=%CPPCHECK_PARAMS% %~dp0sakura_core set ERROR_RESULT=0 -if exist %CMD_CPPCHECK% ( - @echo %CMD_CPPCHECK% %CPPCHECK_PARAMS% - %CMD_CPPCHECK% %CPPCHECK_PARAMS% > %CPPCHECK_LOG% || set ERROR_RESULT=1 +if exist "%CMD_CPPCHECK%" ( + @echo "%CMD_CPPCHECK%" %CPPCHECK_PARAMS% + "%CMD_CPPCHECK%" %CPPCHECK_PARAMS% > %CPPCHECK_LOG% || set ERROR_RESULT=1 @echo. @echo The log files are %CPPCHECK_LOG% and %CPPCHECK_OUT% @echo cppcheck success diff --git a/tools/CppCheck/find-CppCheck.bat b/tools/CppCheck/find-CppCheck.bat index 8d8b2c4b66..6c904248eb 100644 --- a/tools/CppCheck/find-CppCheck.bat +++ b/tools/CppCheck/find-CppCheck.bat @@ -5,9 +5,9 @@ set PATH_CPPCHECK_1= set PATH_CPPCHECK_2= set PATH_CPPCHECK_3= -if not "%ProgramFiles%" == "" set PATH_CPPCHECK_1=%ProgramFiles%\Cppcheck\cppcheck.exe -if not "%ProgramFiles(x86)%" == "" set PATH_CPPCHECK_2=%ProgramFiles(x86)%\Cppcheck\cppcheck.exe -if not "%ProgramW6432%" == "" set PATH_CPPCHECK_3=%ProgramW6432%\Cppcheck\cppcheck.exe +if not "%ProgramFiles%" == "" set "PATH_CPPCHECK_1=%ProgramFiles%\Cppcheck\cppcheck.exe" +if not "%ProgramFiles(x86)%" == "" set "PATH_CPPCHECK_2=%ProgramFiles(x86)%\Cppcheck\cppcheck.exe" +if not "%ProgramW6432%" == "" set "PATH_CPPCHECK_3=%ProgramW6432%\Cppcheck\cppcheck.exe" set RESULT_PATH_CPPCHECK_1=-- set RESULT_PATH_CPPCHECK_2=-- @@ -15,18 +15,18 @@ set RESULT_PATH_CPPCHECK_3=-- if exist "%PATH_CPPCHECK_1%" ( set RESULT_PATH_CPPCHECK_1=OK - set CMD_CPPCHECK="%PATH_CPPCHECK_1%" + set "CMD_CPPCHECK=%PATH_CPPCHECK_1%" ) else if exist "%PATH_CPPCHECK_2%" ( set RESULT_PATH_CPPCHECK_2=OK - set CMD_CPPCHECK="%PATH_CPPCHECK_2%" + set "CMD_CPPCHECK=%PATH_CPPCHECK_2%" ) else if exist "%PATH_CPPCHECK_3%" ( set RESULT_PATH_CPPCHECK_3=OK - set CMD_CPPCHECK="%PATH_CPPCHECK_3%" + set "CMD_CPPCHECK=%PATH_CPPCHECK_3%" ) @echo %RESULT_PATH_CPPCHECK_1% %PATH_CPPCHECK_1% @echo %RESULT_PATH_CPPCHECK_2% %PATH_CPPCHECK_2% @echo %RESULT_PATH_CPPCHECK_3% %PATH_CPPCHECK_3% @echo. -@echo CMD_CPPCHECK %CMD_CPPCHECK% +@echo CMD_CPPCHECK "%CMD_CPPCHECK%" @echo. diff --git a/tools/ISCC/find-ISCC.bat b/tools/ISCC/find-ISCC.bat index a7ac9f4bd4..b470c335a1 100644 --- a/tools/ISCC/find-ISCC.bat +++ b/tools/ISCC/find-ISCC.bat @@ -5,9 +5,9 @@ set PATH_ISCC_1= set PATH_ISCC_2= set PATH_ISCC_3= -if not "%ProgramFiles%" == "" set PATH_ISCC_1=%ProgramFiles%\Inno Setup 5\ISCC.exe -if not "%ProgramFiles(x86)%" == "" set PATH_ISCC_2=%ProgramFiles(x86)%\Inno Setup 5\ISCC.exe -if not "%ProgramW6432%" == "" set PATH_ISCC_3=%ProgramW6432%\Inno Setup 5\ISCC.exe +if not "%ProgramFiles%" == "" set "PATH_ISCC_1=%ProgramFiles%\Inno Setup 5\ISCC.exe" +if not "%ProgramFiles(x86)%" == "" set "PATH_ISCC_2=%ProgramFiles(x86)%\Inno Setup 5\ISCC.exe" +if not "%ProgramW6432%" == "" set "PATH_ISCC_3=%ProgramW6432%\Inno Setup 5\ISCC.exe" set RESULT_PATH_ISCC_1=-- set RESULT_PATH_ISCC_2=-- @@ -15,18 +15,18 @@ set RESULT_PATH_ISCC_3=-- if exist "%PATH_ISCC_1%" ( set RESULT_PATH_ISCC_1=OK - set CMD_ISCC="%PATH_ISCC_1%" + set "CMD_ISCC=%PATH_ISCC_1%" ) else if exist "%PATH_ISCC_2%" ( set RESULT_PATH_ISCC_2=OK - set CMD_ISCC="%PATH_ISCC_2%" + set "CMD_ISCC=%PATH_ISCC_2%" ) else if exist "%PATH_ISCC_3%" ( set RESULT_PATH_ISCC_3=OK - set CMD_ISCC="%PATH_ISCC_3%" + set "CMD_ISCC=%PATH_ISCC_3%" ) @echo %RESULT_PATH_ISCC_1% %PATH_ISCC_1% @echo %RESULT_PATH_ISCC_2% %PATH_ISCC_2% @echo %RESULT_PATH_ISCC_3% %PATH_ISCC_3% @echo. -@echo CMD_ISCC %CMD_ISCC% +@echo CMD_ISCC "%CMD_ISCC%" @echo. diff --git a/tools/hhc/find-hhc.bat b/tools/hhc/find-hhc.bat index b3c3c2449d..64e25bb20f 100644 --- a/tools/hhc/find-hhc.bat +++ b/tools/hhc/find-hhc.bat @@ -5,9 +5,9 @@ set PATH_HHC_1= set PATH_HHC_2= set PATH_HHC_3= -if not "%ProgramFiles%" == "" set PATH_HHC_1=%ProgramFiles%\HTML Help Workshop\hhc.exe -if not "%ProgramFiles(x86)%" == "" set PATH_HHC_2=%ProgramFiles(x86)%\HTML Help Workshop\hhc.exe -if not "%ProgramW6432%" == "" set PATH_HHC_3=%ProgramW6432%\HTML Help Workshop\hhc.exe +if not "%ProgramFiles%" == "" set "PATH_HHC_1=%ProgramFiles%\HTML Help Workshop\hhc.exe" +if not "%ProgramFiles(x86)%" == "" set "PATH_HHC_2=%ProgramFiles(x86)%\HTML Help Workshop\hhc.exe" +if not "%ProgramW6432%" == "" set "PATH_HHC_3=%ProgramW6432%\HTML Help Workshop\hhc.exe" set RESULT_PATH_HHC_1=-- set RESULT_PATH_HHC_2=-- @@ -15,18 +15,18 @@ set RESULT_PATH_HHC_3=-- if exist "%PATH_HHC_1%" ( set RESULT_PATH_HHC_1=OK - set CMD_HHC="%PATH_HHC_1%" + set "CMD_HHC=%PATH_HHC_1%" ) else if exist "%PATH_HHC_2%" ( set RESULT_PATH_HHC_2=OK - set CMD_HHC="%PATH_HHC_2%" + set "CMD_HHC=%PATH_HHC_2%" ) else if exist "%PATH_HHC_3%" ( set RESULT_PATH_HHC_3=OK - set CMD_HHC="%PATH_HHC_3%" + set "CMD_HHC=%PATH_HHC_3%" ) @echo %RESULT_PATH_HHC_1% %PATH_HHC_1% @echo %RESULT_PATH_HHC_2% %PATH_HHC_2% @echo %RESULT_PATH_HHC_3% %PATH_HHC_3% @echo. -@echo CMD_HHC %CMD_HHC% +@echo CMD_HHC "%CMD_HHC%" @echo. diff --git a/tools/hhc/readme.md b/tools/hhc/readme.md index ad29462d0a..936156bfb1 100644 --- a/tools/hhc/readme.md +++ b/tools/hhc/readme.md @@ -47,11 +47,10 @@ if exist "C:\Program Files (x86)\HTML Help Workshop\hhc.exe" ( if の構文の `(` が `C:\Program Files (x86)\HTML Help Workshop\hhc.exe` の `)` と対応すると 解釈されるので `\HTML` が if の条件が成立したときのコマンドと認識されるのでエラーになる。 -このエラーを回避するために以下のように環境変数 `HHC_PATH2` の値を代入するときにダブルクオートで囲む。 -結果として 環境変数 `CMD_HHC` にはダブルクオートを含む値が設定されるが、仕方ない。 +このエラーを回避するために以下のように、代入文の変数名 ~ 値の部分全体をダブルクオートで囲む。 ``` if exist "%HHC_PATH2%" ( - set CMD_HHC="%HHC_PATH2%" + set "CMD_HHC=%HHC_PATH2%" ) ``` diff --git a/tools/msbuild/find-msbuild.bat b/tools/msbuild/find-msbuild.bat index 09d26c9021..657b615937 100644 --- a/tools/msbuild/find-msbuild.bat +++ b/tools/msbuild/find-msbuild.bat @@ -5,9 +5,9 @@ set PATH_MSBUILD_1= set PATH_MSBUILD_2= set PATH_MSBUILD_3= -if not "%ProgramFiles%" == "" set PATH_MSBUILD_1=%ProgramFiles%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe -if not "%ProgramFiles(x86)%" == "" set PATH_MSBUILD_2=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe -if not "%ProgramW6432%" == "" set PATH_MSBUILD_3=%ProgramW6432%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe +if not "%ProgramFiles%" == "" set "PATH_MSBUILD_1=%ProgramFiles%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" +if not "%ProgramFiles(x86)%" == "" set "PATH_MSBUILD_2=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" +if not "%ProgramW6432%" == "" set "PATH_MSBUILD_3=%ProgramW6432%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" set RESULT_PATH_MSBUILD_1=-- set RESULT_PATH_MSBUILD_2=-- @@ -15,18 +15,18 @@ set RESULT_PATH_MSBUILD_3=-- if exist "%PATH_MSBUILD_1%" ( set RESULT_PATH_MSBUILD_1=OK - set CMD_MSBUILD="%PATH_MSBUILD_1%" + set "CMD_MSBUILD=%PATH_MSBUILD_1%" ) else if exist "%PATH_MSBUILD_2%" ( set RESULT_PATH_MSBUILD_2=OK - set CMD_MSBUILD="%PATH_MSBUILD_2%" + set "CMD_MSBUILD=%PATH_MSBUILD_2%" ) else if exist "%PATH_MSBUILD_3%" ( set RESULT_PATH_MSBUILD_3=OK - set CMD_MSBUILD="%PATH_MSBUILD_3%" + set "CMD_MSBUILD=%PATH_MSBUILD_3%" ) @echo %RESULT_PATH_MSBUILD_1% %PATH_MSBUILD_1% @echo %RESULT_PATH_MSBUILD_2% %PATH_MSBUILD_2% @echo %RESULT_PATH_MSBUILD_3% %PATH_MSBUILD_3% @echo. -@echo CMD_MSBUILD %CMD_MSBUILD% +@echo CMD_MSBUILD "%CMD_MSBUILD%" @echo. diff --git a/tools/zip/find-7z.bat b/tools/zip/find-7z.bat index 887e85a9c2..fce82f297e 100644 --- a/tools/zip/find-7z.bat +++ b/tools/zip/find-7z.bat @@ -8,9 +8,9 @@ set PATH_7Z_1= set PATH_7Z_2= set PATH_7Z_3= -if not "%ProgramFiles%" == "" set PATH_7Z_1=%ProgramFiles%\7-Zip\7z.exe -if not "%ProgramFiles(x86)%" == "" set PATH_7Z_2=%ProgramFiles(x86)%\7-Zip\7z.exe -if not "%ProgramW6432%" == "" set PATH_7Z_3=%ProgramW6432%\7-Zip\7z.exe +if not "%ProgramFiles%" == "" set "PATH_7Z_1=%ProgramFiles%\7-Zip\7z.exe" +if not "%ProgramFiles(x86)%" == "" set "PATH_7Z_2=%ProgramFiles(x86)%\7-Zip\7z.exe" +if not "%ProgramW6432%" == "" set "PATH_7Z_3=%ProgramW6432%\7-Zip\7z.exe" set RESULT_PATH_7Z_0=-- set RESULT_PATH_7Z_1=-- @@ -23,13 +23,13 @@ if "%ERRORLEVEL%" == "0" ( set CMD_7Z=7z ) else if exist "%PATH_7Z_1%" ( set RESULT_PATH_7Z_1=OK - set CMD_7Z="%PATH_7Z_1%" + set "CMD_7Z=%PATH_7Z_1%" ) else if exist "%PATH_7Z_2%" ( set RESULT_PATH_7Z_2=OK - set CMD_7Z="%PATH_7Z_2%" + set "CMD_7Z=%PATH_7Z_2%" ) else if exist "%PATH_7Z_3%" ( set RESULT_PATH_7Z_3=OK - set CMD_7Z="%PATH_7Z_3%" + set "CMD_7Z=%PATH_7Z_3%" ) @echo %RESULT_PATH_7Z_0% 7z.exe @@ -37,5 +37,5 @@ if "%ERRORLEVEL%" == "0" ( @echo %RESULT_PATH_7Z_2% %PATH_7Z_2% @echo %RESULT_PATH_7Z_3% %PATH_7Z_3% @echo. -@echo CMD_7Z %CMD_7Z% +@echo CMD_7Z "%CMD_7Z%" @echo. diff --git a/tools/zip/listzip.bat b/tools/zip/listzip.bat index 1dacef06f9..f55abf2271 100644 --- a/tools/zip/listzip.bat +++ b/tools/zip/listzip.bat @@ -5,12 +5,12 @@ call %~dp0find-7z.bat @echo examining %SRCZIP%. @rem CMD_7Z contains double quotes. -if %CMD_7Z% == "" ( +if "%CMD_7Z%" == "" ( @echo ------------------------------------------------------- @echo ---- you can make this faster by installing 7-zip. ---- @echo ------------------------------------------------------- powershell -ExecutionPolicy RemoteSigned -File %~dp0listzip.ps1 %SRCZIP% ) else ( - %CMD_7Z% l "%SRCZIP%" + "%CMD_7Z%" l "%SRCZIP%" ) @echo on diff --git a/tools/zip/unzip.bat b/tools/zip/unzip.bat index 8b99b048ac..bd8ae5caf1 100644 --- a/tools/zip/unzip.bat +++ b/tools/zip/unzip.bat @@ -8,12 +8,12 @@ call %~dp0find-7z.bat @echo extracting %SRCZIP%. @rem CMD_7Z contains double quotes. -if %CMD_7Z% == "" ( +if "%CMD_7Z%" == "" ( @echo ------------------------------------------------------- @echo ---- you can make this faster by installing 7-zip. ---- @echo ------------------------------------------------------- powershell -ExecutionPolicy RemoteSigned -File %~dp0unzip.ps1 %SRCZIP% %OUTDIR% ) else ( - %CMD_7Z% x "%SRCZIP%" -O"%OUTDIR%" + "%CMD_7Z%" x "%SRCZIP%" -O"%OUTDIR%" ) @echo on diff --git a/tools/zip/zip.bat b/tools/zip/zip.bat index 598d02261d..38c6ac8a1c 100644 --- a/tools/zip/zip.bat +++ b/tools/zip/zip.bat @@ -8,12 +8,12 @@ call %~dp0find-7z.bat @echo archiving %SRCZIP%. @rem CMD_7Z contains double quotes. -if %CMD_7Z% == "" ( +if "%CMD_7Z%" == "" ( @echo ------------------------------------------------------- @echo ---- you can make this faster by installing 7-zip. ---- @echo ------------------------------------------------------- powershell -ExecutionPolicy RemoteSigned -File %~dp0zip.ps1 %DSTZIP% %SRCDIR% ) else ( - %CMD_7Z% a "%DSTZIP%" -r "%SRCDIR%" + "%CMD_7Z%" a "%DSTZIP%" -r "%SRCDIR%" ) @echo on From 3e4abbff9698d2c7ccd315d414fedcf8d06db91e Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Sun, 2 Sep 2018 22:24:28 +0900 Subject: [PATCH 09/12] =?UTF-8?q?[ci=20skip]=20=E4=B8=8D=E8=A6=81=E3=81=AB?= =?UTF-8?q?=E3=81=AA=E3=81=A3=E3=81=9F=E8=AA=AC=E6=98=8E=E3=82=92=E5=89=8A?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/CppCheck/readme.md | 1 - tools/ISCC/readme.md | 1 - tools/hhc/readme.md | 1 - tools/msbuild/readme.md | 1 - 4 files changed, 4 deletions(-) diff --git a/tools/CppCheck/readme.md b/tools/CppCheck/readme.md index 88b429b52e..ebaf3b6eff 100644 --- a/tools/CppCheck/readme.md +++ b/tools/CppCheck/readme.md @@ -13,7 +13,6 @@ cppcheck.exe のパスを見つけて 環境変数 `CMD_CPPCHECK` に設定す ## ロジック 以下の順番でパスを検索して、見つかったパスを環境変数 `CMD_CPPCHECK` にセットする。 -CMD_CPPCHECK にはダブルクオートを含む値が設定される。 - %ProgramFiles%\Cppcheck\cppcheck.exe - %ProgramFiles(x86)%\Cppcheck\cppcheck.exe diff --git a/tools/ISCC/readme.md b/tools/ISCC/readme.md index c93181533c..13ed0676cb 100644 --- a/tools/ISCC/readme.md +++ b/tools/ISCC/readme.md @@ -13,7 +13,6 @@ ISCC.exe のパスを見つけて 環境変数 `CMD_ISCC` に設定する ## ロジック 以下の順番でパスを検索して、見つかったパスを環境変数 `CMD_ISCC` にセットする。 -CMD_ISCC にはダブルクオートを含む値が設定される。 - %ProgramFiles%\Inno Setup 5\ISCC.exe - %ProgramFiles(x86)%\Inno Setup 5\ISCC.exe diff --git a/tools/hhc/readme.md b/tools/hhc/readme.md index 936156bfb1..64ad1e161c 100644 --- a/tools/hhc/readme.md +++ b/tools/hhc/readme.md @@ -13,7 +13,6 @@ hhc.exe のパスを見つけて 環境変数 `CMD_HHC` に設定する ## ロジック 以下の順番でパスを検索して、見つかったパスを環境変数 `CMD_HHC` にセットする。 -CMD_HHC にはダブルクオートを含む値が設定される。 - %ProgramFiles%\HTML Help Workshop\hhc.exe - %ProgramFiles(x86)%\HTML Help Workshop\hhc.exe diff --git a/tools/msbuild/readme.md b/tools/msbuild/readme.md index 370904365d..a9648198ba 100644 --- a/tools/msbuild/readme.md +++ b/tools/msbuild/readme.md @@ -13,7 +13,6 @@ msbuild.exe のパスを見つけて 環境変数 `CMD_MSBUILD` に設定する ## ロジック 以下の順番でパスを検索して、見つかったパスを環境変数 `CMD_MSBUILD` にセットする。 -CMD_MSBUILD にはダブルクオートを含む値が設定される。 - %ProgramFiles%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe - %ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe From 9f761e07b471e28d16961bea2fd3a469945479e5 Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Mon, 3 Sep 2018 21:07:43 +0900 Subject: [PATCH 10/12] =?UTF-8?q?=E3=82=A8=E3=83=A9=E3=83=BC=E3=83=81?= =?UTF-8?q?=E3=82=A7=E3=83=83=E3=82=AF=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build-chm.bat | 4 ++++ build-installer.bat | 8 ++++++-- build-sln.bat | 6 +++++- run-cppcheck.bat | 8 ++++++-- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/build-chm.bat b/build-chm.bat index 044407393c..d4aa196563 100644 --- a/build-chm.bat +++ b/build-chm.bat @@ -1,4 +1,8 @@ call %~dp0tools\hhc\find-hhc.bat +if "%CMD_HHC%" == "" ( + echo hhc.exe was not found. + exit /b 1 +) @rem hhc.exe returns 1 on success, and returns 0 on failure "%CMD_HHC%" help\macro\macro.HHP diff --git a/build-installer.bat b/build-installer.bat index c3349ce6dc..7d1dd93033 100644 --- a/build-installer.bat +++ b/build-installer.bat @@ -1,6 +1,4 @@ @echo off -call %~dp0tools\ISCC\find-ISCC.bat - set platform=%1 set configuration=%2 @@ -22,6 +20,12 @@ if "%configuration%" == "Release" ( exit /b 1 ) +call %~dp0tools\ISCC\find-ISCC.bat +if "%CMD_ISCC%" == "" ( + echo ISCC.exe was not found. + exit /b 1 +) + set INSTALLER_WORK=installer\sakura set INSTALLER_OUTPUT=installer\Output-%platform% diff --git a/build-sln.bat b/build-sln.bat index aca7022cb8..632194f73e 100644 --- a/build-sln.bat +++ b/build-sln.bat @@ -1,5 +1,4 @@ @echo off -call %~dp0tools\msbuild\find-msbuild.bat set platform=%1 set configuration=%2 @@ -20,6 +19,11 @@ if "%configuration%" == "Release" ( call :showhelp %0 exit /b 1 ) +call %~dp0tools\msbuild\find-msbuild.bat +if "%CMD_MSBUILD%" == "" ( + echo msbuild.exe was not found. + exit /b 1 +) set SLN_FILE=sakura.sln diff --git a/run-cppcheck.bat b/run-cppcheck.bat index d0b6749538..cb182813db 100644 --- a/run-cppcheck.bat +++ b/run-cppcheck.bat @@ -1,6 +1,4 @@ @echo off -call %~dp0tools\CppCheck\find-CppCheck.bat - set platform=%1 @rem doesn't use set configuration=%2 @@ -23,6 +21,12 @@ if "%configuration%" == "Release" ( exit /b 1 ) +call %~dp0tools\CppCheck\find-CppCheck.bat +if "%CMD_CPPCHECK%" == "" ( + echo cppcheck.exe was not found. so skip to run it. + exit /b 0 +) + set CPPCHECK_OUT=cppcheck-%platform%-%configuration%.xml set CPPCHECK_LOG=cppcheck-%platform%-%configuration%.log From 2287d4cf1a398599e28bee6fd651d062262476a8 Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Tue, 4 Sep 2018 08:21:40 +0900 Subject: [PATCH 11/12] =?UTF-8?q?msbuild.exe=20=E3=81=AE=E6=A4=9C=E5=87=BA?= =?UTF-8?q?=E3=81=A7=20%ProgramW6432%=20=E3=82=92=E5=A4=96=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/msbuild/find-msbuild.bat | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tools/msbuild/find-msbuild.bat b/tools/msbuild/find-msbuild.bat index 657b615937..31da007934 100644 --- a/tools/msbuild/find-msbuild.bat +++ b/tools/msbuild/find-msbuild.bat @@ -3,15 +3,12 @@ set CMD_MSBUILD= set PATH_MSBUILD_1= set PATH_MSBUILD_2= -set PATH_MSBUILD_3= if not "%ProgramFiles%" == "" set "PATH_MSBUILD_1=%ProgramFiles%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" if not "%ProgramFiles(x86)%" == "" set "PATH_MSBUILD_2=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" -if not "%ProgramW6432%" == "" set "PATH_MSBUILD_3=%ProgramW6432%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" set RESULT_PATH_MSBUILD_1=-- set RESULT_PATH_MSBUILD_2=-- -set RESULT_PATH_MSBUILD_3=-- if exist "%PATH_MSBUILD_1%" ( set RESULT_PATH_MSBUILD_1=OK @@ -19,14 +16,10 @@ if exist "%PATH_MSBUILD_1%" ( ) else if exist "%PATH_MSBUILD_2%" ( set RESULT_PATH_MSBUILD_2=OK set "CMD_MSBUILD=%PATH_MSBUILD_2%" -) else if exist "%PATH_MSBUILD_3%" ( - set RESULT_PATH_MSBUILD_3=OK - set "CMD_MSBUILD=%PATH_MSBUILD_3%" ) @echo %RESULT_PATH_MSBUILD_1% %PATH_MSBUILD_1% @echo %RESULT_PATH_MSBUILD_2% %PATH_MSBUILD_2% -@echo %RESULT_PATH_MSBUILD_3% %PATH_MSBUILD_3% @echo. @echo CMD_MSBUILD "%CMD_MSBUILD%" @echo. From 0d32d1a36fc7530ed24f8a77612d948ce195248f Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Wed, 5 Sep 2018 06:26:25 +0900 Subject: [PATCH 12/12] =?UTF-8?q?Revert=20"msbuild.exe=20=E3=81=AE?= =?UTF-8?q?=E6=A4=9C=E5=87=BA=E3=81=A7=20%ProgramW6432%=20=E3=82=92?= =?UTF-8?q?=E5=A4=96=E3=81=99"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 2287d4cf1a398599e28bee6fd651d062262476a8. --- tools/msbuild/find-msbuild.bat | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/msbuild/find-msbuild.bat b/tools/msbuild/find-msbuild.bat index 31da007934..657b615937 100644 --- a/tools/msbuild/find-msbuild.bat +++ b/tools/msbuild/find-msbuild.bat @@ -3,12 +3,15 @@ set CMD_MSBUILD= set PATH_MSBUILD_1= set PATH_MSBUILD_2= +set PATH_MSBUILD_3= if not "%ProgramFiles%" == "" set "PATH_MSBUILD_1=%ProgramFiles%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" if not "%ProgramFiles(x86)%" == "" set "PATH_MSBUILD_2=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" +if not "%ProgramW6432%" == "" set "PATH_MSBUILD_3=%ProgramW6432%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" set RESULT_PATH_MSBUILD_1=-- set RESULT_PATH_MSBUILD_2=-- +set RESULT_PATH_MSBUILD_3=-- if exist "%PATH_MSBUILD_1%" ( set RESULT_PATH_MSBUILD_1=OK @@ -16,10 +19,14 @@ if exist "%PATH_MSBUILD_1%" ( ) else if exist "%PATH_MSBUILD_2%" ( set RESULT_PATH_MSBUILD_2=OK set "CMD_MSBUILD=%PATH_MSBUILD_2%" +) else if exist "%PATH_MSBUILD_3%" ( + set RESULT_PATH_MSBUILD_3=OK + set "CMD_MSBUILD=%PATH_MSBUILD_3%" ) @echo %RESULT_PATH_MSBUILD_1% %PATH_MSBUILD_1% @echo %RESULT_PATH_MSBUILD_2% %PATH_MSBUILD_2% +@echo %RESULT_PATH_MSBUILD_3% %PATH_MSBUILD_3% @echo. @echo CMD_MSBUILD "%CMD_MSBUILD%" @echo.