Skip to content

Commit

Permalink
CMake: Fix calculate_xray_build_id breaking for dates before 31.01.…
Browse files Browse the repository at this point in the history
…1999

Fixes #1611
  • Loading branch information
AMS21 committed May 14, 2024
1 parent 73338b3 commit 04462d6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmake/utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ function(calculate_xray_build_id output)
list(GET current_date_list 1 CURRENT_DATE_MONTH)
list(GET current_date_list 2 CURRENT_DATE_YEAR)

# Check if current date is before the start date
# See issue#1611
if( (CURRENT_DATE_YEAR LESS XRAY_START_YEAR)
OR ( (CURRENT_DATE_YEAR EQUAL XRAY_START_YEAR)
AND (CURRENT_DATE_MONTH LESS XRAY_START_MONTH)
OR ( (CURRENT_DATE_MONTH EQUAL XRAY_START_MONTH)
AND (CURRENT_DATE_DAY LESS XRAY_START_DAY) ) ) )
set(${output} 0 PARENT_SCOPE)
return()
endif()

# Calculate XRAY build ID
math(EXPR build_id "(${CURRENT_DATE_YEAR} - ${XRAY_START_YEAR}) * 365 + ${CURRENT_DATE_DAY} - ${XRAY_START_DAY}")

Expand Down

0 comments on commit 04462d6

Please sign in to comment.