Take compatibility version into account for user plugins

When loading user-local plugins, do not load plugins for all patch
versions starting from .0 unconditionally. Take the compatibility
version into account.

That fixes that prereleases x.y.82 etc should not try loading plugins
for any actual x.y.z release.

Change-Id: Ide0931bbdef4f48e08dcc3213f7c193c8889fb0f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Eike Ziller
2020-03-02 13:36:14 +01:00
parent 8bb3b3c4f1
commit d6c95ef365
4 changed files with 10 additions and 1 deletions

View File

@@ -43,6 +43,7 @@ const char IDE_ID[] = "${IDE_ID}";
const char IDE_CASED_ID[] = "${IDE_CASED_ID}"; const char IDE_CASED_ID[] = "${IDE_CASED_ID}";
const char IDE_VERSION_DISPLAY[] = "${IDE_VERSION_DISPLAY}"; const char IDE_VERSION_DISPLAY[] = "${IDE_VERSION_DISPLAY}";
const char IDE_VERSION_COMPAT[] = "${IDE_VERSION_COMPAT}";
const char IDE_REVISION_STR[] = "${IDE_REVISION_STR}"; const char IDE_REVISION_STR[] = "${IDE_REVISION_STR}";
const char IDE_REVISION_URL_STR[] = "${IDE_REVISION_URL_STR}"; const char IDE_REVISION_URL_STR[] = "${IDE_REVISION_URL_STR}";

View File

@@ -38,6 +38,7 @@ const char IDE_CASED_ID[] = \"$${IDE_CASED_ID}\";
#define IDE_VERSION $${QTCREATOR_VERSION} #define IDE_VERSION $${QTCREATOR_VERSION}
#define IDE_VERSION_STR STRINGIFY(IDE_VERSION) #define IDE_VERSION_STR STRINGIFY(IDE_VERSION)
#define IDE_VERSION_DISPLAY_DEF $${QTCREATOR_DISPLAY_VERSION} #define IDE_VERSION_DISPLAY_DEF $${QTCREATOR_DISPLAY_VERSION}
#define IDE_VERSION_COMPAT_DEF $${QTCREATOR_COMPAT_VERSION}
#define IDE_VERSION_MAJOR $$replace(QTCREATOR_VERSION, "^(\\d+)\\.\\d+\\.\\d+(-.*)?$", \\1) #define IDE_VERSION_MAJOR $$replace(QTCREATOR_VERSION, "^(\\d+)\\.\\d+\\.\\d+(-.*)?$", \\1)
#define IDE_VERSION_MINOR $$replace(QTCREATOR_VERSION, "^\\d+\\.(\\d+)\\.\\d+(-.*)?$", \\1) #define IDE_VERSION_MINOR $$replace(QTCREATOR_VERSION, "^\\d+\\.(\\d+)\\.\\d+(-.*)?$", \\1)
@@ -45,6 +46,7 @@ const char IDE_CASED_ID[] = \"$${IDE_CASED_ID}\";
const char IDE_VERSION_LONG[] = IDE_VERSION_STR; const char IDE_VERSION_LONG[] = IDE_VERSION_STR;
const char IDE_VERSION_DISPLAY[] = STRINGIFY(IDE_VERSION_DISPLAY_DEF); const char IDE_VERSION_DISPLAY[] = STRINGIFY(IDE_VERSION_DISPLAY_DEF);
const char IDE_VERSION_COMPAT[] = STRINGIFY(IDE_VERSION_COMPAT_DEF);
const char IDE_AUTHOR[] = \"The Qt Company Ltd\"; const char IDE_AUTHOR[] = \"The Qt Company Ltd\";
const char IDE_YEAR[] = \"$${QTCREATOR_COPYRIGHT_YEAR}\"; const char IDE_YEAR[] = \"$${QTCREATOR_COPYRIGHT_YEAR}\";
@@ -73,6 +75,7 @@ const char IDE_COPY_SETTINGS_FROM_VARIANT_STR[] = STRINGIFY(IDE_COPY_SETTINGS_FR
const char IDE_COPY_SETTINGS_FROM_VARIANT_STR[] = \"\"; const char IDE_COPY_SETTINGS_FROM_VARIANT_STR[] = \"\";
#endif #endif
#undef IDE_VERSION_COMPAT_DEF
#undef IDE_VERSION_DISPLAY_DEF #undef IDE_VERSION_DISPLAY_DEF
#undef IDE_VERSION #undef IDE_VERSION
#undef IDE_VERSION_STR #undef IDE_VERSION_STR

View File

@@ -34,6 +34,8 @@ Product {
// replace the magic qmake incantations // replace the magic qmake incantations
content = content.replace(/(\n#define IDE_VERSION_DISPLAY_DEF) .+\n/, "$1 " content = content.replace(/(\n#define IDE_VERSION_DISPLAY_DEF) .+\n/, "$1 "
+ product.moduleProperty("qtc", "qtcreator_display_version") + "\n"); + product.moduleProperty("qtc", "qtcreator_display_version") + "\n");
content = content.replace(/(\n#define IDE_VERSION_COMPAT_DEF) .+\n/, "$1 "
+ product.moduleProperty("qtc", "qtcreator_compat_version") + "\n");
content = content.replace(/(\n#define IDE_VERSION) .+\n/, "$1 " content = content.replace(/(\n#define IDE_VERSION) .+\n/, "$1 "
+ product.moduleProperty("qtc", "qtcreator_version") + "\n"); + product.moduleProperty("qtc", "qtcreator_version") + "\n");
content = content.replace(/(\n#define IDE_VERSION_MAJOR) .+\n/, "$1 " content = content.replace(/(\n#define IDE_VERSION_MAJOR) .+\n/, "$1 "

View File

@@ -237,7 +237,10 @@ static inline QStringList getPluginPaths()
// patch versions // patch versions
const QString minorVersion = QString::number(IDE_VERSION_MAJOR) + '.' const QString minorVersion = QString::number(IDE_VERSION_MAJOR) + '.'
+ QString::number(IDE_VERSION_MINOR) + '.'; + QString::number(IDE_VERSION_MINOR) + '.';
for (int patchVersion = IDE_VERSION_RELEASE; patchVersion >= 0; --patchVersion) const int minPatchVersion
= qMin(IDE_VERSION_RELEASE,
QVersionNumber::fromString(Core::Constants::IDE_VERSION_COMPAT).microVersion());
for (int patchVersion = IDE_VERSION_RELEASE; patchVersion >= minPatchVersion; --patchVersion)
rc.push_back(pluginPath + minorVersion + QString::number(patchVersion)); rc.push_back(pluginPath + minorVersion + QString::number(patchVersion));
return rc; return rc;
} }