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

Short git hash #28

Merged
merged 16 commits into from
Oct 29, 2023
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
47 changes: 40 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,21 @@ jobs:
platform: x64

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
fetch-depth: 0
fetch-tags: true
ref: ${{ github.event.pull_request.head.sha }}

- uses: actions/checkout@v4
if: github.event_name != 'pull_request'
with:
fetch-depth: 0
fetch-tags: true

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
uses: microsoft/setup-msbuild@v1.3.1

- name: Create Build Environment
run: cmake -E make_directory ${{ github.workspace }}/build
Expand Down Expand Up @@ -89,7 +100,18 @@ jobs:
portable: [Non-Portable]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
fetch-depth: 0
fetch-tags: true
ref: ${{ github.event.pull_request.head.sha }}

- uses: actions/checkout@v4
if: github.event_name != 'pull_request'
with:
fetch-depth: 0
fetch-tags: true

- name: Create Build Environment
run: |
Expand Down Expand Up @@ -155,7 +177,18 @@ jobs:
portable: [Non-Portable]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
fetch-depth: 0
fetch-tags: true
ref: ${{ github.event.pull_request.head.sha }}

- uses: actions/checkout@v4
if: github.event_name != 'pull_request'
with:
fetch-depth: 0
fetch-tags: true

- name: Create Build Environment
run: |
Expand Down Expand Up @@ -205,7 +238,7 @@ jobs:
needs: [msvc, ubuntu, macos]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand Down Expand Up @@ -236,7 +269,7 @@ jobs:
needs: [msvc, ubuntu, macos]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand Down Expand Up @@ -291,7 +324,7 @@ jobs:
zip: false

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand Down
16 changes: 12 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,18 @@ else()
message(STATUS "SOURCE_DATE_EPOCH is set ($ENV{SOURCE_DATE_EPOCH}): SOURCE_DATE set to \"${SOURCE_DATE}\"")
endif()

# Current Git SHA1 hash
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_HASH)
message(STATUS "Git revision is ${GIT_HASH}")
# Current Git tag/version
# ideally we would separate the hash suffix into its own variable, but sed is not available everywhere
execute_process(
COMMAND "git" "describe" "--tag"
OUTPUT_VARIABLE GIT_TAG
RESULT_VARIABLE GIT_TAG_ERROR
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(GIT_TAG_ERROR AND NOT GIT_TAG_ERROR EQUAL 0)
message(WARNING "Unable to determine Git tag")
set(GIT_TAG vUNKNOWN)
endif()
message(STATUS "Git tag is ${GIT_TAG}")

configure_file(shared/qcommon/q_version.h.in shared/qcommon/q_version.h @ONLY)

Expand Down
123 changes: 0 additions & 123 deletions cmake/Modules/GetGitRevisionDescription.cmake

This file was deleted.

38 changes: 0 additions & 38 deletions cmake/Modules/GetGitRevisionDescription.cmake.in

This file was deleted.

3 changes: 2 additions & 1 deletion codemp/cgame/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ set(MPCGameIncludeDirectories
"${MPDir}"
"${SharedDir}"
"${GSLIncludeDirectory}"
"${CMAKE_BINARY_DIR}/shared"
)
if(WIN32)
set(MPCGameLibraries "odbc32" "odbccp32") # what are these even?
Expand Down Expand Up @@ -112,7 +113,7 @@ set(MPCGameCommonFiles
"${MPDir}/qcommon/q_shared.h"
"${MPDir}/qcommon/qfiles.h"
"${MPDir}/qcommon/tags.h"

${SharedCommonFiles}
)
source_group("common" FILES ${MPCGameCommonFiles})
Expand Down
41 changes: 0 additions & 41 deletions codemp/client/cl_console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,46 +560,6 @@ void Con_Init (void) {
Cmd_AddCommand( "clear", Con_Clear_f, "Clear console text" );
Cmd_AddCommand( "condump", Con_Dump_f, "Dump console text to file" );
Cmd_SetCommandCompletionFunc( "condump", Cmd_CompleteTxtName );

{//build version string for console
int day, year;
char month[4];

if (sscanf(SOURCE_DATE, "%s %i %i", month, &day, &year) == 3) {
int mm = 0;

//sry..
if (month[0] == 'J' && month[1] == 'a' && month[2] == 'n')
mm = 1;
else if (month[0] == 'F')
mm = 2;
else if (month[0] == 'M' && month[1] == 'a' && month[2] == 'r')
mm = 3;
else if (month[0] == 'A' && month[1] == 'p')
mm = 4;
else if (month[0] == 'M' && month[1] == 'a' && month[2] == 'y')
mm = 5;
else if (month[0] == 'J' && month[1] == 'u' && month[2] == 'n')
mm = 6;
else if (month[0] == 'J' && month[1] == 'u' && month[2] == 'l')
mm = 7;
else if (month[0] == 'A' && month[1] == 'u')
mm = 8;
else if (month[0] == 'S')
mm = 9;
else if (month[0] == 'O')
mm = 10;
else if (month[0] == 'N')
mm = 11;
else if (month[0] == 'D')
mm = 12;

Com_sprintf(version, sizeof(version), "EternalJK: [%02i/%02i/%04i]", mm, day, year);
}
}

if (!version[0])
Q_strncpyz(version, "EternalJK", sizeof(version));
}

/*
Expand Down Expand Up @@ -1017,7 +977,6 @@ void Con_DrawSolidConsole( float frac ) {
SCR_DrawSmallChar(cls.glconfig.vidWidth - (i - x) * con.charWidth, lines - (con.charHeight + con.charHeight / 2) + padding, ts[x]);
}


// draw the text
con.vislines = lines;
rows = (lines-con.charWidth)/con.charWidth; // rows of text to draw
Expand Down
3 changes: 2 additions & 1 deletion codemp/client/cl_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "qcommon/cm_public.h"
#include "qcommon/MiniHeap.h"
#include "qcommon/stringed_ingame.h"
#include "qcommon/game_version.h"
#include "cl_cgameapi.h"
#include "cl_uiapi.h"
#include "cl_lan.h"
Expand Down Expand Up @@ -1045,7 +1046,7 @@ void CL_RequestMotd( void ) {
Info_SetValueForKey( info, "challenge", cls.updateChallenge );
Info_SetValueForKey( info, "renderer", cls.glconfig.renderer_string );
Info_SetValueForKey( info, "rvendor", cls.glconfig.vendor_string );
Info_SetValueForKey( info, "version", com_version->string );
Info_SetValueForKey( info, "version", JK_VERSION_OLD " " PLATFORM_STRING " " SOURCE_DATE );

//If raven starts filtering for this, add this code back in
#if 0
Expand Down
Loading