Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2021-10-28 18:05:03 +0300
committerHannah von Reth <vonreth@kde.org>2021-10-28 19:14:15 +0300
commit8b743376b1d230b76558703dfa70c289c64b464c (patch)
tree9bedb0039fbb89814cecda0e6881ee7eb2d666c9 /src/common
parent29fda71b87b4b4291dd9a61c6d19508a6ab69f5a (diff)
Remove version defines
Moving the generated values to a cpp means that we won't need to recompile all files including the version.h
Diffstat (limited to 'src/common')
-rw-r--r--src/common/common.cmake4
-rw-r--r--src/common/syncjournaldb.cpp25
-rw-r--r--src/common/utility.cpp2
-rw-r--r--src/common/version.cpp.in57
-rw-r--r--src/common/version.h46
-rw-r--r--src/common/vfs.cpp2
6 files changed, 122 insertions, 14 deletions
diff --git a/src/common/common.cmake b/src/common/common.cmake
index eafbd1a38..52fc5de54 100644
--- a/src/common/common.cmake
+++ b/src/common/common.cmake
@@ -1,6 +1,7 @@
# Just list files to build as part of the csync dynamic lib.
# Essentially they could be in the same directory but are separate to
# help keep track of the different code licenses.
+configure_file(${CMAKE_CURRENT_LIST_DIR}/version.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/version.cpp @ONLY)
set(common_SOURCES
${CMAKE_CURRENT_LIST_DIR}/checksums.cpp
${CMAKE_CURRENT_LIST_DIR}/filesystembase.cpp
@@ -14,8 +15,11 @@ set(common_SOURCES
${CMAKE_CURRENT_LIST_DIR}/pinstate.cpp
${CMAKE_CURRENT_LIST_DIR}/plugin.cpp
${CMAKE_CURRENT_LIST_DIR}/syncfilestatus.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/version.cpp
)
+
+
if(WIN32)
list(APPEND common_SOURCES
${CMAKE_CURRENT_LIST_DIR}/utility_win.cpp
diff --git a/src/common/syncjournaldb.cpp b/src/common/syncjournaldb.cpp
index fcef0f69a..5ace25c85 100644
--- a/src/common/syncjournaldb.cpp
+++ b/src/common/syncjournaldb.cpp
@@ -26,12 +26,13 @@
#include <sqlite3.h>
#include <cstring>
-#include "common/syncjournaldb.h"
-#include "version.h"
-#include "filesystembase.h"
#include "common/asserts.h"
#include "common/checksums.h"
#include "common/preparedsqlquerymanager.h"
+#include "common/syncjournaldb.h"
+#include "common/version.h"
+#include "filesystembase.h"
+#include "version.h"
#include "common/c_jhash.h"
@@ -515,10 +516,10 @@ bool SyncJournalDb::checkConnect()
forceRemoteDiscovery = true;
createQuery.prepare("INSERT INTO version VALUES (?1, ?2, ?3, ?4);");
- createQuery.bindValue(1, MIRALL_VERSION_MAJOR);
- createQuery.bindValue(2, MIRALL_VERSION_MINOR);
- createQuery.bindValue(3, MIRALL_VERSION_PATCH);
- createQuery.bindValue(4, MIRALL_VERSION_BUILD);
+ createQuery.bindValue(1, OCC::Version::major());
+ createQuery.bindValue(2, OCC::Version::minor());
+ createQuery.bindValue(3, OCC::Version::patch());
+ createQuery.bindValue(4, OCC::Version::buildNumber());
if (!createQuery.exec()) {
return sqlFail(QStringLiteral("Update version"), createQuery);
}
@@ -543,13 +544,13 @@ bool SyncJournalDb::checkConnect()
}
// Not comparing the BUILD id here, correct?
- if (!(major == MIRALL_VERSION_MAJOR && minor == MIRALL_VERSION_MINOR && patch == MIRALL_VERSION_PATCH)) {
+ if (!(major == OCC::Version::major() && minor == OCC::Version::minor() && patch == OCC::Version::patch())) {
createQuery.prepare("UPDATE version SET major=?1, minor=?2, patch =?3, custom=?4 "
"WHERE major=?5 AND minor=?6 AND patch=?7;");
- createQuery.bindValue(1, MIRALL_VERSION_MAJOR);
- createQuery.bindValue(2, MIRALL_VERSION_MINOR);
- createQuery.bindValue(3, MIRALL_VERSION_PATCH);
- createQuery.bindValue(4, MIRALL_VERSION_BUILD);
+ createQuery.bindValue(1, OCC::Version::major());
+ createQuery.bindValue(2, OCC::Version::minor());
+ createQuery.bindValue(3, OCC::Version::patch());
+ createQuery.bindValue(4, OCC::Version::buildNumber());
createQuery.bindValue(5, major);
createQuery.bindValue(6, minor);
createQuery.bindValue(7, patch);
diff --git a/src/common/utility.cpp b/src/common/utility.cpp
index 8404b92f1..5bde9099b 100644
--- a/src/common/utility.cpp
+++ b/src/common/utility.cpp
@@ -140,7 +140,7 @@ QByteArray Utility::userAgentString()
{
return QStringLiteral("Mozilla/5.0 (%1) mirall/%2 (%3, %4-%5 ClientArchitecture: %6 OsArchitecture: %7)")
.arg(platform(),
- QStringLiteral(MIRALL_VERSION_STRING),
+ OCC::Version::string(),
// accessing the theme to fetch the string is rather difficult
// since this is only needed server-side to identify clients, the app name (as of 2.9, the short name) is good enough
qApp->applicationName(),
diff --git a/src/common/version.cpp.in b/src/common/version.cpp.in
new file mode 100644
index 000000000..bab0081dc
--- /dev/null
+++ b/src/common/version.cpp.in
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) by Hannah von Reth <hannah.vonreth@owncloud.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "common/version.h"
+
+QString OCC::Version::string()
+{
+ return QStringLiteral("@MIRALL_VERSION_STRING@");
+}
+
+int OCC::Version::major()
+{
+ return @MIRALL_VERSION_MAJOR@;
+}
+
+int OCC::Version::minor()
+{
+ return @MIRALL_VERSION_MINOR@;
+}
+
+int OCC::Version::patch()
+{
+ return @MIRALL_VERSION_PATCH@;
+}
+
+int OCC::Version::buildNumber()
+{
+ return @MIRALL_VERSION_BUILD@;
+}
+
+QString OCC::Version::gitSha()
+{
+ return QStringLiteral("@GIT_SHA1@");
+}
+
+QString OCC::Version::suffix()
+{
+ return QStringLiteral("@MIRALL_VERSION_SUFFIX@");
+}
+
+
+
diff --git a/src/common/version.h b/src/common/version.h
new file mode 100644
index 000000000..44a6cd698
--- /dev/null
+++ b/src/common/version.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) by Hannah von Reth <hannah.vonreth@owncloud.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#pragma once
+
+#include "ocsynclib.h"
+
+#include <QString>
+
+namespace OCC {
+namespace Version {
+ /**
+ * "Major.Minor.Patch"
+ */
+ QString OCSYNC_EXPORT string();
+ int OCSYNC_EXPORT major();
+ int OCSYNC_EXPORT minor();
+ int OCSYNC_EXPORT patch();
+ int OCSYNC_EXPORT buildNumber();
+
+ /**
+ * git, rc1, rc2
+ * Empty in releases
+ */
+ QString OCSYNC_EXPORT suffix();
+ /**
+ * The commit id
+ */
+ QString OCSYNC_EXPORT gitSha();
+}
+
+}
diff --git a/src/common/vfs.cpp b/src/common/vfs.cpp
index 80124d3b2..8627ca8ea 100644
--- a/src/common/vfs.cpp
+++ b/src/common/vfs.cpp
@@ -182,7 +182,7 @@ bool OCC::isVfsPluginAvailable(Vfs::Mode mode)
qCWarning(lcPlugin) << "Plugin has wrong type" << loader.fileName() << metadata[QStringLiteral("type")];
return false;
}
- if (metadata[QStringLiteral("version")].toString() != QStringLiteral(MIRALL_VERSION_STRING)) {
+ if (metadata[QStringLiteral("version")].toString() != OCC::Version::string()) {
qCWarning(lcPlugin) << "Plugin has wrong version" << loader.fileName() << metadata[QStringLiteral("version")];
return false;
}