From 1c1e3aaf5a3b879173d5d8252f24695235885261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Thu, 26 Oct 2023 20:00:40 +0200 Subject: [PATCH] Enforce build numbers of official builds in build.sh Also fix the current build numbers. --- .github/build.sh | 39 +++++++++++++++++++++++++++++++++++---- meson_options.txt | 4 ++-- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/.github/build.sh b/.github/build.sh index 1d9305388..fd02a3568 100755 --- a/.github/build.sh +++ b/.github/build.sh @@ -246,13 +246,21 @@ if [[ $RELEASE_TYPE == stable ]]; then fi if [[ $stable_or_beta == yes ]]; then xyz=$(echo $RELEASE_NAME | cut -d 'v' -f 2 | cut -d 'b' -f 1) # $RELEASE_NAME is vX.Y.Z or vX.Y.Zb - meson_configure+=$'\t'-Ddisplay_version_major=$(echo $xyz | cut -d '.' -f 1) - meson_configure+=$'\t'-Ddisplay_version_minor=$(echo $xyz | cut -d '.' -f 2) - meson_configure+=$'\t'-Dbuild_num=$(echo $xyz | cut -d '.' -f 3) + display_version_major=$(echo $xyz | cut -d '.' -f 1) + display_version_minor=$(echo $xyz | cut -d '.' -f 2) + build_num=$(echo $xyz | cut -d '.' -f 3) + if [[ $MOD_ID != 0 ]]; then + meson_configure+=$'\t'-Ddisplay_version_major=$display_version_major + meson_configure+=$'\t'-Ddisplay_version_minor=$display_version_minor + meson_configure+=$'\t'-Dbuild_num=$build_num + fi fi if [[ $RELEASE_TYPE == snapshot ]]; then + build_num=$(echo $RELEASE_NAME | cut -d '-' -f 2) # $RELEASE_NAME is snapshot-X meson_configure+=$'\t'-Dsnapshot=true - meson_configure+=$'\t'-Dbuild_num=$(echo $RELEASE_NAME | cut -d '-' -f 2) # $RELEASE_NAME is snapshot-X + if [[ $MOD_ID != 0 ]]; then + meson_configure+=$'\t'-Dbuild_num=$build_num + fi fi if [[ $RELEASE_TYPE == snapshot ]] && [[ $MOD_ID != 0 ]]; then >&2 echo "mods and snapshots do not mix" @@ -357,6 +365,29 @@ meson_configure+=$'\t'-Dc_link_args=[$c_link_args] meson_configure+=$'\t'-Dcpp_link_args=[$c_link_args] $meson_configure build cd build + +function verify_version_component() { + local key=$1 + local expected=$2 + local actual=$(jq -r '.[] | select(.name == "'$key'") | .value' < meson-info/intro-buildoptions.json) + if [[ $actual != $expected ]]; then + >&2 echo "meson option $key expected to be $expected, is instead $actual" + exit 1 + fi +} +if [[ $stable_or_beta == yes ]] && [[ $MOD_ID == 0 ]]; then + verify_version_component display_version_major $display_version_major + verify_version_component display_version_minor $display_version_minor + verify_version_component build_num $build_num + verify_version_component upstream_version_major $display_version_major + verify_version_component upstream_version_minor $display_version_minor + verify_version_component upstream_build_num $build_num +fi +if [[ $RELEASE_TYPE == snapshot ]] && [[ $MOD_ID == 0 ]]; then + verify_version_component build_num $build_num + verify_version_component upstream_build_num $build_num +fi + strip=strip objcopy=objcopy strip_target=$ASSET_PATH diff --git a/meson_options.txt b/meson_options.txt index 016c61c9d..44a15d4cb 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -54,7 +54,7 @@ option( 'build_num', type: 'integer', min: 0, - value: 352, + value: 353, description: 'Build number, should be strictly monotonously increasing across public releases' ) option( @@ -75,7 +75,7 @@ option( 'upstream_build_num', type: 'integer', min: 0, - value: 352, + value: 353, description: 'Upstream build number, mod owners should not change this but merge upstream changes to it' ) option(