Fix version.txt parsing in android builds with QtCreator >= 6

This commit is contained in:
Michael Zanetti 2022-01-20 12:03:33 +01:00
parent dd59998d86
commit 30d148931d
2 changed files with 5 additions and 3 deletions

View File

@ -83,7 +83,9 @@ android {
LIBS += -L$${top_builddir}/libnymea-app/$${ANDROID_TARGET_ARCH}
PRE_TARGETDEPS += $$top_builddir/libnymea-app/$${ANDROID_TARGET_ARCH}/libnymea-app.a
QMAKE_POST_LINK += $$QMAKE_COPY $$shell_path($$top_srcdir/version.txt) $$shell_path($$top_builddir/)
versioninfo.files = ../version.txt
versioninfo.path = /
INSTALLS += versioninfo
DISTFILES += \
$$ANDROID_PACKAGE_SOURCE_DIR/AndroidManifest.xml \

View File

@ -1,8 +1,8 @@
#!/bin/sh
BASEDIR=$(dirname "$0")
NYMEA_APP_VERSION=`cat $BASEDIR/../version.txt | head -n 1`
NYMEA_APP_VERSION_CODE=`cat $BASEDIR/../version.txt | head -n 2 | tail -n 1`
NYMEA_APP_VERSION=`cat $BASEDIR/version.txt | head -n 1`
NYMEA_APP_VERSION_CODE=`cat $BASEDIR/version.txt | head -n 2 | tail -n 1`
echo "Setting version to $NYMEA_APP_VERSION ($NYMEA_APP_VERSION_CODE)"
sed -i "s/android:versionName=\"[0-9\.a-zA-Z_]*\"/android:versionName=\"$NYMEA_APP_VERSION\"/" AndroidManifest.xml
sed -i "s/android:versionCode=\"[0-9]*\"/android:versionCode=\"$NYMEA_APP_VERSION_CODE\"/" AndroidManifest.xml