forked from qt-creator/qt-creator
ExtensionSystem: Rename PluginSpecImpl to CppPluginSpec
Since we now have multiple classes inheriting from PluginSpec it makes sense
to rename PluginSpecImpl to the more accurate CppPluginSpec as it deals with
compiled plugins only.
Amends b39b192518
Change-Id: Icae9daed2be5a258a9918731a881c72cbe4f0fa4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -1790,7 +1790,7 @@ void PluginManagerPrivate::readPluginPaths()
|
|||||||
|
|
||||||
// from the file system
|
// from the file system
|
||||||
for (const QString &pluginFile : pluginFiles(pluginPaths)) {
|
for (const QString &pluginFile : pluginFiles(pluginPaths)) {
|
||||||
expected_str<PluginSpec *> spec = readPluginSpec(pluginFile);
|
expected_str<PluginSpec *> spec = readCppPluginSpec(pluginFile);
|
||||||
if (!spec) {
|
if (!spec) {
|
||||||
qCInfo(pluginLog).noquote()
|
qCInfo(pluginLog).noquote()
|
||||||
<< QString("Ignoring plugin \"%1\" because: %2").arg(pluginFile).arg(spec.error());
|
<< QString("Ignoring plugin \"%1\" because: %2").arg(pluginFile).arg(spec.error());
|
||||||
@@ -1801,7 +1801,7 @@ void PluginManagerPrivate::readPluginPaths()
|
|||||||
|
|
||||||
// static
|
// static
|
||||||
for (const QStaticPlugin &plugin : QPluginLoader::staticPlugins()) {
|
for (const QStaticPlugin &plugin : QPluginLoader::staticPlugins()) {
|
||||||
expected_str<PluginSpec *> spec = readPluginSpec(plugin);
|
expected_str<PluginSpec *> spec = readCppPluginSpec(plugin);
|
||||||
QTC_ASSERT_EXPECTED(spec, continue);
|
QTC_ASSERT_EXPECTED(spec, continue);
|
||||||
newSpecs.append(*spec);
|
newSpecs.append(*spec);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ public:
|
|||||||
QRegularExpression platformSpecification;
|
QRegularExpression platformSpecification;
|
||||||
QVector<ExtensionSystem::PluginDependency> dependencies;
|
QVector<ExtensionSystem::PluginDependency> dependencies;
|
||||||
|
|
||||||
PluginSpecImpl::PluginArgumentDescriptions argumentDescriptions;
|
PluginSpec::PluginArgumentDescriptions argumentDescriptions;
|
||||||
QString location;
|
QString location;
|
||||||
QString filePath;
|
QString filePath;
|
||||||
|
|
||||||
@@ -234,14 +234,14 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
PluginSpecImpl::PluginSpecImpl()
|
CppPluginSpec::CppPluginSpec()
|
||||||
: d(new PluginSpecImplPrivate)
|
: d(new PluginSpecImplPrivate)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
PluginSpecImpl::~PluginSpecImpl() = default;
|
CppPluginSpec::~CppPluginSpec() = default;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the plugin name. This is valid after the PluginSpec::Read state is
|
Returns the plugin name. This is valid after the PluginSpec::Read state is
|
||||||
@@ -578,7 +578,7 @@ bool PluginSpec::provides(const QString &pluginName, const QString &pluginVersio
|
|||||||
already been successfully loaded. That is, the PluginSpec::Loaded state
|
already been successfully loaded. That is, the PluginSpec::Loaded state
|
||||||
is reached.
|
is reached.
|
||||||
*/
|
*/
|
||||||
IPlugin *PluginSpecImpl::plugin() const
|
IPlugin *CppPluginSpec::plugin() const
|
||||||
{
|
{
|
||||||
return d->plugin;
|
return d->plugin;
|
||||||
}
|
}
|
||||||
@@ -692,9 +692,9 @@ namespace {
|
|||||||
\internal
|
\internal
|
||||||
Returns false if the file does not represent a Qt Creator plugin.
|
Returns false if the file does not represent a Qt Creator plugin.
|
||||||
*/
|
*/
|
||||||
expected_str<PluginSpec *> readPluginSpec(const QString &fileName)
|
expected_str<PluginSpec *> readCppPluginSpec(const QString &fileName)
|
||||||
{
|
{
|
||||||
auto spec = new PluginSpecImpl;
|
auto spec = new CppPluginSpec;
|
||||||
|
|
||||||
QFileInfo fileInfo(fileName);
|
QFileInfo fileInfo(fileName);
|
||||||
spec->setLocation(fileInfo.absolutePath());
|
spec->setLocation(fileInfo.absolutePath());
|
||||||
@@ -715,9 +715,9 @@ expected_str<PluginSpec *> readPluginSpec(const QString &fileName)
|
|||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
expected_str<PluginSpec *> readPluginSpec(const QStaticPlugin &plugin)
|
expected_str<PluginSpec *> readCppPluginSpec(const QStaticPlugin &plugin)
|
||||||
{
|
{
|
||||||
auto spec = new PluginSpecImpl;
|
auto spec = new CppPluginSpec;
|
||||||
|
|
||||||
qCDebug(pluginLog) << "\nReading meta data of static plugin";
|
qCDebug(pluginLog) << "\nReading meta data of static plugin";
|
||||||
spec->d->staticPlugin = plugin;
|
spec->d->staticPlugin = plugin;
|
||||||
@@ -771,7 +771,7 @@ Utils::expected_str<void> PluginSpec::reportError(const QString &error)
|
|||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
expected_str<void> PluginSpecImpl::readMetaData(const QJsonObject &pluginMetaData)
|
expected_str<void> CppPluginSpec::readMetaData(const QJsonObject &pluginMetaData)
|
||||||
{
|
{
|
||||||
qCDebug(pluginLog).noquote() << "MetaData:" << QJsonDocument(pluginMetaData).toJson();
|
qCDebug(pluginLog).noquote() << "MetaData:" << QJsonDocument(pluginMetaData).toJson();
|
||||||
QJsonValue value;
|
QJsonValue value;
|
||||||
@@ -1011,7 +1011,7 @@ Utils::expected_str<void> PluginSpecPrivate::readMetaData(const QJsonObject &dat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
state = PluginSpecImpl::Read;
|
state = PluginSpec::Read;
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@@ -1061,11 +1061,11 @@ bool PluginSpec::resolveDependencies(const QVector<PluginSpec *> &specs)
|
|||||||
{
|
{
|
||||||
if (hasError())
|
if (hasError())
|
||||||
return false;
|
return false;
|
||||||
if (state() > PluginSpecImpl::Resolved)
|
if (state() > PluginSpec::Resolved)
|
||||||
return true; // We are resolved already.
|
return true; // We are resolved already.
|
||||||
if (state() == PluginSpecImpl::Resolved)
|
if (state() == PluginSpec::Resolved)
|
||||||
setState(PluginSpecImpl::Read); // Go back, so we just re-resolve the dependencies.
|
setState(PluginSpec::Read); // Go back, so we just re-resolve the dependencies.
|
||||||
if (state() != PluginSpecImpl::Read) {
|
if (state() != PluginSpec::Read) {
|
||||||
setError(::ExtensionSystem::Tr::tr("Resolving dependencies failed because state != Read"));
|
setError(::ExtensionSystem::Tr::tr("Resolving dependencies failed because state != Read"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1094,7 +1094,7 @@ bool PluginSpec::resolveDependencies(const QVector<PluginSpec *> &specs)
|
|||||||
|
|
||||||
d->dependencySpecs = resolvedDependencies;
|
d->dependencySpecs = resolvedDependencies;
|
||||||
|
|
||||||
d->state = PluginSpecImpl::Resolved;
|
d->state = PluginSpec::Resolved;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1130,13 +1130,13 @@ void PluginSpec::setError(const QString &errorString)
|
|||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
bool PluginSpecImpl::loadLibrary()
|
bool CppPluginSpec::loadLibrary()
|
||||||
{
|
{
|
||||||
if (hasError())
|
if (hasError())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (state() != PluginSpecImpl::Resolved) {
|
if (state() != PluginSpec::Resolved) {
|
||||||
if (state() == PluginSpecImpl::Loaded)
|
if (state() == PluginSpec::Loaded)
|
||||||
return true;
|
return true;
|
||||||
setError(::ExtensionSystem::Tr::tr("Loading the library failed because state != Resolved"));
|
setError(::ExtensionSystem::Tr::tr("Loading the library failed because state != Resolved"));
|
||||||
return false;
|
return false;
|
||||||
@@ -1154,7 +1154,7 @@ bool PluginSpecImpl::loadLibrary()
|
|||||||
d->loader->unload();
|
d->loader->unload();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
setState(PluginSpecImpl::Loaded);
|
setState(PluginSpec::Loaded);
|
||||||
d->plugin = pluginObject;
|
d->plugin = pluginObject;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1162,13 +1162,13 @@ bool PluginSpecImpl::loadLibrary()
|
|||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
bool PluginSpecImpl::initializePlugin()
|
bool CppPluginSpec::initializePlugin()
|
||||||
{
|
{
|
||||||
if (hasError())
|
if (hasError())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (state() != PluginSpecImpl::Loaded) {
|
if (state() != PluginSpec::Loaded) {
|
||||||
if (state() == PluginSpecImpl::Initialized)
|
if (state() == PluginSpec::Initialized)
|
||||||
return true;
|
return true;
|
||||||
setError(
|
setError(
|
||||||
::ExtensionSystem::Tr::tr("Initializing the plugin failed because state != Loaded"));
|
::ExtensionSystem::Tr::tr("Initializing the plugin failed because state != Loaded"));
|
||||||
@@ -1184,20 +1184,20 @@ bool PluginSpecImpl::initializePlugin()
|
|||||||
setError(::ExtensionSystem::Tr::tr("Plugin initialization failed: %1").arg(err));
|
setError(::ExtensionSystem::Tr::tr("Plugin initialization failed: %1").arg(err));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
setState(PluginSpecImpl::Initialized);
|
setState(PluginSpec::Initialized);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
bool PluginSpecImpl::initializeExtensions()
|
bool CppPluginSpec::initializeExtensions()
|
||||||
{
|
{
|
||||||
if (hasError())
|
if (hasError())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (state() != PluginSpecImpl::Initialized) {
|
if (state() != PluginSpec::Initialized) {
|
||||||
if (state() == PluginSpecImpl::Running)
|
if (state() == PluginSpec::Running)
|
||||||
return true;
|
return true;
|
||||||
setError(::ExtensionSystem::Tr::tr(
|
setError(::ExtensionSystem::Tr::tr(
|
||||||
"Cannot perform extensionsInitialized because state != Initialized"));
|
"Cannot perform extensionsInitialized because state != Initialized"));
|
||||||
@@ -1209,19 +1209,19 @@ bool PluginSpecImpl::initializeExtensions()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
d->plugin->extensionsInitialized();
|
d->plugin->extensionsInitialized();
|
||||||
setState(PluginSpecImpl::Running);
|
setState(PluginSpec::Running);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
bool PluginSpecImpl::delayedInitialize()
|
bool CppPluginSpec::delayedInitialize()
|
||||||
{
|
{
|
||||||
if (hasError())
|
if (hasError())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (state() != PluginSpecImpl::Running)
|
if (state() != PluginSpec::Running)
|
||||||
return false;
|
return false;
|
||||||
if (!d->plugin) {
|
if (!d->plugin) {
|
||||||
setError(::ExtensionSystem::Tr::tr(
|
setError(::ExtensionSystem::Tr::tr(
|
||||||
@@ -1235,21 +1235,21 @@ bool PluginSpecImpl::delayedInitialize()
|
|||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
IPlugin::ShutdownFlag PluginSpecImpl::stop()
|
IPlugin::ShutdownFlag CppPluginSpec::stop()
|
||||||
{
|
{
|
||||||
if (hasError())
|
if (hasError())
|
||||||
return IPlugin::ShutdownFlag::SynchronousShutdown;
|
return IPlugin::ShutdownFlag::SynchronousShutdown;
|
||||||
|
|
||||||
if (!d->plugin)
|
if (!d->plugin)
|
||||||
return IPlugin::SynchronousShutdown;
|
return IPlugin::SynchronousShutdown;
|
||||||
setState(PluginSpecImpl::Stopped);
|
setState(PluginSpec::Stopped);
|
||||||
return d->plugin->aboutToShutdown();
|
return d->plugin->aboutToShutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
void PluginSpecImpl::kill()
|
void CppPluginSpec::kill()
|
||||||
{
|
{
|
||||||
if (hasError())
|
if (hasError())
|
||||||
return;
|
return;
|
||||||
@@ -1258,6 +1258,6 @@ void PluginSpecImpl::kill()
|
|||||||
return;
|
return;
|
||||||
delete d->plugin;
|
delete d->plugin;
|
||||||
d->plugin = nullptr;
|
d->plugin = nullptr;
|
||||||
setState(PluginSpecImpl::Deleted);
|
setState(PluginSpec::Deleted);
|
||||||
}
|
}
|
||||||
} // namespace ExtensionSystem
|
} // namespace ExtensionSystem
|
||||||
|
|||||||
@@ -169,18 +169,19 @@ private:
|
|||||||
std::unique_ptr<Internal::PluginSpecPrivate> d;
|
std::unique_ptr<Internal::PluginSpecPrivate> d;
|
||||||
};
|
};
|
||||||
|
|
||||||
EXTENSIONSYSTEM_EXPORT Utils::expected_str<PluginSpec *> readPluginSpec(const QString &filePath);
|
EXTENSIONSYSTEM_EXPORT Utils::expected_str<PluginSpec *> readCppPluginSpec(const QString &filePath);
|
||||||
EXTENSIONSYSTEM_EXPORT Utils::expected_str<PluginSpec *> readPluginSpec(const QStaticPlugin &plugin);
|
EXTENSIONSYSTEM_EXPORT Utils::expected_str<PluginSpec *> readCppPluginSpec(
|
||||||
|
const QStaticPlugin &plugin);
|
||||||
|
|
||||||
class EXTENSIONSYSTEM_TEST_EXPORT PluginSpecImpl : public PluginSpec
|
class EXTENSIONSYSTEM_TEST_EXPORT CppPluginSpec : public PluginSpec
|
||||||
{
|
{
|
||||||
friend EXTENSIONSYSTEM_EXPORT Utils::expected_str<PluginSpec *> readPluginSpec(
|
friend EXTENSIONSYSTEM_EXPORT Utils::expected_str<PluginSpec *> readCppPluginSpec(
|
||||||
const QString &filePath);
|
const QString &filePath);
|
||||||
friend EXTENSIONSYSTEM_EXPORT Utils::expected_str<PluginSpec *> readPluginSpec(
|
friend EXTENSIONSYSTEM_EXPORT Utils::expected_str<PluginSpec *> readCppPluginSpec(
|
||||||
const QStaticPlugin &plugin);
|
const QStaticPlugin &plugin);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~PluginSpecImpl() override;
|
~CppPluginSpec() override;
|
||||||
|
|
||||||
// linked plugin instance, valid after 'Loaded' state is reached
|
// linked plugin instance, valid after 'Loaded' state is reached
|
||||||
IPlugin *plugin() const override;
|
IPlugin *plugin() const override;
|
||||||
@@ -195,7 +196,7 @@ public:
|
|||||||
Utils::expected_str<void> readMetaData(const QJsonObject &pluginMetaData) override;
|
Utils::expected_str<void> readMetaData(const QJsonObject &pluginMetaData) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PluginSpecImpl();
|
CppPluginSpec();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Internal::PluginSpecImplPrivate> d;
|
std::unique_ptr<Internal::PluginSpecImplPrivate> d;
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ void checkContents(QPromise<ArchiveIssue> &promise, const FilePath &tempDir)
|
|||||||
if (promise.isCanceled())
|
if (promise.isCanceled())
|
||||||
return;
|
return;
|
||||||
it.next();
|
it.next();
|
||||||
expected_str<PluginSpec *> spec = readPluginSpec(it.filePath());
|
expected_str<PluginSpec *> spec = readCppPluginSpec(it.filePath());
|
||||||
if (spec) {
|
if (spec) {
|
||||||
// Is a Qt Creator plugin. Let's see if we find a Core dependency and check the
|
// Is a Qt Creator plugin. Let's see if we find a Core dependency and check the
|
||||||
// version
|
// version
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ void tst_PluginSpec::cleanupTestCase()
|
|||||||
|
|
||||||
void tst_PluginSpec::read()
|
void tst_PluginSpec::read()
|
||||||
{
|
{
|
||||||
PluginSpecImpl spec;
|
CppPluginSpec spec;
|
||||||
QCOMPARE(spec.state(), PluginSpec::Invalid);
|
QCOMPARE(spec.state(), PluginSpec::Invalid);
|
||||||
QVERIFY(spec.readMetaData(metaData("testspecs/spec1.json")));
|
QVERIFY(spec.readMetaData(metaData("testspecs/spec1.json")));
|
||||||
QVERIFY(!spec.hasError());
|
QVERIFY(!spec.hasError());
|
||||||
@@ -122,7 +122,7 @@ void tst_PluginSpec::read()
|
|||||||
|
|
||||||
void tst_PluginSpec::readError()
|
void tst_PluginSpec::readError()
|
||||||
{
|
{
|
||||||
PluginSpecImpl spec;
|
CppPluginSpec spec;
|
||||||
QCOMPARE(spec.state(), PluginSpec::Invalid);
|
QCOMPARE(spec.state(), PluginSpec::Invalid);
|
||||||
QVERIFY(!spec.readMetaData(metaData("non-existing-file.json")));
|
QVERIFY(!spec.readMetaData(metaData("non-existing-file.json")));
|
||||||
QCOMPARE(spec.state(), PluginSpec::Invalid);
|
QCOMPARE(spec.state(), PluginSpec::Invalid);
|
||||||
@@ -185,7 +185,7 @@ void tst_PluginSpec::versionCompare()
|
|||||||
|
|
||||||
void tst_PluginSpec::provides()
|
void tst_PluginSpec::provides()
|
||||||
{
|
{
|
||||||
PluginSpecImpl spec;
|
CppPluginSpec spec;
|
||||||
QVERIFY(spec.readMetaData(metaData("testspecs/simplespec.json")));
|
QVERIFY(spec.readMetaData(metaData("testspecs/simplespec.json")));
|
||||||
|
|
||||||
QVERIFY(!spec.provides("SomeOtherPlugin", "2.2.3_9"));
|
QVERIFY(!spec.provides("SomeOtherPlugin", "2.2.3_9"));
|
||||||
@@ -211,7 +211,7 @@ void tst_PluginSpec::provides()
|
|||||||
|
|
||||||
void tst_PluginSpec::experimental()
|
void tst_PluginSpec::experimental()
|
||||||
{
|
{
|
||||||
PluginSpecImpl spec;
|
CppPluginSpec spec;
|
||||||
QVERIFY(spec.readMetaData(metaData("testspecs/simplespec_experimental.json")));
|
QVERIFY(spec.readMetaData(metaData("testspecs/simplespec_experimental.json")));
|
||||||
|
|
||||||
QCOMPARE(spec.isExperimental(), true);
|
QCOMPARE(spec.isExperimental(), true);
|
||||||
@@ -220,11 +220,11 @@ void tst_PluginSpec::experimental()
|
|||||||
|
|
||||||
void tst_PluginSpec::locationAndPath()
|
void tst_PluginSpec::locationAndPath()
|
||||||
{
|
{
|
||||||
Utils::expected_str<PluginSpec *> ps = readPluginSpec(
|
Utils::expected_str<PluginSpec *> ps = readCppPluginSpec(
|
||||||
QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin/")
|
QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin/")
|
||||||
+ libraryName(QLatin1String("test")));
|
+ libraryName(QLatin1String("test")));
|
||||||
QVERIFY(ps);
|
QVERIFY(ps);
|
||||||
PluginSpecImpl *spec = static_cast<PluginSpecImpl *>(ps.value());
|
CppPluginSpec *spec = static_cast<CppPluginSpec *>(ps.value());
|
||||||
QCOMPARE(spec->location(), QString(QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin")));
|
QCOMPARE(spec->location(), QString(QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin")));
|
||||||
QCOMPARE(spec->filePath(),
|
QCOMPARE(spec->filePath(),
|
||||||
QString(QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin/")
|
QString(QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin/")
|
||||||
@@ -234,27 +234,27 @@ void tst_PluginSpec::locationAndPath()
|
|||||||
void tst_PluginSpec::resolveDependencies()
|
void tst_PluginSpec::resolveDependencies()
|
||||||
{
|
{
|
||||||
QVector<PluginSpec *> specs;
|
QVector<PluginSpec *> specs;
|
||||||
PluginSpec *spec1 = new PluginSpecImpl();
|
PluginSpec *spec1 = new CppPluginSpec();
|
||||||
specs.append(spec1);
|
specs.append(spec1);
|
||||||
spec1->readMetaData(metaData("testdependencies/spec1.json"));
|
spec1->readMetaData(metaData("testdependencies/spec1.json"));
|
||||||
spec1->setState(PluginSpec::Read); // fake read state for plugin resolving
|
spec1->setState(PluginSpec::Read); // fake read state for plugin resolving
|
||||||
|
|
||||||
PluginSpec *spec2 = new PluginSpecImpl();
|
PluginSpec *spec2 = new CppPluginSpec();
|
||||||
specs.append(spec2);
|
specs.append(spec2);
|
||||||
spec2->readMetaData(metaData("testdependencies/spec2.json"));
|
spec2->readMetaData(metaData("testdependencies/spec2.json"));
|
||||||
spec2->setState(PluginSpec::Read); // fake read state for plugin resolving
|
spec2->setState(PluginSpec::Read); // fake read state for plugin resolving
|
||||||
|
|
||||||
PluginSpec *spec3 = new PluginSpecImpl();
|
PluginSpec *spec3 = new CppPluginSpec();
|
||||||
specs.append(spec3);
|
specs.append(spec3);
|
||||||
spec3->readMetaData(metaData("testdependencies/spec3.json"));
|
spec3->readMetaData(metaData("testdependencies/spec3.json"));
|
||||||
spec3->setState(PluginSpec::Read); // fake read state for plugin resolving
|
spec3->setState(PluginSpec::Read); // fake read state for plugin resolving
|
||||||
|
|
||||||
PluginSpec *spec4 = new PluginSpecImpl();
|
PluginSpec *spec4 = new CppPluginSpec();
|
||||||
specs.append(spec4);
|
specs.append(spec4);
|
||||||
spec4->readMetaData(metaData("testdependencies/spec4.json"));
|
spec4->readMetaData(metaData("testdependencies/spec4.json"));
|
||||||
spec4->setState(PluginSpec::Read); // fake read state for plugin resolving
|
spec4->setState(PluginSpec::Read); // fake read state for plugin resolving
|
||||||
|
|
||||||
PluginSpec *spec5 = new PluginSpecImpl();
|
PluginSpec *spec5 = new CppPluginSpec();
|
||||||
specs.append(spec5);
|
specs.append(spec5);
|
||||||
spec5->readMetaData(metaData("testdependencies/spec5.json"));
|
spec5->readMetaData(metaData("testdependencies/spec5.json"));
|
||||||
spec5->setState(PluginSpec::Read); // fake read state for plugin resolving
|
spec5->setState(PluginSpec::Read); // fake read state for plugin resolving
|
||||||
@@ -271,12 +271,12 @@ void tst_PluginSpec::resolveDependencies()
|
|||||||
|
|
||||||
void tst_PluginSpec::loadLibrary()
|
void tst_PluginSpec::loadLibrary()
|
||||||
{
|
{
|
||||||
Utils::expected_str<PluginSpec *> ps = readPluginSpec(
|
Utils::expected_str<PluginSpec *> ps = readCppPluginSpec(
|
||||||
QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin/")
|
QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin/")
|
||||||
+ libraryName(QLatin1String("test")));
|
+ libraryName(QLatin1String("test")));
|
||||||
|
|
||||||
QVERIFY(ps);
|
QVERIFY(ps);
|
||||||
PluginSpecImpl *spec = static_cast<PluginSpecImpl *>(ps.value());
|
CppPluginSpec *spec = static_cast<CppPluginSpec *>(ps.value());
|
||||||
|
|
||||||
QVERIFY(spec->resolveDependencies(QVector<PluginSpec *>()));
|
QVERIFY(spec->resolveDependencies(QVector<PluginSpec *>()));
|
||||||
QVERIFY2(spec->loadLibrary(), qPrintable(spec->errorString()));
|
QVERIFY2(spec->loadLibrary(), qPrintable(spec->errorString()));
|
||||||
@@ -291,11 +291,11 @@ void tst_PluginSpec::loadLibrary()
|
|||||||
|
|
||||||
void tst_PluginSpec::initializePlugin()
|
void tst_PluginSpec::initializePlugin()
|
||||||
{
|
{
|
||||||
Utils::expected_str<PluginSpec *> ps = readPluginSpec(
|
Utils::expected_str<PluginSpec *> ps = readCppPluginSpec(
|
||||||
QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin/")
|
QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin/")
|
||||||
+ libraryName(QLatin1String("test")));
|
+ libraryName(QLatin1String("test")));
|
||||||
QVERIFY(ps);
|
QVERIFY(ps);
|
||||||
PluginSpecImpl *spec = static_cast<PluginSpecImpl *>(ps.value());
|
CppPluginSpec *spec = static_cast<CppPluginSpec *>(ps.value());
|
||||||
QVERIFY(spec->resolveDependencies(QVector<PluginSpec *>()));
|
QVERIFY(spec->resolveDependencies(QVector<PluginSpec *>()));
|
||||||
QVERIFY2(spec->loadLibrary(), qPrintable(spec->errorString()));
|
QVERIFY2(spec->loadLibrary(), qPrintable(spec->errorString()));
|
||||||
bool isInitialized;
|
bool isInitialized;
|
||||||
@@ -316,11 +316,11 @@ void tst_PluginSpec::initializePlugin()
|
|||||||
|
|
||||||
void tst_PluginSpec::initializeExtensions()
|
void tst_PluginSpec::initializeExtensions()
|
||||||
{
|
{
|
||||||
Utils::expected_str<PluginSpec *> ps = readPluginSpec(
|
Utils::expected_str<PluginSpec *> ps = readCppPluginSpec(
|
||||||
QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin/")
|
QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin/")
|
||||||
+ libraryName(QLatin1String("test")));
|
+ libraryName(QLatin1String("test")));
|
||||||
QVERIFY(ps);
|
QVERIFY(ps);
|
||||||
PluginSpecImpl *spec = static_cast<PluginSpecImpl *>(ps.value());
|
CppPluginSpec *spec = static_cast<CppPluginSpec *>(ps.value());
|
||||||
QVERIFY(spec->resolveDependencies(QVector<PluginSpec *>()));
|
QVERIFY(spec->resolveDependencies(QVector<PluginSpec *>()));
|
||||||
QVERIFY2(spec->loadLibrary(), qPrintable(spec->errorString()));
|
QVERIFY2(spec->loadLibrary(), qPrintable(spec->errorString()));
|
||||||
bool isExtensionsInitialized;
|
bool isExtensionsInitialized;
|
||||||
|
|||||||
Reference in New Issue
Block a user