mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 04:25:42 +08:00
Smart xswiftbus compatibility check based on git commit SHA-1
This is more tolerant that the simple check based on version numbers. Different versions can be compatible if they have the same SHA-1 when considering only those files that can influence xswiftbus.
This commit is contained in:
@@ -58,6 +58,11 @@ namespace XSwiftBus
|
||||
return version;
|
||||
}
|
||||
|
||||
std::string CService::getCommitHash() const
|
||||
{
|
||||
return XSWIFTBUS_COMMIT;
|
||||
}
|
||||
|
||||
void CService::addTextMessage(const std::string &text, double red, double green, double blue)
|
||||
{
|
||||
if (text.empty()) { return; }
|
||||
@@ -253,6 +258,13 @@ namespace XSwiftBus
|
||||
sendDBusReply(sender, serial, getVersionNumber());
|
||||
});
|
||||
}
|
||||
else if (message.getMethodName() == "getCommitHash")
|
||||
{
|
||||
queueDBusCall([ = ]()
|
||||
{
|
||||
sendDBusReply(sender, serial, getCommitHash());
|
||||
});
|
||||
}
|
||||
else if (message.getMethodName() == "addTextMessage")
|
||||
{
|
||||
maybeSendEmptyDBusReply(wantsReply, sender, serial);
|
||||
|
||||
@@ -62,6 +62,9 @@ namespace XSwiftBus
|
||||
//! Returns the XSwiftBus version number
|
||||
std::string getVersionNumber() const;
|
||||
|
||||
//! Returns the SHA1 of the last commit that could influence xswiftbus.
|
||||
std::string getCommitHash() const;
|
||||
|
||||
//! Add a text message to the on-screen display, with RGB components in the range [0,1]
|
||||
void addTextMessage(const std::string &text, double red, double green, double blue);
|
||||
|
||||
|
||||
10
src/xswiftbus/version.pri
Normal file
10
src/xswiftbus/version.pri
Normal file
@@ -0,0 +1,10 @@
|
||||
# this file is included by swift.pro in the project root
|
||||
|
||||
XSWIFTBUS_DEPENDENTS = $$SourceRoot/src/xswiftbus \
|
||||
$$SourceRoot/src/blackmisc/simulation/xplane/qtfreeutils.* \
|
||||
$$SourceRoot/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.*
|
||||
|
||||
XSWIFTBUS_COMMIT = $$system(git log -n 1 --format=%h -- $$XSWIFTBUS_DEPENDENTS)
|
||||
|
||||
# make the variable available in other files without needing to be included
|
||||
cache(XSWIFTBUS_COMMIT)
|
||||
@@ -86,6 +86,9 @@ isEmpty(GIT_BIN) {
|
||||
DEFINES += XSWIFTBUS_VERSION=\\\"$$swiftConfig(version.full)\\\"
|
||||
DEFINES += GIT_COMMIT_TS=\\\"$$GIT_COMMIT_TS\\\"
|
||||
|
||||
isEmpty(XSWIFTBUS_COMMIT): error(Missing XSWIFTBUS_COMMIT variable)
|
||||
DEFINES += XSWIFTBUS_COMMIT=\\\"$$XSWIFTBUS_COMMIT\\\"
|
||||
|
||||
# X-Plane plugins must follow a prescribed filename and directory structure.
|
||||
TARGET_EXT = .xpl
|
||||
win32:TARGET = win
|
||||
|
||||
Reference in New Issue
Block a user