Skip to content
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

バージョン情報で git の commit hash を表示する #19

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sakura/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@
/_UpgradeReport_Files
/ipch
/UpgradeLog.XML
/.vs
25 changes: 19 additions & 6 deletions sakura/preBuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,26 @@ HeaderMake -in=..\sakura_core\Funccode_x.hsrc -out=..\sakura_core\Funccode_defin
HeaderMake -in=..\sakura_core\Funccode_x.hsrc -out=..\sakura_core\Funccode_enum.h -mode=enum -enum=EFunctionCode
MakefileMake -file=..\sakura_core\Makefile -dir=..\sakura_core

SubWCRev.exe "..\\" "..\sakura_core\svnrev_template.h" "..\sakura_core\svnrev.h"
if %ERRORLEVEL% NEQ 0 (
echo Automatic revision update unavailable, using generic template instead.
echo You can safely ignore this message - see svnrev.h for details.
copy /Y "..\sakura_core\svnrev_unknown.h" "..\sakura_core\svnrev.h"
set GITREV_H=..\sakura_core\gitrev.h

for /f "usebackq" %%s in (`git show -s --format^=%%H`) do (
set COMMITID=%%s
)
for /f "usebackq" %%s in (`git show -s --format^=%%h`) do (
set SHORT_COMMITID=%%s
)

type nul > %GITREV_H%
if "%COMMITID%" == "" (
type nul >> %GITREV_H%
) else (
echo #define GIT_COMMIT_HASH "%COMMITID%" >> %GITREV_H%
)
if "%SHORT_COMMITID%" == "" (
type nul >> %GITREV_H%
) else (
echo #define GIT_SHORT_COMMIT_HASH "%SHORT_COMMITID%" >> %GITREV_H%
)

ENDLOCAL
:: Always return an errorlevel of 0 -- this allows compilation to continue if SubWCRev failed.
rem exit 0
2 changes: 1 addition & 1 deletion sakura/sakura_vc2017.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@
<ClInclude Include="..\sakura_core\sakura_rc.h" />
<ClInclude Include="..\sakura_core\StdAfx.h" />
<ClInclude Include="..\sakura_core\String_define.h" />
<ClInclude Include="..\sakura_core\svnrev.h" />
<ClInclude Include="..\sakura_core\gitrev.h" />
<ClInclude Include="..\sakura_core\typeprop\CDlgKeywordSelect.h" />
<ClInclude Include="..\sakura_core\typeprop\CDlgSameColor.h" />
<ClInclude Include="..\sakura_core\typeprop\CDlgTypeAscertain.h" />
Expand Down
3 changes: 0 additions & 3 deletions sakura/sakura_vc2017.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,6 @@
<ClInclude Include="..\sakura_core\StdAfx.h">
<Filter>Other Files</Filter>
</ClInclude>
<ClInclude Include="..\sakura_core\svnrev.h">
<Filter>Other Files</Filter>
</ClInclude>
<ClInclude Include="..\sakura_core\String_define.h">
<Filter>Other Files</Filter>
</ClInclude>
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/svnrev.h
/gitrev.h
17 changes: 9 additions & 8 deletions sakura_core/dlg/CDlgAbout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "uiparts/HandCursor.h"
#include "util/file.h"
#include "util/module.h"
#include "svnrev.h"
#include "gitrev.h"
#include "sakura_rc.h" // 2002/2/10 aroka ���A
#include "sakura.hh"

Expand Down Expand Up @@ -152,7 +152,8 @@ BOOL CDlgAbout::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam )
// 2010.04.15 Moca �R���p�C�����𕪗�/WIN�w�b�_,N_SHAREDATA_VERSION�lj�

// �ȉ��̌`���ŏo��
//�T�N���G�f�B�^ Ver. 2.0.0.0 (Rev.9999)
//�T�N���G�f�B�^ Ver. 2.0.0.0
//(GitHash xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
//
// Share Ver: 96
// Compile Info: V 1400 WR WIN600/I601/C000/N600
Expand All @@ -165,12 +166,12 @@ BOOL CDlgAbout::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam )
// �o�[�W����&���r�W�������
DWORD dwVersionMS, dwVersionLS;
GetAppVersionInfo( NULL, VS_VERSION_INFO, &dwVersionMS, &dwVersionLS );
#if (SVN_REV == 0)
auto_sprintf( szMsg, _T("Ver. %d.%d.%d.%d\r\n"),
HIWORD( dwVersionMS ),
LOWORD( dwVersionMS ),
HIWORD( dwVersionLS ),
LOWORD( dwVersionLS )
#if defined(GIT_COMMIT_HASH)
auto_sprintf(szMsg, _T("Ver. %d.%d.%d.%d\r\n(GitHash ") _T(GIT_COMMIT_HASH) _T(")\r\n"),
HIWORD(dwVersionMS),
LOWORD(dwVersionMS),
HIWORD(dwVersionLS),
LOWORD(dwVersionLS)
);
#else
auto_sprintf( szMsg, _T("Ver. %d.%d.%d.%d (Rev.") _T(SVN_REV_STR) _T(")\r\n"),
Expand Down
6 changes: 3 additions & 3 deletions sakura_core/sakura_rc.rc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef SAKURA_LANG_RESOURCE
#include "sakura_rc.h"
#include "Funccode_define.h"
#include "svnrev.h"
#include "gitrev.h"
#include "String_define.h"
#else
#include "sakura_lang.h"
Expand Down Expand Up @@ -2811,8 +2811,8 @@ BEGIN
VALUE "OriginalFilename", "sakura.exe\0"
VALUE "ProductName", "�T�N���G�f�B�^\0"
VALUE "ProductVersion", PR_VER_STR
#if (SVN_REV != 0)
" (Rev." SVN_REV_STR ")"
#if defined(GIT_SHORT_COMMIT_HASH)
" (GitHash " GIT_SHORT_COMMIT_HASH ")"
#endif
#ifdef _DEBUG
" Debug version"
Expand Down
2 changes: 0 additions & 2 deletions sakura_core/svnrev_template.h

This file was deleted.

2 changes: 0 additions & 2 deletions sakura_core/svnrev_unknown.h

This file was deleted.