From ba76c15d1ecc26c9bcb1024dee98c2e4c61df1fe Mon Sep 17 00:00:00 2001 From: Maschell Date: Mon, 19 Sep 2022 13:15:39 +0200 Subject: [PATCH] Log the module version on each application start --- .github/workflows/ci.yml | 7 +++++++ .github/workflows/pr.yml | 7 +++++++ src/main.cpp | 5 ++++- src/version.h | 2 ++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 src/version.h diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8e0d8d..d7ce711 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,13 @@ jobs: needs: clang-format steps: - uses: actions/checkout@v2 + - name: create version.h + run: | + git_hash=$(git rev-parse --short "$GITHUB_SHA") + cat < ./src/version.h + #pragma once + #define VERSION_EXTRA " (nightly-$git_hash)" + EOF - name: build binary run: | docker build . -t builder diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index f7ed10e..50188ff 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -26,6 +26,13 @@ jobs: needs: clang-format steps: - uses: actions/checkout@v2 + - name: create version.h + run: | + git_hash=$(git rev-parse --short "${{ github.event.pull_request.head.sha }}") + cat < ./src/version.h + #pragma once + #define VERSION_EXTRA " (nightly-$git_hash)" + EOF - name: build binary run: | docker build . -t builder diff --git a/src/main.cpp b/src/main.cpp index d804706..22f821d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,6 +3,7 @@ #include "FileUtils.h" #include "utils/StringTools.h" #include "utils/logger.h" +#include "version.h" #include #include #include @@ -11,6 +12,8 @@ WUMS_MODULE_EXPORT_NAME("homebrew_content_redirection"); WUMS_USE_WUT_DEVOPTAB(); +#define VERSION "v0.2" + WUMS_INITIALIZE() { initLogging(); DEBUG_FUNCTION_LINE("Patch functions"); @@ -29,8 +32,8 @@ WUMS_INITIALIZE() { deinitLogging(); } - WUMS_APPLICATION_STARTS() { + OSReport("Running ContentRedirectionModule " VERSION VERSION_EXTRA "\n"); initLogging(); startFSIOThreads(); } diff --git a/src/version.h b/src/version.h new file mode 100644 index 0000000..66a2c7e --- /dev/null +++ b/src/version.h @@ -0,0 +1,2 @@ +#pragma once +#define VERSION_EXTRA "" \ No newline at end of file