generated from ut-issl/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from ut-issl/feature/refactor-git-revision
Pre Release (v3.9.0-beta.6): git_revision.cをどうにかする
- Loading branch information
Showing
35 changed files
with
352 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
Examples/2nd_obc_user/src/src_user/Script/Git/revision.bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
@ECHO OFF | ||
REM generate C header for Git revision | ||
|
||
REM current directoryに移動(src_user/Script/Git) | ||
cd /d %~dp0 | ||
|
||
REM src_userに移動 | ||
cd ..\.. | ||
|
||
for /f "usebackq" %%a in (`"git log --pretty=format:%%H -1"`) do set git_rev_user=%%a | ||
for /f "usebackq" %%a in (`"git log --pretty=format:%%h -1"`) do set git_rev_user_short=%%a | ||
|
||
REM cd ..\..\src_core | ||
|
||
REM generate header | ||
REM MEMO: このヒアドキュメントもどきの書き方はwineのcmd.exe(Windows 6.1.7601)だと動かない? | ||
( | ||
echo.#ifndef GIT_REVISION_CONFIG_H_ | ||
echo.#define GIT_REVISION_CONFIG_H_ | ||
echo. | ||
echo./* This file is generated by src_user/Script/Git/revision.bat */ | ||
echo. | ||
call ..\src_core\Script\Git\revision.bat | ||
echo.#define GIT_REVISION_C2A_USER "%git_rev_user%" | ||
echo.#define GIT_REVISION_C2A_USER_SHORT 0x%git_rev_user_short% | ||
echo. | ||
echo.#endif // GIT_REVISION_CONFIG_H_ | ||
) > Settings\git_revision_config.h | ||
|
||
REM current directoryに移動(src_user/Script/Git) | ||
cd /d %~dp0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
# generate C header for Git revision | ||
|
||
cd $(dirname $0) # src/src_user/Script/Git | ||
cd ../../ # src/src_user | ||
|
||
# get core revision | ||
git_revs_core=$(../src_core/Script/Git/revision.sh) | ||
|
||
git_rev_user=$(git log --pretty=format:%H -1) | ||
git_rev_user_short=$(git log --pretty=format:%h -1) | ||
|
||
tee Settings/git_revision_config.h << EOS | ||
#ifndef GIT_REVISION_CONFIG_H_ | ||
#define GIT_REVISION_CONFIG_H_ | ||
/* This file is generated by src_user/Script/Git/revision.sh */ | ||
#define C2A_GIT_REVISION_GENERATED | ||
${git_revs_core} | ||
#define GIT_REVISION_C2A_USER "${git_rev_user}" | ||
#define GIT_REVISION_C2A_USER_SHORT 0x${git_rev_user_short} | ||
#endif // GIT_REVISION_CONFIG_H_ | ||
EOS |
29 changes: 0 additions & 29 deletions
29
Examples/2nd_obc_user/src/src_user/Script/git_revision.bat
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
Examples/2nd_obc_user/src/src_user/Script/git_revision.tmp
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
Examples/2nd_obc_user/src/src_user/Settings/git_revision_config.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#ifndef GIT_REVISION_CONFIG_H_ | ||
#define GIT_REVISION_CONFIG_H_ | ||
|
||
/** | ||
* このファイルは自動生成される場合と設定だけを書く場合があります. | ||
* C2A core/userのcommit hashはコマンドラインオプションないしこのファイルでdefineされ, | ||
* 実際の埋め込みについてはsrc_core/Librari/git_revision.hとsrc_core/c2a_core_main.cが制御します. | ||
*/ | ||
|
||
#if 1 // このuserはCMakeでビルドするのでこれを使う | ||
/*!< @brief CMakeでビルドする時など,コマンドラインオプションからcommit hashを流し込む場合の設定 | ||
* この場合,以下の定数をコマンドラインオプション(-D)などで設定してください | ||
* GIT_REVISION_C2A_CORE C2A coreのcommit hash(文字列) | ||
* GIT_REVISION_C2A_CORE_SHORT C2A coreのcommit hash short(0xから始まる数値) | ||
* GIT_REVISION_C2A_USER C2A userのcommit hash(文字列) | ||
* GIT_REVISION_C2A_USER_SHORT C2A userのcommit hash short(0xから始まる数値) | ||
*/ | ||
|
||
#define C2A_GIT_REVISION_FROM_OPTION | ||
#endif // from option | ||
|
||
#if 0 | ||
/*!< @brief このファイルを自動生成する場合 | ||
* src_user/Script/Git/revision.sh/batが以下のような内容でこのファイルを生成します | ||
*/ | ||
|
||
/* This file is generated by src_user/Script/Git/revision.sh */ | ||
#define C2A_GIT_REVISION_GENERATED | ||
|
||
#define GIT_REVISION_C2A_CORE "1234567890123456789012345678901234567890" | ||
#define GIT_REVISION_C2A_CORE_SHORT 0x1234567 | ||
#define GIT_REVISION_C2A_USER "1234567890123456789012345678901234567890" | ||
#define GIT_REVISION_C2A_USER_SHORT 0x1234567 | ||
#endif // generated version | ||
|
||
#if 0 | ||
/*!< @brief commit hashを埋め込まない場合の設定 | ||
* 実際には0が埋め込まれます | ||
*/ | ||
|
||
#define C2A_GIT_REVISION_IGNORE | ||
#endif | ||
|
||
#endif // GIT_REVISION_CONFIG_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.