From 0123d71419684e1ef3fb77cc922d03006b4fe79f Mon Sep 17 00:00:00 2001 From: Andrei Toterman Date: Tue, 3 Dec 2024 12:11:48 +0100 Subject: [PATCH 1/5] [gui] remove version from pubspec.yaml --- src/client/gui/pubspec.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/client/gui/pubspec.yaml b/src/client/gui/pubspec.yaml index 85c8c31047..29ca48340b 100644 --- a/src/client/gui/pubspec.yaml +++ b/src/client/gui/pubspec.yaml @@ -2,8 +2,6 @@ name: multipass_gui description: A new Flutter project. publish_to: 'none' -version: 1.15.0 - environment: sdk: '>=3.0.3 <4.0.0' From 1cb6a9dc3c078ed039ff0703c79b41ce3feb9a16 Mon Sep 17 00:00:00 2001 From: Andrei Toterman Date: Wed, 4 Dec 2024 15:26:47 +0100 Subject: [PATCH 2/5] [cmake] split mp version into semver and build version --- CMakeLists.txt | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a2d1e5d4a..0ffc68be13 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,7 +137,7 @@ find_package(Qt6 COMPONENTS Core Concurrent Network REQUIRED) # POCO config find_package(Poco REQUIRED COMPONENTS Foundation Zip) -function(determine_version OUTPUT_VARIABLE) +function(determine_version OUTPUT_VARIABLE SEMANTIC_VERSION BUILD_NUMBER) # use upstream repo as the authoritative reference when checking for release status # set -DMULTIPASS_UPSTREAM="" to use the local repository if(MULTIPASS_UPSTREAM) @@ -208,14 +208,34 @@ function(determine_version OUTPUT_VARIABLE) if(VERSION_MATCH) set(${OUTPUT_VARIABLE} ${CMAKE_MATCH_1} PARENT_SCOPE) + set(VERSION_STRING ${CMAKE_MATCH_1}) else() message(FATAL_ERROR "Invalid tag detected: ${NEW_VERSION}") endif() + + # stuff before + is the version and after the + is the build metadata + string(FIND "${VERSION_STRING}" "+" PLUS_POS) + string(SUBSTRING "${VERSION_STRING}" 0 ${PLUS_POS} MULTIPASS_SEMANTIC_VERSION) + if (PLUS_POS GREATER -1) + string(SUBSTRING "${VERSION_STRING}" ${PLUS_POS} -1 MULTIPASS_BUILD_STRING) + # if the build metadata starts with a g, the hexadecimal chars after that are a commit hash + # otherwise, we do not derive any build string + string(REGEX MATCH "^[+]g([a-f0-9]+)" "" "${MULTIPASS_BUILD_STRING}") + set(BUILD_NUMBER_HEX ${CMAKE_MATCH_1}) + endif() + # convert the hexadecimal commit hash to decimal. if none was extracted, this defaults to 0 + # we need it to be decimal because flutter --build-number accepts only decimal chars + math(EXPR MULTIPASS_BUILD_NUMBER "0x0${BUILD_NUMBER_HEX}") + + set(${SEMANTIC_VERSION} ${MULTIPASS_SEMANTIC_VERSION} PARENT_SCOPE) + set(${BUILD_NUMBER} ${MULTIPASS_BUILD_NUMBER} PARENT_SCOPE) endfunction() -determine_version(MULTIPASS_VERSION) +determine_version(MULTIPASS_VERSION MULTIPASS_SEMANTIC_VERSION MULTIPASS_BUILD_NUMBER) set(MULTIPASS_VERSION ${MULTIPASS_VERSION}) message(STATUS "Setting version to: ${MULTIPASS_VERSION}") +message(STATUS "Setting semantic version to: ${MULTIPASS_SEMANTIC_VERSION}") +message(STATUS "Setting build number to: ${MULTIPASS_BUILD_NUMBER}") set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED TRUE) From 7233891f8664c04c67e84c6ede9de12535e479a6 Mon Sep 17 00:00:00 2001 From: Andrei Toterman Date: Tue, 3 Dec 2024 12:12:12 +0100 Subject: [PATCH 3/5] [gui] specify gui version as cli arg on linux --- src/client/gui/CMakeLists.txt.linux | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/gui/CMakeLists.txt.linux b/src/client/gui/CMakeLists.txt.linux index 9400fd29e7..f208b1d406 100644 --- a/src/client/gui/CMakeLists.txt.linux +++ b/src/client/gui/CMakeLists.txt.linux @@ -29,7 +29,7 @@ set(MULTIPASS_GUI_EXECUTABLE_FULL_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${MULTI file(GLOB_RECURSE MULTIPASS_GUI_SOURCE_FILES ${MULTIPASS_GUI_SOURCE_DIR}/lib/*.dart) -set(FLUTTER_BUILD_ARGS --release --suppress-analytics --verbose) +set(FLUTTER_BUILD_ARGS --release --suppress-analytics --verbose --build-name=${MULTIPASS_SEMANTIC_VERSION} --build-number=${MULTIPASS_BUILD_NUMBER}) add_custom_command(OUTPUT ${MULTIPASS_GUI_EXECUTABLE_FULL_PATH} DEPENDS ${MULTIPASS_GUI_SOURCE_FILES} From e5d145776c6b33645cb07fb6268f1ac4d6fc98e3 Mon Sep 17 00:00:00 2001 From: Andrei Toterman Date: Fri, 13 Dec 2024 14:15:17 +0100 Subject: [PATCH 4/5] [cmake] move derivation of version components to own function --- CMakeLists.txt | 5 ++--- src/client/gui/CMakeLists.txt | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ffc68be13..5dfbe06f67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -208,11 +208,12 @@ function(determine_version OUTPUT_VARIABLE SEMANTIC_VERSION BUILD_NUMBER) if(VERSION_MATCH) set(${OUTPUT_VARIABLE} ${CMAKE_MATCH_1} PARENT_SCOPE) - set(VERSION_STRING ${CMAKE_MATCH_1}) else() message(FATAL_ERROR "Invalid tag detected: ${NEW_VERSION}") endif() +endfunction() +function(determine_version_components VERSION_STRING SEMANTIC_VERSION BUILD_NUMBER) # stuff before + is the version and after the + is the build metadata string(FIND "${VERSION_STRING}" "+" PLUS_POS) string(SUBSTRING "${VERSION_STRING}" 0 ${PLUS_POS} MULTIPASS_SEMANTIC_VERSION) @@ -234,8 +235,6 @@ endfunction() determine_version(MULTIPASS_VERSION MULTIPASS_SEMANTIC_VERSION MULTIPASS_BUILD_NUMBER) set(MULTIPASS_VERSION ${MULTIPASS_VERSION}) message(STATUS "Setting version to: ${MULTIPASS_VERSION}") -message(STATUS "Setting semantic version to: ${MULTIPASS_SEMANTIC_VERSION}") -message(STATUS "Setting build number to: ${MULTIPASS_BUILD_NUMBER}") set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED TRUE) diff --git a/src/client/gui/CMakeLists.txt b/src/client/gui/CMakeLists.txt index e8b146283e..37168169a6 100644 --- a/src/client/gui/CMakeLists.txt +++ b/src/client/gui/CMakeLists.txt @@ -12,6 +12,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +determine_version_components(${MULTIPASS_VERSION} MULTIPASS_SEMANTIC_VERSION MULTIPASS_BUILD_NUMBER) +message(STATUS "Setting semantic version to: ${MULTIPASS_SEMANTIC_VERSION}") +message(STATUS "Setting build number to: ${MULTIPASS_BUILD_NUMBER}") + add_library(dart_ffi SHARED ffi/dart_ffi.cpp) target_link_libraries(dart_ffi From 8c246375fb6ec0c9ad052f20f982abb94aaea53b Mon Sep 17 00:00:00 2001 From: Andrei Toterman Date: Wed, 18 Dec 2024 00:19:33 +0100 Subject: [PATCH 5/5] [cmake] remove unneeded function params --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5dfbe06f67..c9aa3ad0d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,7 +137,7 @@ find_package(Qt6 COMPONENTS Core Concurrent Network REQUIRED) # POCO config find_package(Poco REQUIRED COMPONENTS Foundation Zip) -function(determine_version OUTPUT_VARIABLE SEMANTIC_VERSION BUILD_NUMBER) +function(determine_version OUTPUT_VARIABLE) # use upstream repo as the authoritative reference when checking for release status # set -DMULTIPASS_UPSTREAM="" to use the local repository if(MULTIPASS_UPSTREAM) @@ -232,7 +232,7 @@ function(determine_version_components VERSION_STRING SEMANTIC_VERSION BUILD_NUMB set(${BUILD_NUMBER} ${MULTIPASS_BUILD_NUMBER} PARENT_SCOPE) endfunction() -determine_version(MULTIPASS_VERSION MULTIPASS_SEMANTIC_VERSION MULTIPASS_BUILD_NUMBER) +determine_version(MULTIPASS_VERSION) set(MULTIPASS_VERSION ${MULTIPASS_VERSION}) message(STATUS "Setting version to: ${MULTIPASS_VERSION}")