forked from qt-creator/qt-creator
BuildManager: Add ParserAwaiterTask helper
Change-Id: I5c22b8a17d6495c3411e979e3e79cf9415236442 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
|
||||||
|
#include <solutions/tasking/tasktree.h>
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/outputformatter.h>
|
#include <utils/outputformatter.h>
|
||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
@@ -46,11 +48,42 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
using namespace Tasking;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
|
|
||||||
|
class ParserAwaiterTaskAdapter : public TaskAdapter<QSet<BuildSystem *>>
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
void start() final { checkParsing(); }
|
||||||
|
void checkParsing() {
|
||||||
|
const QSet<BuildSystem *> buildSystems = *task();
|
||||||
|
for (BuildSystem *buildSystem : buildSystems) {
|
||||||
|
if (!buildSystem || !buildSystem->isParsing())
|
||||||
|
continue;
|
||||||
|
connect(buildSystem, &BuildSystem::parsingFinished,
|
||||||
|
this, [this, buildSystem](bool success) {
|
||||||
|
disconnect(buildSystem, &BuildSystem::parsingFinished, this, nullptr);
|
||||||
|
if (!success) {
|
||||||
|
emit done(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
checkParsing();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
emit done(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // ProjectExplorer
|
||||||
|
|
||||||
|
TASKING_DECLARE_TASK(ParserAwaiterTask, ProjectExplorer::ParserAwaiterTaskAdapter);
|
||||||
|
|
||||||
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
static QString msgProgress(int progress, int total)
|
static QString msgProgress(int progress, int total)
|
||||||
{
|
{
|
||||||
return Tr::tr("Finished %1 of %n steps", nullptr, total).arg(progress);
|
return Tr::tr("Finished %1 of %n steps", nullptr, total).arg(progress);
|
||||||
|
Reference in New Issue
Block a user