forked from qt-creator/qt-creator
Fixes: - Make plugin load order a bit more deterministic
Details: - It will still change if the dependencies change, there's no way to avoid that though.
This commit is contained in:
@@ -69,7 +69,7 @@ static const char *HELP_OPTION4 = "--help";
|
|||||||
static const char *VERSION_OPTION = "-version";
|
static const char *VERSION_OPTION = "-version";
|
||||||
static const char *CLIENT_OPTION = "-client";
|
static const char *CLIENT_OPTION = "-client";
|
||||||
|
|
||||||
typedef QSet<ExtensionSystem::PluginSpec *> PluginSpecSet;
|
typedef QList<ExtensionSystem::PluginSpec *> PluginSpecSet;
|
||||||
|
|
||||||
// Helpers for displaying messages. Note that there is no console on Windows.
|
// Helpers for displaying messages. Note that there is no console on Windows.
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ bool OptionsParser::checkForNoLoadOption()
|
|||||||
"The plugin '%1' does not exist.").arg(m_currentArg);
|
"The plugin '%1' does not exist.").arg(m_currentArg);
|
||||||
m_hasError = true;
|
m_hasError = true;
|
||||||
} else {
|
} else {
|
||||||
m_pmPrivate->pluginSpecs.remove(spec);
|
m_pmPrivate->pluginSpecs.removeAll(spec);
|
||||||
delete spec;
|
delete spec;
|
||||||
m_isDependencyRefreshNeeded = true;
|
m_isDependencyRefreshNeeded = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
#include <QTest>
|
#include <QTest>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef QSet<ExtensionSystem::PluginSpec *> PluginSpecSet;
|
typedef QList<ExtensionSystem::PluginSpec *> PluginSpecSet;
|
||||||
|
|
||||||
enum { debugLeaks = 0 };
|
enum { debugLeaks = 0 };
|
||||||
|
|
||||||
@@ -162,6 +162,11 @@ enum { debugLeaks = 0 };
|
|||||||
using namespace ExtensionSystem;
|
using namespace ExtensionSystem;
|
||||||
using namespace ExtensionSystem::Internal;
|
using namespace ExtensionSystem::Internal;
|
||||||
|
|
||||||
|
static bool lessThanByPluginName(const PluginSpec *one, const PluginSpec *two)
|
||||||
|
{
|
||||||
|
return one->name() < two->name();
|
||||||
|
}
|
||||||
|
|
||||||
PluginManager *PluginManager::m_instance = 0;
|
PluginManager *PluginManager::m_instance = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -306,7 +311,7 @@ QStringList PluginManager::arguments() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QSet<PluginSpec *> PluginManager::plugins() const
|
\fn QList<PluginSpec *> PluginManager::plugins() const
|
||||||
List of all plugin specifications that have been found in the plugin search paths.
|
List of all plugin specifications that have been found in the plugin search paths.
|
||||||
This list is valid directly after the setPluginPaths() call.
|
This list is valid directly after the setPluginPaths() call.
|
||||||
The plugin specifications contain the information from the plugins' xml description files
|
The plugin specifications contain the information from the plugins' xml description files
|
||||||
@@ -315,7 +320,7 @@ QStringList PluginManager::arguments() const
|
|||||||
|
|
||||||
\sa setPluginPaths()
|
\sa setPluginPaths()
|
||||||
*/
|
*/
|
||||||
QSet<PluginSpec *> PluginManager::plugins() const
|
QList<PluginSpec *> PluginManager::plugins() const
|
||||||
{
|
{
|
||||||
return d->pluginSpecs;
|
return d->pluginSpecs;
|
||||||
}
|
}
|
||||||
@@ -703,9 +708,11 @@ void PluginManagerPrivate::readPluginPaths()
|
|||||||
foreach (const QString &specFile, specFiles) {
|
foreach (const QString &specFile, specFiles) {
|
||||||
PluginSpec *spec = new PluginSpec;
|
PluginSpec *spec = new PluginSpec;
|
||||||
spec->d->read(specFile);
|
spec->d->read(specFile);
|
||||||
pluginSpecs.insert(spec);
|
pluginSpecs.append(spec);
|
||||||
}
|
}
|
||||||
resolveDependencies();
|
resolveDependencies();
|
||||||
|
// ensure deterministic plugin load order by sorting
|
||||||
|
qSort(pluginSpecs.begin(), pluginSpecs.end(), lessThanByPluginName);
|
||||||
emit q->pluginsChanged();
|
emit q->pluginsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ public:
|
|||||||
void loadPlugins();
|
void loadPlugins();
|
||||||
QStringList pluginPaths() const;
|
QStringList pluginPaths() const;
|
||||||
void setPluginPaths(const QStringList &paths);
|
void setPluginPaths(const QStringList &paths);
|
||||||
QSet<PluginSpec *> plugins() const;
|
QList<PluginSpec *> plugins() const;
|
||||||
void setFileExtension(const QString &extension);
|
void setFileExtension(const QString &extension);
|
||||||
QString fileExtension() const;
|
QString fileExtension() const;
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public:
|
|||||||
void loadPlugin(PluginSpec *spec, PluginSpec::State destState);
|
void loadPlugin(PluginSpec *spec, PluginSpec::State destState);
|
||||||
void resolveDependencies();
|
void resolveDependencies();
|
||||||
|
|
||||||
QSet<PluginSpec *> pluginSpecs;
|
QList<PluginSpec *> pluginSpecs;
|
||||||
QList<PluginSpec *> testSpecs;
|
QList<PluginSpec *> testSpecs;
|
||||||
QStringList pluginPaths;
|
QStringList pluginPaths;
|
||||||
QString extension;
|
QString extension;
|
||||||
|
|||||||
@@ -693,10 +693,10 @@ int PluginSpecPrivate::versionCompare(const QString &version1, const QString &ve
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn bool PluginSpecPrivate::resolveDependencies(const QSet<PluginSpec *> &specs)
|
\fn bool PluginSpecPrivate::resolveDependencies(const QList<PluginSpec *> &specs)
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
bool PluginSpecPrivate::resolveDependencies(const QSet<PluginSpec *> &specs)
|
bool PluginSpecPrivate::resolveDependencies(const QList<PluginSpec *> &specs)
|
||||||
{
|
{
|
||||||
if (hasError)
|
if (hasError)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public:
|
|||||||
|
|
||||||
bool read(const QString &fileName);
|
bool read(const QString &fileName);
|
||||||
bool provides(const QString &pluginName, const QString &version) const;
|
bool provides(const QString &pluginName, const QString &version) const;
|
||||||
bool resolveDependencies(const QSet<PluginSpec *> &specs);
|
bool resolveDependencies(const QList<PluginSpec *> &specs);
|
||||||
bool loadLibrary();
|
bool loadLibrary();
|
||||||
bool initializePlugin();
|
bool initializePlugin();
|
||||||
bool initializeExtensions();
|
bool initializeExtensions();
|
||||||
|
|||||||
Reference in New Issue
Block a user