Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

Commit

Permalink
fix: Version information if built in Buildroot
Browse files Browse the repository at this point in the history
The Buildroot custom package build used the wrong version information
from remote-os instead of the module's git repository.
Since the git metadata information is not available during Buildroot
build, a QMake parameter is used instead.
  • Loading branch information
zehnm committed Oct 2, 2020
1 parent 712b6b1 commit 7b6689a
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions bangolufsen.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,24 @@ TEMPLATE = lib
CONFIG += c++14 plugin
QT += websockets core quick

# Plugin VERSION
GIT_HASH = "$$system(git log -1 --format="%H")"
GIT_BRANCH = "$$system(git rev-parse --abbrev-ref HEAD)"
GIT_VERSION = "$$system(git describe --match "v[0-9]*" --tags HEAD --always)"
# === Version and build information ===========================================
# If built in Buildroot use custom package version, otherwise Git
isEmpty(YIO_BUILD_VERSION) {
GIT_VERSION = "$$system(git describe --match "v[0-9]*" --tags HEAD --always)"
GIT_HASH = "$$system(git log -1 --format="%H")"
GIT_BRANCH = "$$system(git rev-parse --abbrev-ref HEAD)"
} else {
GIT_VERSION = $$YIO_BUILD_VERSION
contains(GIT_VERSION, "^v?(0|[1-9]\d*)\..*") {
# (simplified) version string = regular release
GIT_HASH = ""
GIT_BRANCH = "master"
} else {
# git hash as version = custom build
GIT_HASH = $$YIO_BUILD_VERSION
GIT_BRANCH = ""
}
}
BO_VERSION = $$replace(GIT_VERSION, v, "")
DEFINES += PLUGIN_VERSION=\\\"$$BO_VERSION\\\"

Expand All @@ -16,6 +30,8 @@ win32 {
} else {
BUILDDATE=$$system(date +"%Y-%m-%dT%H:%M:%S")
}
# =============================================================================

CONFIG(debug, debug|release) {
DEBUG_BUILD = true
} else {
Expand Down

0 comments on commit 7b6689a

Please sign in to comment.