emulate functionality of generate-version.sh

This commit is contained in:
Gerhard Hoffmann 2023-11-15 11:02:05 +01:00
parent f833d9d13d
commit 94b51b5794

View File

@ -46,7 +46,7 @@ contains( CONFIG, PTU5_YOCTO ) {
} }
TARGET = ATBVMCPlugin TARGET = ATBVMCPlugin
VERSION = "1.0.0" VERSION = "0.8.0"
INTERFACE = VMCInterface INTERFACE = VMCInterface
INTERFACE_DEFINITION = $${PWD}/src/ATBAPP/VMCInterface.h INTERFACE_DEFINITION = $${PWD}/src/ATBAPP/VMCInterface.h
@ -56,26 +56,33 @@ win32 {
BUILD_DATE=$$system("date /t") BUILD_DATE=$$system("date /t")
BUILD_TIME=$$system("time /t") BUILD_TIME=$$system("time /t")
} else { } else {
BUILD_DATE=$$system("date +%d-%m-%y") BUILD_DATE=$$system("date +%d%m%y")
BUILD_TIME=$$system("date +%H:%M:%S") BUILD_TIME=$$system("date +%H%M")
} }
GIT_COMMIT=$$system("git log -n 1 --format=oneline | cut -d' ' -f1") GIT_COMMIT=$$system("git log -n 1 --format=oneline | cut -d' ' -f1")
GIT_DESCRIBE=$$system("git describe") GIT_BRANCH=$$system("git branch --no-color 2> /dev/null | cut -d' ' -f2")
GIT_DESCRIBE=$$system("git describe --dirty --always | tr '-' '_'")
DEV_SUFFIX=""
count(GIT_BRANCH, 2) {
DEV_SUFFIX="_dev"
}
EXTENDED_VERSION="$${VERSION}-$${GIT_COMMIT}" EXTENDED_VERSION="$${VERSION}-$${GIT_COMMIT}"
CONFIG += c++17 CONFIG += c++17
DEFINES+=ATB_QT_VERSION=\\\"$${QT_VERSION}\\\" DEFINES+=ATB_QT_VERSION=\\\"$${QT_VERSION}\\\"
DEFINES+=PLUGIN_BUILD_DATE=\\\"$$BUILD_DATE\\\" DEFINES+=PLUGIN_BUILD_DATE=\\\"$${BUILD_DATE}\\\"
DEFINES+=PLUGIN_BUILD_TIME=\\\"$$BUILD_TIME\\\" DEFINES+=PLUGIN_BUILD_TIME=\\\"$${BUILD_TIME}\\\"
DEFINES+=PLUGIN_EXTENDED_VERSION=\\\"$${EXTENDED_VERSION}\\\" DEFINES+=PLUGIN_EXTENDED_VERSION=\\\"$${EXTENDED_VERSION}\\\"
DEFINES+=INTERFACE=\\\"VMCInterface\\\" DEFINES+=INTERFACE=\\\"VMCInterface\\\"
DEFINES+=INTERFACE_VERSION=\\\"eu.atb.ptu.plugin.VMCInterface/1.0\\\" DEFINES+=INTERFACE_VERSION=\\\"eu.atb.ptu.plugin.VMCInterface/1.0\\\"
DEFINES+=PLUGIN_NAME=\\\"ATBVMCPlugin\\\" DEFINES+=PLUGIN_NAME=\\\"ATBVMCPlugin\\\"
DEFINES+=PLUGIN_VERSION=\\\"$${PLUGIN_BUILD_DATE}_$${PLUGIN_BUILD_TIME}\\\" DEFINES+=PLUGIN_VERSION=\\\"$${BUILD_DATE}_$${BUILD_TIME}\\\"
DEFINES+=PLUGIN_GIT_DESCRIBE=\\\"$${GIT_DESCRIBE}_$${GIT_BRANCH}$${DEV_SUFFIX}\\\"
# Default rules for deployment. # Default rules for deployment.
#qnx: target.path = /tmp/$${TARGET}/bin #qnx: target.path = /tmp/$${TARGET}/bin
@ -101,6 +108,3 @@ SOURCES += \
src/ATBAPP/support/VMC/SendBuffer.cpp \ src/ATBAPP/support/VMC/SendBuffer.cpp \
src/ATBAPP/support/VMC/vmc.cpp \ src/ATBAPP/support/VMC/vmc.cpp \
src/ATBAPP/support/VendingData.cpp src/ATBAPP/support/VendingData.cpp
OTHER_FILES += \
plugins/metadata.json