Lua: Introduce LuaCompatibleVersion

The new field "LuaCompatibleVersion" is required when a lua plugin depends on a C++ plugin. A dependency will be fulfilled if:

"LuaCompatibleVersion <= dependency.version <= Version"

Change-Id: I61466055a56e20abbb1fa5f73a5735a0e3a4c471
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Marcus Tillmanns
2024-07-25 12:52:23 +02:00
parent 8c91d12ca1
commit 8974d844ff
3 changed files with 16 additions and 5 deletions

View File

@@ -1,9 +1,10 @@
{
"Name" : "LuaLanguageClient",
"Version" : "${IDE_VERSION}",
"CompatVersion" : "${IDE_VERSION_COMPAT}",
"LuaCompatibleVersion" : "14.0.0",
"DisabledByDefault" : true,
"SoftLoadable" : true,
"CompatVersion" : "${IDE_VERSION_COMPAT}",
"Vendor" : "The Qt Company Ltd",
"Copyright" : "(C) ${IDE_COPYRIGHT_YEAR} The Qt Company Ltd",
"License" : [ "Commercial Usage",

View File

@@ -2,6 +2,7 @@
"Name" : "Lua",
"Version" : "${IDE_VERSION}",
"CompatVersion" : "${IDE_VERSION_COMPAT}",
"LuaCompatibleVersion" : "14.0.0",
"DisabledByDefault" : true,
"SoftLoadable" : true,
"Vendor" : "The Qt Company Ltd",

View File

@@ -98,10 +98,18 @@ bool LuaPluginSpec::provides(PluginSpec *spec, const PluginDependency &dependenc
if (QString::compare(dependency.name, spec->name(), Qt::CaseInsensitive) != 0)
return false;
// Since we first released the lua support with Qt Creator 14.0.0, but the internal version
// number was still 13.0.82, we needed to special case this version.
if (versionCompare(dependency.version, "14.0.0") <= 0)
return true;
const QString luaCompatibleVersion = spec->metaData().value("LuaCompatibleVersion").toString();
if (luaCompatibleVersion.isEmpty()) {
qCWarning(luaPluginSpecLog)
<< "The plugin" << spec->name()
<< "does not specify a \"LuaCompatibleVersion\", but the lua plugin" << name()
<< "requires it.";
return false;
}
if (versionCompare(luaCompatibleVersion, dependency.version) > 0)
return false;
return (versionCompare(spec->version(), dependency.version) >= 0);
}
@@ -114,6 +122,7 @@ bool LuaPluginSpec::loadLibrary()
setState(PluginSpec::State::Loaded);
return true;
}
bool LuaPluginSpec::initializePlugin()
{
QTC_ASSERT(!d->activeLuaState, return false);