From 892cfe943ee5cf2001c74a1d39ed8496ba5272db Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Fri, 10 Dec 2021 19:50:17 +0100 Subject: [PATCH] Add script to bump version The version must now be bumped at 4 different places. Add a script to bump automatically: ./bump_version 1.23.4 --- bump_version | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 bump_version diff --git a/bump_version b/bump_version new file mode 100755 index 00000000..a0963666 --- /dev/null +++ b/bump_version @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# +# This script bump scrcpy version by editing all the necessary files. +# +# Usage: +# +# ./bump_version 1.23.4 +# +# Then check the diff manually to confirm that everything is ok. + +set -e + +if [[ $# != 1 ]] +then + echo "Syntax: $0 " >&2 + exit 1 +fi + +VERSION="$1" + +a=( ${VERSION//./ } ) +MAJOR="${a[0]:-0}" +MINOR="${a[1]:-0}" +PATCH="${a[2]:-0}" + +# If VERSION is 1.23.4, then VERSION_CODE is 12304 +VERSION_CODE="$(( $MAJOR * 10000 + $MINOR * 100 + "$PATCH" ))" + +echo "$VERSION: major=$MAJOR minor=$MINOR patch=$PATCH [versionCode=$VERSION_CODE]" +sed -i "s/^\(\s*version: \)'[^']*'/\1'$VERSION'/" meson.build +sed -i "s/^\(\s*versionCode \).*/\1$VERSION_CODE/;s/^\(\s*versionName \).*/\1\"$VERSION\"/" server/build.gradle +sed -i "s/^\(SCRCPY_VERSION_NAME=\).*/\1$VERSION/" server/build_without_gradle.sh +sed -i "s/^\(\s*VALUE \"ProductVersion\", \)\"[^\"]*\"/\1\"$VERSION\"/" app/scrcpy-windows.rc +echo done