forked from qt-creator/qt-creator
Fix that plugins were wrongly indirectly enabled when testing
Since the disabling of all plugins except tested onces was implemented as an afterthought, it did not update the indirectly enabled plugins. Instead, update the list of enabled/disabled plugins in the optionsparser like for the -(no)load options, and trigger the update of indirectly enabled plugins afterwards. Also take test dependencies into account when indirectly enabling plugins directly. Change-Id: I59d6c05de69a3073576155f7bd6201f1cd44697c Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -1488,6 +1488,7 @@ void PluginManagerPrivate::readPluginPaths()
|
||||
pluginSpecs.append(spec);
|
||||
}
|
||||
resolveDependencies();
|
||||
enableDependenciesIndirectly();
|
||||
// ensure deterministic plugin load order by sorting
|
||||
Utils::sort(pluginSpecs, &PluginSpec::name);
|
||||
emit q->pluginsChanged();
|
||||
@@ -1495,42 +1496,19 @@ void PluginManagerPrivate::readPluginPaths()
|
||||
|
||||
void PluginManagerPrivate::resolveDependencies()
|
||||
{
|
||||
foreach (PluginSpec *spec, pluginSpecs) {
|
||||
spec->d->enabledIndirectly = false; // reset, is recalculated below
|
||||
foreach (PluginSpec *spec, pluginSpecs)
|
||||
spec->d->resolveDependencies(pluginSpecs);
|
||||
}
|
||||
|
||||
Utils::reverseForeach(loadQueue(), [](PluginSpec *spec) {
|
||||
spec->d->enableDependenciesIndirectly();
|
||||
});
|
||||
}
|
||||
|
||||
void PluginManagerPrivate::enableOnlyTestedSpecs()
|
||||
void PluginManagerPrivate::enableDependenciesIndirectly()
|
||||
{
|
||||
if (testSpecs.isEmpty())
|
||||
return;
|
||||
|
||||
QList<PluginSpec *> specsForTests;
|
||||
foreach (const TestSpec &testSpec, testSpecs) {
|
||||
QList<PluginSpec *> circularityCheckQueue;
|
||||
loadQueue(testSpec.pluginSpec, specsForTests, circularityCheckQueue);
|
||||
// add plugins that must be force loaded when running tests for the plugin
|
||||
// (aka "test dependencies")
|
||||
QHashIterator<PluginDependency, PluginSpec *> it(testSpec.pluginSpec->dependencySpecs());
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
if (it.key().type != PluginDependency::Test)
|
||||
continue;
|
||||
PluginSpec *depSpec = it.value();
|
||||
circularityCheckQueue.clear();
|
||||
loadQueue(depSpec, specsForTests, circularityCheckQueue);
|
||||
}
|
||||
}
|
||||
foreach (PluginSpec *spec, pluginSpecs)
|
||||
spec->d->setForceDisabled(true);
|
||||
foreach (PluginSpec *spec, specsForTests) {
|
||||
spec->d->setForceDisabled(false);
|
||||
spec->d->setForceEnabled(true);
|
||||
spec->d->enabledIndirectly = false;
|
||||
// cannot use reverse loadQueue here, because test dependencies can introduce circles
|
||||
QList<PluginSpec *> queue = Utils::filtered(pluginSpecs, &PluginSpec::isEffectivelyEnabled);
|
||||
while (!queue.isEmpty()) {
|
||||
PluginSpec *spec = queue.takeFirst();
|
||||
queue += spec->d->enableDependenciesIndirectly(containsTestSpec(spec));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user