Skip to content

Commit

Permalink
Only display git revision when available
Browse files Browse the repository at this point in the history
  • Loading branch information
remicollet authored and scorpio810 committed Jan 23, 2023
1 parent 1528229 commit 880bd8f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion qelectrotech.pro
Expand Up @@ -74,7 +74,7 @@ include(sources/QWidgetAnimation/QWidgetAnimation.pri)

DEFINES += QAPPLICATION_CLASS=QApplication
DEFINES += QT_MESSAGELOGCONTEXT
DEFINES += GIT_COMMIT_SHA="\\\"$(shell git -C \""$$_PRO_FILE_PWD_"\" rev-parse --verify HEAD)\\\""
DEFINES += GIT_COMMIT_SHA="\\\"$(shell git -C \""$$_PRO_FILE_PWD_"\" rev-parse --verify HEAD 2>/dev/null || true)\\\""

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
Expand Down
8 changes: 6 additions & 2 deletions sources/machine_info.cpp
Expand Up @@ -122,7 +122,9 @@ void MachineInfo::send_info_to_debug()
<< QLibraryInfo::path(QLibraryInfo::SettingsPath);
#endif
#endif
qInfo() << "GitRevision " + QString(GIT_COMMIT_SHA);
if (strlen(GIT_COMMIT_SHA)) {
qInfo() << "GitRevision " + QString(GIT_COMMIT_SHA);
}
qInfo()<< "QElectroTech V " + QetVersion::displayedVersion();
qInfo()<< QObject::tr("Compilation : ") + pc.built.version;
qInfo()<< "Built with Qt " + pc.built.QT
Expand Down Expand Up @@ -383,7 +385,9 @@ QString MachineInfo::compilation_info()
compilation_info += " - " + pc.built.arch;
compilation_info += " - Date : " + pc.built.date;
compilation_info += " : " + pc.built.time;
compilation_info += "<br> Git Revision : " + QString(GIT_COMMIT_SHA);
if (strlen(GIT_COMMIT_SHA)) {
compilation_info += "<br> Git Revision : " + QString(GIT_COMMIT_SHA);
}
compilation_info += " <br>Run with Qt " + QString(qVersion());
compilation_info += " using"
+ QString(" %1 thread(s)").arg(pc.cpu.ThreadCount);
Expand Down

0 comments on commit 880bd8f

Please sign in to comment.