From b671955a54ea7735b70bcf6400b07fa799877ebd Mon Sep 17 00:00:00 2001 From: Sebastian Ullrich Date: Mon, 4 Nov 2024 11:32:50 +0100 Subject: [PATCH 1/2] feat: tag prerelease builds with `-pre` --- src/CMakeLists.txt | 2 ++ src/library/util.cpp | 6 +----- src/version.h.in | 2 ++ 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1ddb9907d8fb..8e9a59a2b6e8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,6 +17,8 @@ set(LEAN_SPECIAL_VERSION_DESC "" CACHE STRING "Additional version description li set(LEAN_VERSION_STRING "${LEAN_VERSION_MAJOR}.${LEAN_VERSION_MINOR}.${LEAN_VERSION_PATCH}") if (LEAN_SPECIAL_VERSION_DESC) string(APPEND LEAN_VERSION_STRING "-${LEAN_SPECIAL_VERSION_DESC}") +elseif (NOT LEAN_VERSION_IS_RELEASE) + string(APPEND LEAN_VERSION_STRING "-pre") endif() set(LEAN_PLATFORM_TARGET "" CACHE STRING "LLVM triple of the target platform") diff --git a/src/library/util.cpp b/src/library/util.cpp index 47955c4ae6f2..e6d626bfb97e 100644 --- a/src/library/util.cpp +++ b/src/library/util.cpp @@ -861,11 +861,7 @@ void initialize_library_util() { sstream out; - out << LEAN_VERSION_MAJOR << "." - << LEAN_VERSION_MINOR << "." << LEAN_VERSION_PATCH; - if (std::strlen(LEAN_SPECIAL_VERSION_DESC) > 0) { - out << "-" << LEAN_SPECIAL_VERSION_DESC; - } + out << LEAN_VERSION_STRING; g_short_version_string = new std::string(out.str()); if (std::strlen(LEAN_PLATFORM_TARGET) > 0) { out << ", " << LEAN_PLATFORM_TARGET; diff --git a/src/version.h.in b/src/version.h.in index 027948c08eab..e44d0579907c 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -7,4 +7,6 @@ // Additional version description like "nightly-2018-03-11" #define LEAN_SPECIAL_VERSION_DESC "@LEAN_SPECIAL_VERSION_DESC@" +#define LEAN_VERSION_STRING "@LEAN_VERSION_STRING@" + #define LEAN_PLATFORM_TARGET "@LEAN_PLATFORM_TARGET@" From 6d302063a6d8620e6d5afddd7c8b0938e930a66f Mon Sep 17 00:00:00 2001 From: Sebastian Ullrich Date: Tue, 5 Nov 2024 10:49:29 +0100 Subject: [PATCH 2/2] expand lean_version docstring --- src/library/module.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/library/module.cpp b/src/library/module.cpp index f03bd7befba9..dad1df464906 100644 --- a/src/library/module.cpp +++ b/src/library/module.cpp @@ -61,7 +61,9 @@ struct olean_header { 0b0; #endif // 33 bytes: Lean version string, padded with '\0' to the right - // e.g. "4.12.0-nightly-2024-10-18". May not be null-terminated. + // e.g. "4.12.0-nightly-2024-10-18". Other suffixes after the version + // triple currently in use are `-rcN` for some `N` and `-pre` for any + // other non-release commit. Not necessarily null-terminated. char lean_version[33]; // 81b008650766442a0dfa9faa796e4588c9d7d3a1 // 40 bytes: build githash, padded with `\0` to the right