PluginDumper: Connect to done() signal

Instead of connecting to errorOccurred() and finished() signals.

Change-Id: Iaf5fb4ec46919e37b0ab12ec4cbff904ae192de7
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-06-16 18:27:17 +02:00
parent a235aa29a1
commit 7a14ee1393
2 changed files with 11 additions and 23 deletions

View File

@@ -264,13 +264,20 @@ void PluginDumper::qmlPluginTypeDumpDone(QtcProcess *process)
return; return;
const Snapshot snapshot = m_modelManager->snapshot(); const Snapshot snapshot = m_modelManager->snapshot();
LibraryInfo libraryInfo = snapshot.libraryInfo(libraryPath); LibraryInfo libraryInfo = snapshot.libraryInfo(libraryPath);
bool privatePlugin = libraryPath.endsWith(QLatin1String("private")); const bool privatePlugin = libraryPath.endsWith(QLatin1String("private"));
if (process->exitCode() != 0) { if (process->exitCode() || process->error() != QProcess::UnknownError) {
const QString errorMessages = qmlPluginDumpErrorMessage(process); const QString errorMessages = qmlPluginDumpErrorMessage(process);
if (!privatePlugin) if (!privatePlugin)
ModelManagerInterface::writeWarning(qmldumpErrorMessage(libraryPath, errorMessages)); ModelManagerInterface::writeWarning(qmldumpErrorMessage(libraryPath, errorMessages));
libraryInfo.setPluginTypeInfoStatus(LibraryInfo::DumpError, qmldumpFailedMessage(libraryPath, errorMessages)); libraryInfo.setPluginTypeInfoStatus(LibraryInfo::DumpError,
qmldumpFailedMessage(libraryPath, errorMessages));
if (process->error() != QProcess::UnknownError) {
libraryInfo.updateFingerprint();
m_modelManager->updateLibraryInfo(libraryPath, libraryInfo);
return;
}
const QByteArray output = process->readAllStandardOutput(); const QByteArray output = process->readAllStandardOutput();
@@ -324,23 +331,6 @@ void PluginDumper::qmlPluginTypeDumpDone(QtcProcess *process)
} }
} }
void PluginDumper::qmlPluginTypeDumpError(QtcProcess *process)
{
process->deleteLater();
const FilePath libraryPath = m_runningQmldumps.take(process);
if (libraryPath.isEmpty())
return;
const QString errorMessages = qmlPluginDumpErrorMessage(process);
const Snapshot snapshot = m_modelManager->snapshot();
LibraryInfo libraryInfo = snapshot.libraryInfo(libraryPath);
if (!libraryPath.path().endsWith(QLatin1String("private"), Qt::CaseInsensitive))
ModelManagerInterface::writeWarning(qmldumpErrorMessage(libraryPath, errorMessages));
libraryInfo.setPluginTypeInfoStatus(LibraryInfo::DumpError, qmldumpFailedMessage(libraryPath, errorMessages));
libraryInfo.updateFingerprint();
m_modelManager->updateLibraryInfo(libraryPath, libraryInfo);
}
void PluginDumper::pluginChanged(const QString &pluginLibrary) void PluginDumper::pluginChanged(const QString &pluginLibrary)
{ {
const int pluginIndex = m_libraryToPluginIndex.value(pluginLibrary, -1); const int pluginIndex = m_libraryToPluginIndex.value(pluginLibrary, -1);
@@ -628,8 +618,7 @@ void PluginDumper::runQmlDump(const ModelManagerInterface::ProjectInfo &info,
process->setEnvironment(info.qmlDumpEnvironment); process->setEnvironment(info.qmlDumpEnvironment);
process->setWorkingDirectory(importPath); process->setWorkingDirectory(importPath);
process->setCommand({info.qmlDumpPath, arguments}); process->setCommand({info.qmlDumpPath, arguments});
connect(process, &QtcProcess::finished, this, [this, process] { qmlPluginTypeDumpDone(process); }); connect(process, &QtcProcess::done, this, [this, process] { qmlPluginTypeDumpDone(process); });
connect(process, &QtcProcess::errorOccurred, this, [this, process] { qmlPluginTypeDumpError(process); });
process->start(); process->start();
m_runningQmldumps.insert(process, importPath); m_runningQmldumps.insert(process, importPath);
} }

View File

@@ -60,7 +60,6 @@ private:
const QString &importUri, const QString &importVersion); const QString &importUri, const QString &importVersion);
Q_INVOKABLE void dumpAllPlugins(); Q_INVOKABLE void dumpAllPlugins();
void qmlPluginTypeDumpDone(Utils::QtcProcess *process); void qmlPluginTypeDumpDone(Utils::QtcProcess *process);
void qmlPluginTypeDumpError(Utils::QtcProcess *process);
void pluginChanged(const QString &pluginLibrary); void pluginChanged(const QString &pluginLibrary);
private: private: