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

Ensure version numbers passed to Windows .rc file are numbers #10358

Merged
merged 3 commits into from Jan 26, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/Java.yml
Expand Up @@ -152,7 +152,7 @@ jobs:
run: >
python scripts/windows_ci.py

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_GENERATOR_PLATFORM=x64 -DJDBC_DRIVER=1 -DBUILD_EXTENSIONS=json -DENABLE_EXTENSION_AUTOLOADING=1 -DENABLE_EXTENSION_AUTOINSTALL=1
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_GENERATOR_PLATFORM=x64 -DJDBC_DRIVER=1 -DBUILD_EXTENSIONS=json -DENABLE_EXTENSION_AUTOLOADING=1 -DENABLE_EXTENSION_AUTOINSTALL=1 -DBUILD_SHELL=0

cmake --build . --config Release
- name: Java Tests
Expand Down
29 changes: 25 additions & 4 deletions tools/shell/CMakeLists.txt
Expand Up @@ -24,18 +24,39 @@ if(NOT AMALGAMATION_BUILD AND NOT WIN32)
target_link_libraries(shell duckdb_utf8proc)
endif()

function(ensure_variable_is_number INPUT_VERSION OUT_RESULT)
if(NOT "${${INPUT_VERSION}}" MATCHES "^[0-9]+$")
message(
WARNING
"VERSION PARAMETER ${INPUT_VERSION} \"${${INPUT_VERSION}}\" IS NOT A NUMBER - SETTING TO 0"
)
set(${OUT_RESULT}
0
PARENT_SCOPE)
else()
set(${OUT_RESULT}
${${INPUT_VERSION}}
PARENT_SCOPE)
endif()
endfunction()

if(WIN32 AND NOT MINGW)
string(TIMESTAMP DUCKDB_COPYRIGHT_YEAR "%Y")
ensure_variable_is_number(DUCKDB_MAJOR_VERSION RC_MAJOR_VERSION)
ensure_variable_is_number(DUCKDB_MINOR_VERSION RC_MINOR_VERSION)
ensure_variable_is_number(DUCKDB_PATCH_VERSION RC_PATCH_VERSION)
ensure_variable_is_number(DUCKDB_DEV_ITERATION RC_DEV_ITERATION)

set(CMAKE_RC_FLAGS
"${CMAKE_RC_FLAGS} -D DUCKDB_VERSION=\"${DUCKDB_VERSION}\"")
set(CMAKE_RC_FLAGS
"${CMAKE_RC_FLAGS} -D DUCKDB_MAJOR_VERSION=\"${DUCKDB_MAJOR_VERSION}\"")
"${CMAKE_RC_FLAGS} -D DUCKDB_MAJOR_VERSION=\"${RC_MAJOR_VERSION}\"")
set(CMAKE_RC_FLAGS
"${CMAKE_RC_FLAGS} -D DUCKDB_MINOR_VERSION=\"${DUCKDB_MINOR_VERSION}\"")
"${CMAKE_RC_FLAGS} -D DUCKDB_MINOR_VERSION=\"${RC_MINOR_VERSION}\"")
set(CMAKE_RC_FLAGS
"${CMAKE_RC_FLAGS} -D DUCKDB_PATCH_VERSION=\"${DUCKDB_PATCH_VERSION}\"")
"${CMAKE_RC_FLAGS} -D DUCKDB_PATCH_VERSION=\"${RC_PATCH_VERSION}\"")
set(CMAKE_RC_FLAGS
"${CMAKE_RC_FLAGS} -D DUCKDB_DEV_ITERATION=\"${DUCKDB_DEV_ITERATION}\"")
"${CMAKE_RC_FLAGS} -D DUCKDB_DEV_ITERATION=\"${RC_DEV_ITERATION}\"")
set(CMAKE_RC_FLAGS
"${CMAKE_RC_FLAGS} -D DUCKDB_COPYRIGHT_YEAR=\"${DUCKDB_COPYRIGHT_YEAR}\"")
target_sources(shell PRIVATE rc/duckdb.rc)
Expand Down