From e79488cc3e83d522b9cb11cfa04ca761f084ac18 Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Fri, 3 Aug 2018 06:44:10 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=E7=92=B0=E5=A2=83=E5=A4=89=E6=95=B0=20SKIP?= =?UTF-8?q?=5FCREATE=5FGITHASH=20=E3=81=8C=201=20=E3=81=AB=E3=82=BB?= =?UTF-8?q?=E3=83=83=E3=83=88=E3=81=95=E3=82=8C=E3=81=A6=E3=81=84=E3=81=A6?= =?UTF-8?q?=E3=80=81=20githash.h=20=E3=81=8C=E5=AD=98=E5=9C=A8=E3=81=97?= =?UTF-8?q?=E3=81=A6=E3=81=84=E3=81=AA=E3=81=8B=E3=81=A3=E3=81=9F=E3=82=89?= =?UTF-8?q?=20githash.h=20=E3=81=AE=E7=94=9F=E6=88=90=E3=82=92=E3=82=B9?= =?UTF-8?q?=E3=82=AD=E3=83=83=E3=83=97=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E3=81=99=E3=82=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sakura/githash.bat | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sakura/githash.bat b/sakura/githash.bat index 1bd224ffa0..dd4c40f4d7 100644 --- a/sakura/githash.bat +++ b/sakura/githash.bat @@ -88,6 +88,20 @@ if "%APPVEYOR_BUILD_URL_VALID%" == "1" ( set GITHASH_H=%OUT_DIR%\githash.h set GITHASH_H_TMP=%GITHASH_H%.tmp +@rem check if skip creation of %GITHASH_H% +set VALID_CREATE_GITHASH=1 +if "%SKIP_CREATE_GITHASH%" == "1" ( + set VALID_CREATE_GITHASH=0 +) +if not exist "%GITHASH_H%" ( + set VALID_CREATE_GITHASH=1 +) + +if "%VALID_CREATE_GITHASH%" == "0" ( + @echo skip creation of %GITHASH_H% + exit /b 0 +) + call :output_githash > %GITHASH_H_TMP% fc %GITHASH_H% %GITHASH_H_TMP% 1>nul 2>&1 From 25fb14753b4b269863f670dc26dc36a9721fcbc7 Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Sun, 5 Aug 2018 22:26:43 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sakura/githash.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/sakura/githash.bat b/sakura/githash.bat index dd4c40f4d7..f64bbdb306 100644 --- a/sakura/githash.bat +++ b/sakura/githash.bat @@ -88,6 +88,7 @@ if "%APPVEYOR_BUILD_URL_VALID%" == "1" ( set GITHASH_H=%OUT_DIR%\githash.h set GITHASH_H_TMP=%GITHASH_H%.tmp +@rem set SKIP_CREATE_GITHASH=1 to disable creation of githash.h @rem check if skip creation of %GITHASH_H% set VALID_CREATE_GITHASH=1 if "%SKIP_CREATE_GITHASH%" == "1" ( From 2f75ab0257ab2a971972fb0890f2449977582525 Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Sun, 5 Aug 2018 22:32:49 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=E3=83=89=E3=82=AD=E3=83=A5=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E3=81=AB=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index b9395a979d..ec8c4c39ee 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ - [Visual Studio Community 2017](#visual-studio-community-2017) - [Visual Studio Install options required](#visual-studio-install-options-required) - [How to build](#how-to-build) + - [githash.h の更新のスキップ](#githashh-の更新のスキップ) - [CI Build (AppVeyor)](#ci-build-appveyor) - [ビルドの仕組み](#ビルドの仕組み) - [ビルド成果物を利用する上での注意事項](#ビルド成果物を利用する上での注意事項) @@ -42,6 +43,29 @@ More information: https://github.com/sakura-editor/sakura/issues/6 ## How to build Visual Studio Community 2017 で `sakura.sln` を開いてビルド。 +### githash.h の更新のスキップ + +sakura editor ではビルド時に git の commit hash 等の情報を githash.h というファイルに出力します。 +ビルド時に commit hash 等を生成することでビルド済みのバイナリがどの commit hash を元にビルドされたか +簡単に判断できて便利なのですが、 + +バイナリが変化しないリファクタリングをしたときでも、commit hash 等の変更が原因でバイナリ一致しなくなります。 +これだと検証が面倒になるので、ローカルビルドで githash.h が変化しない手段を提供します。 + +コマンドラインで環境変数 ```SKIP_CREATE_GITHASH``` を 1 に設定することにより commit hash の +更新処理をスキップすることができます。githash.h が存在しない場合には、この環境変数が設定されていても +githash.h を生成します。 + +コマンド実行例 + +``` +set SKIP_CREATE_GITHASH=1 +build-sln.bat Win32 Release +build-sln.bat Win32 Debug +build-sln.bat x64 Release +build-sln.bat x64 Debug +``` + ## CI Build (AppVeyor) ### ビルドの仕組み