From d38c9d1386c9071e1b89affde154ce02ccb1709a Mon Sep 17 00:00:00 2001
From: Tobias Frisch <tfrisch@uni-koblenz.de>
Date: Mon, 13 Jun 2022 10:12:40 +0200
Subject: [PATCH] Updated version in Doxyfile automatically

Signed-off-by: Tobias Frisch <tfrisch@uni-koblenz.de>
---
 Doxyfile               | 2 +-
 scripts/release.sh     | 2 +-
 scripts/upload_docs.sh | 7 +++++++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/Doxyfile b/Doxyfile
index 77eff3be..598b40f6 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -38,7 +38,7 @@ PROJECT_NAME           = "VkCV Framework"
 # could be handy for archiving the generated documentation or if some version
 # control system is used.
 
-PROJECT_NUMBER         = 0.0.1
+PROJECT_NUMBER         = 0.1.0
 
 # Using the PROJECT_BRIEF tag one can provide an optional one line description
 # for a project that appears at the top of each page and should give viewer a
diff --git a/scripts/release.sh b/scripts/release.sh
index 9e4e7a6f..15468cc2 100755
--- a/scripts/release.sh
+++ b/scripts/release.sh
@@ -6,7 +6,7 @@ if [ "$VKCV_BRANCH" != "develop" ]; then
 	exit
 fi
 
-VKCV_VERSION="$(cat include/vkcv/Core.hpp | grep "#define VKCV_FRAMEWORK_VERSION" | awk 'NR == 1 { $1=""; $2=""; print }' | sed -e 's/[^0-9 ]//g' -- | awk '{print $1"."$2"."$3}')"
+VKCV_VERSION="$(grep -oEi "#define.+VKCV_FRAMEWORK_VERSION.+\(VK_MAKE_VERSION\(([0-9]+,.*[0-9]+,.*[0-9]+)\)\)" include/vkcv/Core.hpp | awk 'match($0, /.*\(([0-9]+),.*([0-9]+),.*([0-9]+)\)/, a) {print a[1]"."a[2]"."a[3]}')"
 
 if [ $(git tag | grep "$VKCV_VERSION" | wc -l) -gt 0 ]; then
 	echo "WARNING: Please adjust the version of the framework before uploading a release! (Duplicate version: $VKCV_VERSION)"
diff --git a/scripts/upload_docs.sh b/scripts/upload_docs.sh
index cc63cbf5..656354f6 100755
--- a/scripts/upload_docs.sh
+++ b/scripts/upload_docs.sh
@@ -1,3 +1,10 @@
 #!/bin/sh
+
+VKCV_VERSION="$(grep -oEi "#define.+VKCV_FRAMEWORK_VERSION.+\(VK_MAKE_VERSION\(([0-9]+,.*[0-9]+,.*[0-9]+)\)\)" include/vkcv/Core.hpp | awk 'match($0, /.*\(([0-9]+),.*([0-9]+),.*([0-9]+)\)/, a) {print a[1]"."a[2]"."a[3]}')"
+
+DOXYFILE_TMP=$(mktemp)
+sed -r "s/(PROJECT_NUMBER.*=.*)([0-9]+\.[0-9]+\.[0-9]+)/\1$VKCV_VERSION/" Doxyfile > $DOXYFILE_TMP
+mv $DOXYFILE_TMP Doxyfile
+
 doxygen Doxyfile
 rsync -r doc/html/ vkcv@penguin2.uni-koblenz.de:/home/vkcv/public_html/doc/
-- 
GitLab