From 79e07fa5b3c3cd662c1aad4305bddaecef8cca7d Mon Sep 17 00:00:00 2001 From: berryzplus Date: Sun, 10 Oct 2021 01:12:19 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7?= =?UTF-8?q?=E3=83=B3=E6=83=85=E5=A0=B1=E3=82=92=E3=83=AA=E3=83=95=E3=82=A1?= =?UTF-8?q?=E3=82=AF=E3=82=BF=E3=83=AA=E3=83=B3=E3=82=B0=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sakura/githash.bat | 46 +++++++++++++++ sakura_core/_main/global.cpp | 9 ++- sakura_core/config/build_config.h | 3 - sakura_core/dlg/CDlgAbout.cpp | 24 ++------ sakura_core/sakura_rc.rc2 | 32 ++++++----- sakura_core/version.h | 86 ++++------------------------ sakura_lang_en_US/sakura_lang_rc.rc2 | 32 ++++++----- 7 files changed, 103 insertions(+), 129 deletions(-) diff --git a/sakura/githash.bat b/sakura/githash.bat index ca959b6cb7..69e03b55e1 100644 --- a/sakura/githash.bat +++ b/sakura/githash.bat @@ -63,11 +63,42 @@ exit /b 0 set GIT_TAG_NAME= ) + :: ビルド環境の名前が未定義なら local とする + if not defined BUILD_ENV_NAME ( + set BUILD_ENV_NAME=Local + ) + + :: Gitリポジトリの累積コミット数(取れない場合は0) + call :set_build_version + @rem get back to the original directory popd exit /b 0 +:set_build_version + if defined BUILD_VERSION exit /b 0 + :: MinGWビルドは判定を諦める + if "%SHELL%" == "/usr/bin/bash") do ( + set BUILD_VERSION=0 + exit /b 0 + ) + + :: gitがPATHに存在するかチェックする + set HAS_GIT_IN_PATH=0 + for /f "usebackq" %%a in (`where $PATH:git`) do ( + set HAS_GIT_IN_PATH=1 + ) + + if "%HAS_GIT_IN_PATH%" == "1" ( + for /f "usebackq" %%s in (`git log --oneline --no-merges ^| find /C " "`) do ( + set BUILD_VERSION=%%s + ) + ) else ( + set BUILD_VERSION=0 + ) + exit /b 0 + :set_repo_and_pr_variables if defined APPVEYOR_REPO_NAME ( set CI_REPO_NAME=%APPVEYOR_REPO_NAME% @@ -142,6 +173,7 @@ exit /b 0 :set_ci_build_url call :set_ci_build_url_for_appveyor call :set_ci_build_url_for_azurepipelines + call :set_ci_build_url_for_githubactions exit /b 0 :set_ci_build_url_for_appveyor @@ -150,6 +182,7 @@ exit /b 0 if not defined APPVEYOR_ACCOUNT_NAME exit /b 0 if not defined APPVEYOR_PROJECT_SLUG exit /b 0 if not defined APPVEYOR_BUILD_VERSION exit /b 0 + set BUILD_ENV_NAME=Appveyor set CI_BUILD_URL=%APPVEYOR_URL%/project/%APPVEYOR_ACCOUNT_NAME%/%APPVEYOR_PROJECT_SLUG%/build/%APPVEYOR_BUILD_VERSION% exit /b 0 @@ -157,9 +190,16 @@ exit /b 0 if not defined SYSTEM_TEAMFOUNDATIONSERVERURI exit /b 0 if not defined SYSTEM_TEAMPROJECT exit /b 0 if not defined BUILD_BUILDID exit /b 0 + set BUILD_ENV_NAME=AZP set CI_BUILD_URL=%SYSTEM_TEAMFOUNDATIONSERVERURI%%SYSTEM_TEAMPROJECT%/_build/results?buildId=%BUILD_BUILDID% exit /b 0 +:set_ci_build_url_for_githubactions + if not defined GITHUB_ACTIONS exit /b 0 + if not "%GITHUB_ACTIONS%" == "true" exit /b 0 + set BUILD_ENV_NAME=GHA + exit /b 0 + :update_output_githash @rem update githash.h if necessary set GITHASH_H=%OUT_DIR%\githash.h @@ -207,6 +247,9 @@ exit /b 0 @echo APPVEYOR_URL : %APPVEYOR_URL% @echo APPVEYOR_PROJECT_SLUG : %APPVEYOR_PROJECT_SLUG% @echo. + @echo BUILD_ENV_NAME : %BUILD_ENV_NAME% + @echo BUILD_VERSION : %BUILD_VERSION% + @echo. if exist "%GITHASH_H%" del "%GITHASH_H%" move /y "%GITHASH_H_TMP%" "%GITHASH_H%" @@ -327,4 +370,7 @@ exit /b 0 echo // APPVEYOR specific variables end echo // + echo #define BUILD_ENV_NAME "%BUILD_ENV_NAME%" + echo #define BUILD_VERSION %BUILD_VERSION% + exit /b 0 diff --git a/sakura_core/_main/global.cpp b/sakura_core/_main/global.cpp index b0f52ac216..e9fccb355b 100644 --- a/sakura_core/_main/global.cpp +++ b/sakura_core/_main/global.cpp @@ -18,10 +18,17 @@ #include "StdAfx.h" #include "_main/global.h" +#include "_main/CNormalProcess.h" #include "basis/CErrorInfo.h" #include "config/app_constants.h" #include "window/CEditWnd.h" -#include "CNormalProcess.h" +#include "version.h" + +#ifdef DEV_VERSION +#pragma message("-------------------------------------------------------------------------------------") +#pragma message("--- This is a Dev version and under development. Be careful to use this version. ---") +#pragma message("-------------------------------------------------------------------------------------") +#endif /*! アプリ名を取得します。 diff --git a/sakura_core/config/build_config.h b/sakura_core/config/build_config.h index 81be206c16..6cff0c7648 100644 --- a/sakura_core/config/build_config.h +++ b/sakura_core/config/build_config.h @@ -110,7 +110,4 @@ static const bool UNICODE_BOOL=true; #define DBG_NEW new #endif -#if _WIN64 -#define ALPHA_VERSION -#endif #endif /* SAKURA_BUILD_CONFIG_DB7D8D47_EA6A_4ABF_A081_A31875D78808_H_ */ diff --git a/sakura_core/dlg/CDlgAbout.cpp b/sakura_core/dlg/CDlgAbout.cpp index 67087d14c5..b01e9ccf2f 100644 --- a/sakura_core/dlg/CDlgAbout.cpp +++ b/sakura_core/dlg/CDlgAbout.cpp @@ -172,8 +172,7 @@ BOOL CDlgAbout::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam ) // 2010.04.15 Moca コンパイラ情報を分離/WINヘッダ,N_SHAREDATA_VERSION追加 // 以下の形式で出力 - //サクラエディタ Ver. 2.4.1.0 32bit DEBUG dev - //(GitHash xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) + //サクラエディタ開発版(64bitデバッグ) v2.4.1.1234GHA (xxxxxxxx) //(GitURL https://github.com/sakura/sakura-editor.git) // // Share Ver: 96 @@ -184,28 +183,14 @@ BOOL CDlgAbout::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam ) // 1行目 // バージョン情報 - cmemMsg.AppendString(LS(STR_DLGABOUT_APPNAME)); // e.g. "サクラエディタ", "Sakura Editor" - cmemMsg.AppendString(L" "); - DWORD dwVersionMS, dwVersionLS; GetAppVersionInfo( NULL, VS_VERSION_INFO, &dwVersionMS, &dwVersionLS ); cmemMsg.AppendStringF( - L"v%d.%d.%d.%d", + L"%s v%d.%d.%d.%d" LTEXT(BUILD_ENV_NAME) LTEXT(VERSION_HASH) L"\r\n", + LS(STR_GSTR_APPNAME), HIWORD(dwVersionMS), LOWORD(dwVersionMS), HIWORD(dwVersionLS), LOWORD(dwVersionLS) // e.g. {2, 3, 2, 0} ); - cmemMsg.AppendString( L" " _T(VER_PLATFORM) ); - cmemMsg.AppendString( _T(SPACE_WHEN_DEBUG) _T(VER_CONFIG) ); -#ifdef DEV_VERSION - cmemMsg.AppendString( _T(DEV_VERSION_STR_WITH_SPACE) ); -#endif -#ifdef ALPHA_VERSION - cmemMsg.AppendString( L" " _T(ALPHA_VERSION_STR)); -#endif -#ifdef GIT_TAG_NAME - cmemMsg.AppendString( L" (tag " _T(GIT_TAG_NAME) L")" ); -#endif - cmemMsg.AppendString( L"\r\n" ); // 2行目 #ifdef GIT_COMMIT_HASH @@ -221,9 +206,8 @@ BOOL CDlgAbout::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam ) cmemMsg.AppendString( L"\r\n" ); // コンパイル情報 - cmemMsg.AppendString( L" Compile Info: " ); cmemMsg.AppendStringF( - _T(COMPILER_TYPE) _T(TARGET_M_SUFFIX) L"%d " TSTR_TARGET_MODE L" WIN%03x/I%03x/C%03x/N%03x\r\n", + L" Compile Info: " _T(COMPILER_TYPE) _T(TARGET_M_SUFFIX) L"%d " TSTR_TARGET_MODE L" WIN%03x/I%03x/C%03x/N%03x\r\n", COMPILER_VER, WINVER, _WIN32_IE, MY_WIN32_WINDOWS, MY_WIN32_WINNT ); diff --git a/sakura_core/sakura_rc.rc2 b/sakura_core/sakura_rc.rc2 index 979656e969..d1fe93e59c 100644 --- a/sakura_core/sakura_rc.rc2 +++ b/sakura_core/sakura_rc.rc2 @@ -1,31 +1,33 @@ // このファイルにはリソースエディタで編集できない要素を配置します. // このファイルのエンコーディング/改行コードは UTF-16LE(BOM)/CRLF です. -#define _APP_NAME_1 "sakura" +#define _APP_NAME_1 "サクラエディタ" -#ifdef _DEBUG -#define _APP_NAME_2 "(デバッグ版)" +#ifdef DEV_VERSION +#define _APP_NAME_2 "開発版" #else #define _APP_NAME_2 "" #endif -#ifdef DEV_VERSION -#define _APP_NAME_3 "(dev Version)" +#ifdef _WIN64 +#define _APP_NAME_3 "64bit" #else -#define _APP_NAME_3 "" +#define _APP_NAME_3 "32bit" #endif -#ifdef ALPHA_VERSION -#define _APP_NAME_4 "(Alpha Version)" +#ifdef _DEBUG +#define _APP_NAME_4 "デバッグ" #else #define _APP_NAME_4 "" #endif +#if defined(_WIN64) || defined(_DEBUG) +#define _GSTR_APPNAME _APP_NAME_1 _APP_NAME_2 "(" _APP_NAME_3 _APP_NAME_4 ")" +#else #define _GSTR_APPNAME _APP_NAME_1 _APP_NAME_2 _APP_NAME_3 _APP_NAME_4 +#endif #define S_COPYRIGHT "Copyright (C) 1998-2021 by Norio Nakatani & Collaborators" -#define FL_VER PR_VER -#define FL_VER_STR PR_VER_STR ///////////////////////////////////////////////////////////////////////////// // @@ -90,8 +92,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION FL_VER - PRODUCTVERSION PR_VER + FILEVERSION FILE_VERSION + PRODUCTVERSION PRODUCT_VERSION FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x01L @@ -109,13 +111,13 @@ BEGIN VALUE "Comments", "このソフトはフリーソフトです。\0" VALUE "CompanyName", "Project: Sakura-Editor\0" VALUE "FileDescription", "サクラエディタ\0" - VALUE "FileVersion", FL_VER_STR + VALUE "FileVersion", VERSION_STR VALUE "InternalName", "sakura\0" VALUE "LegalCopyright", S_COPYRIGHT VALUE "LegalTrademarks", " \0" VALUE "OriginalFilename", "sakura.exe\0" - VALUE "ProductName", "サクラエディタ\0" - VALUE "ProductVersion", RESOURCE_VERSION_STRING(PR_VER_STR) // e.g. "2.3.2.0 (4a0de579) UNICODE 64bit DEBUG" + VALUE "ProductName", _GSTR_APPNAME "\0" + VALUE "ProductVersion", VERSION_STR VERSION_HASH // e.g. "2.4.1.0 (4a0de579)" END END BLOCK "VarFileInfo" diff --git a/sakura_core/version.h b/sakura_core/version.h index 0dd71371d7..e4176fc832 100644 --- a/sakura_core/version.h +++ b/sakura_core/version.h @@ -30,87 +30,23 @@ #include "githash.h" // バージョン定義 // -// ver a.b.c.d -// 例: ver 2.3.2.0 -// a => 2 -// b => 3 -// c => 2 -// d => 0 -#define VER_A 2 // a of ver a.b.c.d -#define VER_B 4 // b of ver a.b.c.d -#define VER_C 2 // c of ver a.b.c.d -#ifdef CI_BUILD_NUMBER_INT -#define VER_D CI_BUILD_NUMBER_INT // d of ver a.b.c.d -#else -#define VER_D 0 // d of ver a.b.c.d -#endif +#define VER_A 2 // メジャーバージョン(2固定) +#define VER_B 4 // マイナーバージョン(4以降はGitHub版) +#define VER_C 2 // 連番(マージの通し番号) +#define VER_D BUILD_VERSION // Gitの累積コミット数 #define TO_STR(arg) #arg -#define MAKE_VERSION_STR(a, b, c, d, sep) TO_STR(a) sep TO_STR(b) sep TO_STR(c) sep TO_STR(d) -#define MAKE_VERSION_STR_PERIOD(a, b, c, d) MAKE_VERSION_STR(a, b, c, d, ".") -#define MAKE_VERSION_COMMA(a, b, c, d) a, b, c, d - -#define PR_VER_STR MAKE_VERSION_STR_PERIOD(VER_A, VER_B, VER_C, VER_D) -#define PR_VER MAKE_VERSION_COMMA(VER_A, VER_B, VER_C, VER_D) - -#define VER_CHARSET "UNICODE" - -#ifdef _WIN64 -#define VER_PLATFORM "64bit" -#else -#define VER_PLATFORM "32bit" -#endif - -#ifdef _DEBUG -#define VER_CONFIG "DEBUG" -#else -#define VER_CONFIG "" -#endif +#define _MAKE_VERSION(a, b, c, d) a, b, c, d +#define _MAKE_VERSION_STR(a, b, c, d, sep) TO_STR(a) sep TO_STR(b) sep TO_STR(c) sep TO_STR(d) -#ifdef _DEBUG -#define SPACE_WHEN_DEBUG " " -#else -#define SPACE_WHEN_DEBUG "" -#endif - -#if defined(ALPHA_VERSION) -#pragma message("----------------------------------------------------------------------------------------") -#pragma message("--- This is an alpha version and under development. Be careful to use this version. ---") -#pragma message("----------------------------------------------------------------------------------------") -#endif - -#ifdef ALPHA_VERSION -#define ALPHA_VERSION_STR "Alpha Version" -#define ALPHA_VERSION_STR_WITH_SPACE " " ALPHA_VERSION_STR -#else -#define ALPHA_VERSION_STR_WITH_SPACE "" -#endif - -#ifdef DEV_VERSION -#define DEV_VERSION_STR_WITH_SPACE " dev" -#else -#define DEV_VERSION_STR_WITH_SPACE "" -#endif +#define PRODUCT_VERSION _MAKE_VERSION(VER_A, VER_B, VER_C, 0) +#define FILE_VERSION _MAKE_VERSION(VER_A, VER_B, VER_C, VER_D) +#define VERSION_STR _MAKE_VERSION_STR(VER_A, VER_B, VER_C, VER_D, ".") -// バージョン情報埋め込み用 Git ハッシュ文字列 (存在しない場合には空文字列) #ifdef GIT_SHORT_COMMIT_HASH -#define VER_GIT_SHORTHASH " (" GIT_SHORT_COMMIT_HASH ")" +#define VERSION_HASH " (" GIT_SHORT_COMMIT_HASH ")" #else -#define VER_GIT_SHORTHASH "" +#define VERSION_HASH " (Undefined)" #endif -// リソース埋め込み用バージョン文字列 // -// e.g. "2.3.2.0 (4a0de579) UNICODE 64bit dev DEBUG" … (開発版) デバッグビルド時の例 // -// e.g. "2.3.2.0 (4a0de579) UNICODE 64bit dev" … (開発版) リリースビルド時の例 // -// e.g. "2.3.2.0 UNICODE 64bit dev" … (開発版) Git 情報無い場合の例 // -// e.g. "2.3.2.0 (4a0de579) UNICODE 64bit DEBUG" … (タグ付き) デバッグビルド時の例 // -// e.g. "2.3.2.0 (4a0de579) UNICODE 64bit" … (タグ付き) リリースビルド時の例 // -#define RESOURCE_VERSION_STRING(_VersionString) \ - _VersionString \ - VER_GIT_SHORTHASH \ - " " VER_CHARSET \ - " " VER_PLATFORM \ - DEV_VERSION_STR_WITH_SPACE \ - SPACE_WHEN_DEBUG \ - VER_CONFIG ALPHA_VERSION_STR_WITH_SPACE #endif /* SAKURA_VERSION_F8EBA970_BB7A_43D9_B89A_04FB0B586A8A_H_ */ diff --git a/sakura_lang_en_US/sakura_lang_rc.rc2 b/sakura_lang_en_US/sakura_lang_rc.rc2 index 67a1a67b16..c07846735f 100644 --- a/sakura_lang_en_US/sakura_lang_rc.rc2 +++ b/sakura_lang_en_US/sakura_lang_rc.rc2 @@ -1,32 +1,34 @@ // このファイルにはリソースエディタで編集できない要素を配置します. // このファイルのエンコーディング/改行コードは UTF-16LE(BOM)/CRLF です. -#define _APP_NAME_1 "sakura" +#define _APP_NAME_1 "SAKURA Editor" -#ifdef _DEBUG -#define _APP_NAME_2 "(debug build)" +#ifdef DEV_VERSION +#define _APP_NAME_2 " Dev" #else #define _APP_NAME_2 "" #endif -#ifdef DEV_VERSION -#define _APP_NAME_3 "(dev Version)" +#ifdef _WIN64 +#define _APP_NAME_3 "64bit" #else -#define _APP_NAME_3 "" +#define _APP_NAME_3 "32bit" #endif -#ifdef ALPHA_VERSION -#define _APP_NAME_4 "(Alpha Version)" +#ifdef _DEBUG +#define _APP_NAME_4 " Debug" #else #define _APP_NAME_4 "" #endif +#if defined(_WIN64) || defined(_DEBUG) +#define _GSTR_APPNAME _APP_NAME_1 _APP_NAME_2 "(" _APP_NAME_3 _APP_NAME_4 ")" +#else #define _GSTR_APPNAME _APP_NAME_1 _APP_NAME_2 _APP_NAME_3 _APP_NAME_4 +#endif #define S_COPYRIGHT "Copyright (C) 1998-2021 by Norio Nakatani & Collaborators" #define S_COPYRIGHT_TRANSLATION "Copyright (C) 2011-2021 by Lucien & Collaborators" -#define FL_VER PR_VER -#define FL_VER_STR PR_VER_STR ///////////////////////////////////////////////////////////////////////////// // @@ -93,8 +95,8 @@ END // Version // VS_VERSION_INFO VERSIONINFO - FILEVERSION FL_VER - PRODUCTVERSION PR_VER + FILEVERSION FILE_VERSION + PRODUCTVERSION PRODUCT_VERSION FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x01L @@ -112,13 +114,13 @@ BEGIN VALUE "Comments", "This is free software\0" VALUE "CompanyName", "Project: Sakura-Editor\0" VALUE "FileDescription", "Sakura Editor Language DLL(en_US)\0" - VALUE "FileVersion", FL_VER_STR + VALUE "FileVersion", VERSION_STR VALUE "InternalName", "sakura\0" VALUE "LegalCopyright", S_COPYRIGHT_TRANSLATION VALUE "LegalTrademarks", " \0" VALUE "OriginalFilename", "sakura.exe\0" - VALUE "ProductName", "Sakura Editor Language DLL\0" - VALUE "ProductVersion", RESOURCE_VERSION_STRING(PR_VER_STR) // e.g. "2.3.2.0 4a0de579 UNICODE 64bit DEBUG" + VALUE "ProductName", _GSTR_APPNAME "\0" + VALUE "ProductVersion", VERSION_STR VERSION_HASH // e.g. "2.4.1.0 (4a0de579)" END END BLOCK "VarFileInfo" From 4d906caf8d56a4b169816b28499df27e071df920 Mon Sep 17 00:00:00 2001 From: berryzplus Date: Sun, 10 Oct 2021 13:06:01 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=E3=83=AC=E3=83=93=E3=83=A5=E3=83=BC?= =?UTF-8?q?=E6=8C=87=E6=91=98=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ・BUILD_ENV_NAMEの前に空白を入れる ・英語版丸括弧の前に空白を入れる ・「v」を変更前コメントに合わせ「Ver. 」にしてみる --- sakura_core/dlg/CDlgAbout.cpp | 4 ++-- sakura_lang_en_US/sakura_lang_rc.rc2 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sakura_core/dlg/CDlgAbout.cpp b/sakura_core/dlg/CDlgAbout.cpp index b01e9ccf2f..190c7078c5 100644 --- a/sakura_core/dlg/CDlgAbout.cpp +++ b/sakura_core/dlg/CDlgAbout.cpp @@ -172,7 +172,7 @@ BOOL CDlgAbout::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam ) // 2010.04.15 Moca コンパイラ情報を分離/WINヘッダ,N_SHAREDATA_VERSION追加 // 以下の形式で出力 - //サクラエディタ開発版(64bitデバッグ) v2.4.1.1234GHA (xxxxxxxx) + //サクラエディタ開発版(64bitデバッグ) Ver. 2.4.1.1234 GHA (xxxxxxxx) //(GitURL https://github.com/sakura/sakura-editor.git) // // Share Ver: 96 @@ -187,7 +187,7 @@ BOOL CDlgAbout::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam ) GetAppVersionInfo( NULL, VS_VERSION_INFO, &dwVersionMS, &dwVersionLS ); cmemMsg.AppendStringF( - L"%s v%d.%d.%d.%d" LTEXT(BUILD_ENV_NAME) LTEXT(VERSION_HASH) L"\r\n", + L"%s Ver. %d.%d.%d.%d " LTEXT(BUILD_ENV_NAME) LTEXT(VERSION_HASH) L"\r\n", LS(STR_GSTR_APPNAME), HIWORD(dwVersionMS), LOWORD(dwVersionMS), HIWORD(dwVersionLS), LOWORD(dwVersionLS) // e.g. {2, 3, 2, 0} ); diff --git a/sakura_lang_en_US/sakura_lang_rc.rc2 b/sakura_lang_en_US/sakura_lang_rc.rc2 index c07846735f..d5a081a36f 100644 --- a/sakura_lang_en_US/sakura_lang_rc.rc2 +++ b/sakura_lang_en_US/sakura_lang_rc.rc2 @@ -22,7 +22,7 @@ #endif #if defined(_WIN64) || defined(_DEBUG) -#define _GSTR_APPNAME _APP_NAME_1 _APP_NAME_2 "(" _APP_NAME_3 _APP_NAME_4 ")" +#define _GSTR_APPNAME _APP_NAME_1 _APP_NAME_2 " (" _APP_NAME_3 _APP_NAME_4 ")" #else #define _GSTR_APPNAME _APP_NAME_1 _APP_NAME_2 _APP_NAME_3 _APP_NAME_4 #endif From 7f792464d05b38a1176b56e6cc893b558a6fd2fd Mon Sep 17 00:00:00 2001 From: berryzplus Date: Sun, 10 Oct 2021 22:31:20 +0900 Subject: [PATCH 3/4] =?UTF-8?q?Azure=20Pipelines=E3=81=AEMinGW=E3=83=93?= =?UTF-8?q?=E3=83=AB=E3=83=89=E3=82=92=E6=9B=B4=E6=96=B0=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ci/azure-pipelines/template.job.build-on-msys2.yml | 6 +++++- sakura/githash.bat | 13 +++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ci/azure-pipelines/template.job.build-on-msys2.yml b/ci/azure-pipelines/template.job.build-on-msys2.yml index 960aee9a4a..01b601eef4 100644 --- a/ci/azure-pipelines/template.job.build-on-msys2.yml +++ b/ci/azure-pipelines/template.job.build-on-msys2.yml @@ -24,7 +24,11 @@ jobs: steps: - checkout: self # self represents the repo where the initial Pipelines YAML file was found clean: all # what to clean each time; if not mentioned, does not clean - fetchDepth: 5 # the depth of commits to ask Git to fetch; defaults to no limit + + - bash: | + BUILD_VERSION=`git log --oneline --no-merges | wc -l` + echo "##vso[task.setvariable variable=BUILD_VERSION]$BUILD_VERSION" + displayName: compute BUILD_VERSION # show environmental variables for debug. - script: set diff --git a/sakura/githash.bat b/sakura/githash.bat index 69e03b55e1..06560e5ca2 100644 --- a/sakura/githash.bat +++ b/sakura/githash.bat @@ -56,11 +56,15 @@ exit /b 0 for /f "usebackq" %%s in (`"%CMD_GIT%" describe --tags --contains 2^>nul`) do ( set GIT_TAG_NAME=%%s ) + + :: Gitリポジトリの累積コミット数(取れない場合は0) + call :set_build_version ) else ( set GIT_SHORT_COMMIT_HASH= set GIT_COMMIT_HASH= set GIT_REMOTE_ORIGIN_URL= set GIT_TAG_NAME= + set BUILD_VERSION=0 ) :: ビルド環境の名前が未定義なら local とする @@ -68,21 +72,14 @@ exit /b 0 set BUILD_ENV_NAME=Local ) - :: Gitリポジトリの累積コミット数(取れない場合は0) - call :set_build_version - @rem get back to the original directory popd exit /b 0 :set_build_version + if not "%GIT_ENABLED%" == "1" exit /b 0 if defined BUILD_VERSION exit /b 0 - :: MinGWビルドは判定を諦める - if "%SHELL%" == "/usr/bin/bash") do ( - set BUILD_VERSION=0 - exit /b 0 - ) :: gitがPATHに存在するかチェックする set HAS_GIT_IN_PATH=0 From cfb529082e0a3ceb5bb8b5b424be52ffe34cf7d4 Mon Sep 17 00:00:00 2001 From: berryzplus Date: Mon, 11 Oct 2021 00:38:07 +0900 Subject: [PATCH 4/4] =?UTF-8?q?shallow=20clone=E3=82=92=E8=A7=A3=E9=99=A4?= =?UTF-8?q?=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-sakura.yml | 2 ++ appveyor.yml | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-sakura.yml b/.github/workflows/build-sakura.yml index 6d7c69e703..45ccf3a8b7 100644 --- a/.github/workflows/build-sakura.yml +++ b/.github/workflows/build-sakura.yml @@ -49,6 +49,8 @@ jobs: steps: ## see https://github.com/actions/checkout - uses: actions/checkout@v2 + with: + fetch-depth: 0 ## see https://github.com/microsoft/setup-msbuild - name: Add msbuild to PATH diff --git a/appveyor.yml b/appveyor.yml index 959d7b5941..90302c0887 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,8 +8,9 @@ platform: - Win32 - x64 -# set clone depth -clone_depth: 5 +# comment-out clone_depth to fetch entire repository. +## set clone depth +#clone_depth: 5 # see "Skip commits" at https://www.appveyor.com/docs/how-to/filtering-commits/#commit-files-github-and-bitbucket-only skip_commits: