File indexing completed on 2024-12-01 09:55:03
0001 /* 0002 SPDX-FileCopyrightText: 2008 Aaron Seigo <aseigo@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include <kpackage/version.h> 0008 0009 #if KPACKAGE_BUILD_DEPRECATED_SINCE(5, 84) 0010 0011 #include "kpackage_debug.h" 0012 0013 namespace KPackage 0014 { 0015 unsigned int version() 0016 { 0017 return PACKAGE_VERSION; 0018 } 0019 0020 unsigned int versionMajor() 0021 { 0022 return PACKAGE_VERSION_MAJOR; 0023 } 0024 0025 unsigned int versionMinor() 0026 { 0027 return PACKAGE_VERSION_MINOR; 0028 } 0029 0030 unsigned int versionRelease() 0031 { 0032 return PACKAGE_VERSION_PATCH; 0033 } 0034 0035 const char *versionString() 0036 { 0037 return PACKAGE_VERSION_STRING; 0038 } 0039 0040 bool isPluginVersionCompatible(unsigned int version) 0041 { 0042 if (version == quint32(-1)) { 0043 // unversioned, just let it through 0044 qCWarning(KPACKAGE_LOG) << "unversioned plugin detected, may result in instability"; 0045 return true; 0046 } 0047 0048 // we require PACKAGE_VERSION_MAJOR and PACKAGE_VERSION_MINOR 0049 const quint32 minVersion = PACKAGE_MAKE_VERSION(PACKAGE_VERSION_MAJOR, 0, 0); 0050 const quint32 maxVersion = PACKAGE_MAKE_VERSION(PACKAGE_VERSION_MAJOR, PACKAGE_VERSION_MINOR, 60); 0051 0052 if (version < minVersion || version > maxVersion) { 0053 #ifndef NDEBUG 0054 // qCDebug(KPACKAGE_LOG) << "plugin is compiled against incompatible KPackage version " << version 0055 // << "This build is compatible with" << PACKAGE_VERSION_MAJOR << ".0.0 (" << minVersion 0056 // << ") to" << PACKAGE_VERSION_STRING << "(" << maxVersion << ")"; 0057 #endif 0058 return false; 0059 } 0060 0061 return true; 0062 } 0063 0064 } // namespace 0065 #endif