]> Nutra Git (v1) - gamesguru/feather.git/commitdiff
Revert "Don't include commit hash"
authortobtoht <tob@featherwallet.org>
Mon, 29 Aug 2022 12:11:05 +0000 (14:11 +0200)
committertobtoht <tob@featherwallet.org>
Mon, 29 Aug 2022 12:11:05 +0000 (14:11 +0200)
This reverts commit 8b471bfee2f3f92675b6e73d6052de582dda8dd6.

CMakeLists.txt
cmake/VersionFeather.cmake [new file with mode: 0644]
cmake/config-feather.h.cmake
src/assets/about.txt
src/dialog/AboutDialog.cpp
src/dialog/DebugInfoDialog.cpp

index ce8c9fbfc972c6d48074621362aa35cc751e7d31..e334e98cdcde1323381ff80b97b1943f4faf671e 100644 (file)
@@ -57,6 +57,7 @@ get_directory_property(DEVICE_TREZOR_READY DIRECTORY "monero" DEFINITION DEVICE_
 get_directory_property(TREZOR_DEP_LIBS DIRECTORY "monero" DEFINITION TREZOR_DEP_LIBS)
 
 include(CMakePackageConfigHelpers)
+include(VersionFeather)
 
 include_directories(${EASYLOGGING_INCLUDE})
 link_directories(${EASYLOGGING_LIBRARY_DIRS})
diff --git a/cmake/VersionFeather.cmake b/cmake/VersionFeather.cmake
new file mode 100644 (file)
index 0000000..f94567f
--- /dev/null
@@ -0,0 +1,27 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# SPDX-FileCopyrightText: 2020-2022 The Monero Project
+
+find_package(Git QUIET)
+
+# Sets FEATHER_COMMIT to the first 9 chars of the current commit hash.
+
+if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/githash.txt")
+    # This file added in source archives where the .git folder has been removed to optimize for space.
+    file(READ "githash.txt" COMMIT)
+    string(SUBSTRING ${COMMIT} 0 9 COMMIT)
+    message(STATUS "You are currently on commit ${COMMIT}")
+    set(FEATHER_COMMIT "${COMMIT}")
+else()
+    execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse --short=9 HEAD RESULT_VARIABLE RET OUTPUT_VARIABLE COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+    if(RET)
+        message(WARNING "Cannot determine current commit. Make sure that you are building either from a Git working tree or from a source archive.")
+        set(FEATHER_COMMIT "unknown")
+    else()
+        string(SUBSTRING ${COMMIT} 0 9 COMMIT)
+        message(STATUS "You are currently on commit ${COMMIT}")
+        set(FEATHER_COMMIT "${COMMIT}")
+    endif()
+endif()
+
+configure_file("cmake/config-feather.h.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/src/config-feather.h")
\ No newline at end of file
index 3800b0aae8a4dbd56599a80ce8a3b0443206688d..1e9f3f4aa1f0bae56aa633215aa7fdb358fd83ac 100644 (file)
@@ -2,6 +2,7 @@
 #define FEATHER_VERSION_H
 
 #define FEATHER_VERSION "@VERSION@"
+#define FEATHER_COMMIT "@FEATHER_COMMIT@"
 
 #define TOR_VERSION "@TOR_VERSION@"
 
index f560ba059e76a8d118aefd8c096657c2be933b3d..db366e947450db31391924823ded3ed3d4d043fa 100644 (file)
@@ -1,4 +1,4 @@
-Feather <feather_version>
+Feather <feather_version> (<feather_git_head>)
 
 Copyright (c) 2020-<current_year>, The Monero Project
 
index deecf6f1375608ecd0a772e35b513da140bb70e2..14bca8b2f34fc6b9bb078895edbd71ff230c9784 100644 (file)
@@ -19,6 +19,7 @@ AboutDialog::AboutDialog(QWidget *parent)
     auto about = Utils::fileOpenQRC(":assets/about.txt");
     auto about_text = Utils::barrayToString(about);
     about_text = about_text.replace("<feather_version>", FEATHER_VERSION);
+    about_text = about_text.replace("<feather_git_head>", FEATHER_COMMIT);
     about_text = about_text.replace("<current_year>", QString::number(QDate::currentDate().year()));
     ui->copyrightText->setPlainText(about_text);
 
index 5abeed4cbb3a6fb3e461c3b52d201ec993028908..58b74688a84335bc550515b44176503be85944db 100644 (file)
@@ -45,7 +45,7 @@ void DebugInfoDialog::updateInfo() {
     else
         torStatus = "Unknown";
 
-    ui->label_featherVersion->setText(QString("%1").arg(FEATHER_VERSION));
+    ui->label_featherVersion->setText(QString("%1-%2").arg(FEATHER_VERSION, FEATHER_COMMIT));
 
     ui->label_walletHeight->setText(QString::number(m_ctx->wallet->blockChainHeight()));
     ui->label_daemonHeight->setText(QString::number(m_ctx->wallet->daemonBlockChainHeight()));