-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ビルド時間とアーティファクトサイズの軽減が狙いですが、主としてバッチのリファクタリングです。 #626
Changes from all commits
360f7b8
9dbc196
cdab545
0a49ca2
11ce4a3
687351a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,52 @@ | ||
@echo off | ||
setlocal | ||
set platform=%1 | ||
set configuration=%2 | ||
set ERROR_RESULT=0 | ||
|
||
@echo ---- start create-project.bat ---- | ||
call "%~dp0create-project.bat" %platform% %configuration% | ||
if errorlevel 1 ( | ||
@echo ERROR in create-project.bat %errorlevel% | ||
exit /b 1 | ||
for %%B in ( | ||
create-project.bat | ||
build-project.bat | ||
) do ( | ||
call :ExecBat "%~dp0%%~B" %PLATFORM% %CONFIGURATION% ^ | ||
|| (echo ERROR %%~B %ERRORLEVEL% & exit /b 1) | ||
) | ||
@echo ---- end create-project.bat ---- | ||
|
||
@echo ---- start build-project.bat ---- | ||
call "%~dp0build-project.bat" %platform% %configuration% | ||
if errorlevel 1 ( | ||
@echo ERROR in build-project.bat %errorlevel% | ||
exit /b 1 | ||
) | ||
@echo ---- end build-project.bat ---- | ||
exit /b 0 | ||
|
||
@echo ---- start run-tests.bat ---- | ||
call "%~dp0run-tests.bat" %platform% %configuration% | ||
if errorlevel 1 ( | ||
@echo ERROR in run-tests.bat %errorlevel% | ||
exit /b 1 | ||
) | ||
@echo ---- end run-tests.bat ---- | ||
rem ---------------------------------------------- | ||
rem sub-routines | ||
rem ---------------------------------------------- | ||
|
||
:ExecBat | ||
setlocal | ||
set Batch=%~1 | ||
set Platform=%~2 | ||
set Config=%~3 | ||
|
||
call :StartWatch | ||
echo ---- start %Batch% [%StartDate% %StartTime%] ---- | ||
echo. | ||
cmd /C "call "%Batch%" %Platform% %Config%" ^ | ||
|| exit /b 1 | ||
call :StopWatch | ||
echo ---- end %Batch% [%StopDate% %StopTime% / %Elapsed% seconds elapsed.] ---- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. わりと見かけると思うのですが、こういうメッセージで s を脱着するまではしないけれど、括弧を付けずにはいられない( マーク・ピーターセンさんの古典的名著『日本人の英語』を読むとそういう、(不)定冠詞を軽視した態度は厳に改めるべきものだと反省させられます。英語ネイティブはまず a や the を発話してから、具体的な名詞となる単語を頭の中で探すことがあるらしいですよ。そっちが核なんですね。 この echo メッセージも改めるべきなのかもしれません。 |
||
echo. | ||
exit /b 0 | ||
|
||
:StartWatch | ||
set StartDate=%DATE% | ||
set StartTime=%TIME: =0% | ||
exit /b 0 | ||
|
||
:StopWatch | ||
rem Be aware of space-padding hours and octal number literals | ||
rem when calculating the Elapsed. | ||
|
||
set StopDate=%DATE% | ||
set StopTime=%TIME: =0% | ||
set /A Elapsed=(1%StopTime:~0,2% * 3600 + 1%StopTime:~3,2% * 60 + 1%StopTime:~6,2%) ^ | ||
-(1%StartTime:~0,2% * 3600 + 1%StartTime:~3,2% * 60 + 1%StartTime:~6,2%) | ||
if not "%StartDate%" == "%StopDate%" ( | ||
set /A Elapsed=%Elapsed% + 24 * 3600 | ||
) | ||
exit /b 0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,57 @@ | ||
@echo off | ||
setlocal ENABLEDELAYEDEXPANSION | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 遅延環境変数を利用したい CMAKE_PATH_FIX が呼び出し元の PATH 環境変数に影響を与えるためにこの場所で setlocal しましたが、 |
||
set platform=%1 | ||
set configuration=%2 | ||
set ERROR_RESULT=0 | ||
|
||
pushd %~dp0 | ||
if not exist googletest ( | ||
call :SetEnv_%platform% %platform% %configuration% | ||
set BUILDDIR=%~dp0build\%platform%\%configuration% | ||
|
||
pushd "%~dp0" | ||
if not exist "googletest\CMakeLists.txt" ( | ||
git submodule init | ||
git submodule update | ||
) | ||
popd | ||
|
||
set BUILDDIR=build\%platform% | ||
cmake --build %BUILDDIR% --config %configuration% || set ERROR_RESULT=1 | ||
cmake --build "%BUILDDIR%" %CMAKE_BLD_OPT% --target tests1 ^ | ||
|| (echo ERROR & exit /b 1) | ||
|
||
popd | ||
exit /b 0 | ||
|
||
if "%ERROR_RESULT%" == "1" ( | ||
@echo ERROR | ||
exit /b 1 | ||
) | ||
rem ---------------------------------------------- | ||
rem sub-routines | ||
rem ---------------------------------------------- | ||
|
||
:SetEnv_Win32 | ||
:SetEnv_x64 | ||
set CMAKE_GEN_OPT=-G "Visual Studio 15 2017" -A "%~1" | ||
set CMAKE_BLD_OPT=--config "%~2" | ||
exit /b 0 | ||
|
||
:SetEnv_MinGW | ||
set CMAKE_GEN_OPT=-G "MinGW Makefiles" -D CMAKE_BUILD_TYPE="%~2" | ||
set CMAKE_BLD_OPT= | ||
set PATH=C:\msys64\mingw64\bin;%PATH% | ||
call :CMAKE_PATH_FIX | ||
exit /b 0 | ||
|
||
rem Remove path to sh.exe from PATH env. | ||
rem see https://github.com/vim/vim/blob/4dbc2627641a6b950c30c31cbf7b7e6c36da1927/src/Make_cyg_ming.mak#L176-L202 | ||
rem via https://github.com/sakura-editor/sakura/pull/591#discussion_r230551589 | ||
:CMAKE_PATH_FIX | ||
if not "%~1" == "sh.exe" ( | ||
call %0 "sh.exe" & exit /b | ||
) | ||
set SHDIR=%~dp$PATH:1 | ||
if "%SHDIR%" == "" ( | ||
exit /b 0 | ||
) | ||
set SHDIR=%SHDIR:~0,-1% | ||
set ORG=;%PATH%; | ||
set MOD=!ORG:;%SHDIR%\;=;%! | ||
set MOD=!MOD:;%SHDIR%;=;%! | ||
set PATH=%MOD:~1,-1% | ||
if not "%ORG%" == "%MOD%" ( | ||
call %0 "sh.exe" & exit /b | ||
) | ||
exit /b 0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,74 @@ | ||
@echo off | ||
setlocal ENABLEDELAYEDEXPANSION | ||
set platform=%1 | ||
set configuration=%2 | ||
set ERROR_RESULT=0 | ||
|
||
@rem produces header files necessary in creating the project. | ||
call :SetEnv_%platform% %platform% %configuration% | ||
set BUILDDIR=%~dp0build\%platform%\%configuration% | ||
|
||
rem produces header files necessary in creating the project. | ||
|
||
if "%platform%" == "MinGW" ( | ||
set BUILD_EDITOR_BAT=build-gnu.bat | ||
) else ( | ||
set BUILD_EDITOR_BAT=build-sln.bat | ||
) | ||
pushd "%~dp0.." | ||
@echo ---- start %BUILD_EDITOR_BAT% ---- | ||
call "%BUILD_EDITOR_BAT%" %platform% %configuration% || set ERROR_RESULT=1 | ||
cmd /C "pushd "%~dp0.." & call "%BUILD_EDITOR_BAT%" %platform% %configuration%" ^ | ||
|| (echo ERROR & exit /b 1) | ||
@echo ---- end %BUILD_EDITOR_BAT% ---- | ||
popd | ||
if "%ERROR_RESULT%" == "1" ( | ||
@echo ERROR | ||
exit /b 1 | ||
) | ||
|
||
pushd "%~dp0" | ||
|
||
if not exist "googletest\CMakeLists.txt" ( | ||
git submodule init | ||
git submodule update | ||
) | ||
popd | ||
|
||
set BUILDDIR=build\%platform% | ||
if exist "%BUILDDIR%" ( | ||
rmdir /s /q "%BUILDDIR%" | ||
) | ||
mkdir "%BUILDDIR%" | ||
|
||
call :setenv_%platform% %platform% %configuration% | ||
cmake %CMAKE_GEN_OPT% -H. -B"%BUILDDIR%" || set ERROR_RESULT=1 | ||
cmake %CMAKE_GEN_OPT% -H"%~dp0." -B"%BUILDDIR%" ^ | ||
|| (echo ERROR & exit /b 1) | ||
|
||
popd | ||
|
||
if "%ERROR_RESULT%" == "1" ( | ||
@echo ERROR | ||
exit /b 1 | ||
) | ||
exit /b 0 | ||
|
||
exit /b | ||
rem ---------------------------------------------- | ||
rem sub-routines | ||
rem ---------------------------------------------- | ||
|
||
@rem ---------------------------------------------- | ||
@rem sub-routines | ||
@rem ---------------------------------------------- | ||
|
||
:setenv_Win32 | ||
:setenv_x64 | ||
:SetEnv_Win32 | ||
:SetEnv_x64 | ||
set CMAKE_GEN_OPT=-G "Visual Studio 15 2017" -A "%~1" | ||
exit /b | ||
set CMAKE_BLD_OPT=--config "%~2" | ||
exit /b 0 | ||
|
||
:setenv_MinGW | ||
:SetEnv_MinGW | ||
set CMAKE_GEN_OPT=-G "MinGW Makefiles" -D CMAKE_BUILD_TYPE="%~2" | ||
set PATH=C:\msys64\mingw64\bin;%PATH:C:\Program Files\Git\usr\bin;=% | ||
exit /b | ||
set CMAKE_BLD_OPT= | ||
set PATH=C:\msys64\mingw64\bin;%PATH% | ||
call :CMAKE_PATH_FIX | ||
exit /b 0 | ||
|
||
rem Remove path to sh.exe from PATH env. | ||
rem see https://github.com/vim/vim/blob/4dbc2627641a6b950c30c31cbf7b7e6c36da1927/src/Make_cyg_ming.mak#L176-L202 | ||
rem via https://github.com/sakura-editor/sakura/pull/591#discussion_r230551589 | ||
:CMAKE_PATH_FIX | ||
if not "%~1" == "sh.exe" ( | ||
call %0 "sh.exe" & exit /b | ||
) | ||
set SHDIR=%~dp$PATH:1 | ||
if "%SHDIR%" == "" ( | ||
exit /b 0 | ||
) | ||
set SHDIR=%SHDIR:~0,-1% | ||
set ORG=;%PATH%; | ||
set MOD=!ORG:;%SHDIR%\;=;%! | ||
set MOD=!MOD:;%SHDIR%;=;%! | ||
set PATH=%MOD:~1,-1% | ||
if not "%ORG%" == "%MOD%" ( | ||
call %0 "sh.exe" & exit /b | ||
) | ||
exit /b 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmd /C "%Batch%"
の代わりにcall|"%Batch%"
でもいけそうですがあまりに趣味的なのでやめておきます。