From 929d8523158518bfa760f4d3529802a9f44a669d Mon Sep 17 00:00:00 2001 From: Joel Smith Date: Tue, 14 Jul 2020 13:42:23 -0700 Subject: [PATCH] Add ability to get version from envvar --- ashirt.pro | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/ashirt.pro b/ashirt.pro index 1587f3c..f769dfd 100644 --- a/ashirt.pro +++ b/ashirt.pro @@ -10,10 +10,26 @@ CONFIG += c++11 # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS -# You can also make your code fail to compile if it uses deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 +# App version number +VERSION_TAG_PLAIN = $$getenv(TAG) +equals(VERSION_TAG_PLAIN, "") { + message(No Tag specified. Check if TAG environment variable is set.) + VERSION_TAG_PLAIN = Unknown-Version +} + +VERSION_COMMIT_HASH_PLAIN = $$getenv(COMMIT_SHA) +equals(VERSION_COMMIT_HASH_PLAIN, "") { + message("No commit hash specified. Check if COMMIT_SHA environment variable is set.") + VERSION_COMMIT_HASH_PLAIN = Unknown-SHA +} + +VERSION_TAG=\\\"$$VERSION_TAG_PLAIN\\\" +VERSION_COMMIT_HASH = \\\"$$VERSION_COMMIT_HASH_PLAIN\\\" + +message(Building version [$$VERSION_TAG_PLAIN] using commit [$$VERSION_COMMIT_HASH_PLAIN]) + +DEFINES += "VERSION_TAG=$$VERSION_TAG"\ + "VERSION_COMMIT_HASH=$$VERSION_COMMIT_HASH" INCLUDEPATH += src