1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-25 22:18:30 +02:00

Add branch name to interim version information

This is useful for developers who may have multiple builds of the game
from various different branches and may easily forget which build of the
game is what.

This shows up in the bottom-right corner of the title screen and also
with the `-version` command-line option, and in the status message
printed when building the game.
This commit is contained in:
Misa 2023-01-07 19:18:28 -08:00
parent f35618999f
commit d2b6fb2d06
5 changed files with 17 additions and 3 deletions

View File

@ -13,6 +13,9 @@ extern const int LEN_INTERIM_COMMIT;
extern const char* COMMIT_DATE;
extern const char* BRANCH_NAME;
extern const int LEN_BRANCH_NAME;
#ifdef __cplusplus
} /* extern "C" */
#endif

View File

@ -2,3 +2,6 @@ const char* INTERIM_COMMIT = "@INTERIM_COMMIT@";
const int LEN_INTERIM_COMMIT = sizeof("@INTERIM_COMMIT@") - 1;
const char* COMMIT_DATE = "@COMMIT_DATE@";
const char* BRANCH_NAME = "@BRANCH_NAME@";
const int LEN_BRANCH_NAME = sizeof("@BRANCH_NAME@") - 1;

View File

@ -158,8 +158,9 @@ static void menurender(void)
graphics.Print(264-graphics.len(editionlabel),temp+35,editionlabel,tr, tg, tb);
#endif
#ifdef INTERIM_VERSION_EXISTS
graphics.Print( 310 - (10*8), 210, COMMIT_DATE, tr/2, tg/2, tb/2);
graphics.Print( 310 - LEN_INTERIM_COMMIT * 8, 220, INTERIM_COMMIT, tr/2, tg/2, tb/2);
graphics.Print( 310 - (10*8), 200, COMMIT_DATE, tr/2, tg/2, tb/2);
graphics.Print( 310 - LEN_INTERIM_COMMIT * 8, 210, INTERIM_COMMIT, tr/2, tg/2, tb/2);
graphics.Print( 310 - LEN_BRANCH_NAME * 8, 220, BRANCH_NAME, tr/2, tg/2, tb/2);
#endif
graphics.Print( 310 - (SDL_arraysize(RELEASE_VERSION) - 1) * 8, 230, RELEASE_VERSION, tr/2, tg/2, tb/2);

View File

@ -401,6 +401,7 @@ int main(int argc, char *argv[])
#ifdef INTERIM_VERSION_EXISTS
puts(COMMIT_DATE);
puts(INTERIM_COMMIT);
puts(BRANCH_NAME);
#endif
VVV_exit(0);
}

View File

@ -13,7 +13,13 @@ EXECUTE_PROCESS(
OUTPUT_STRIP_TRAILING_WHITESPACE
)
MESSAGE(STATUS "This is interim commit ${INTERIM_COMMIT} (committed ${COMMIT_DATE})")
EXECUTE_PROCESS(
COMMAND "${GIT_EXECUTABLE}" branch --show-current
OUTPUT_VARIABLE BRANCH_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE
)
MESSAGE(STATUS "This is interim commit ${INTERIM_COMMIT} (committed ${COMMIT_DATE}) on branch ${BRANCH_NAME}")
# Take the template file and replace the macros with what we have
CONFIGURE_FILE(${INPUT_FILE} ${OUTPUT_FILE})