QmakeMakeStep: Employ task tree for running

Task-number: QTCREATORBUG-29168
Change-Id: I4366c520f58946e372c772c643ac40cdc212ec22
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2023-07-12 15:33:19 +02:00
parent e796eb4035
commit 7f9d1fb993

View File

@@ -59,15 +59,6 @@ QmakeMakeStep::QmakeMakeStep(BuildStepList *bsl, Id id)
setUserArguments("clean"); setUserArguments("clean");
} }
supportDisablingForSubdirs(); supportDisablingForSubdirs();
setDoneHook([this](bool success) {
if (!success && !isCanceled() && m_unalignedBuildDir
&& settings().warnAgainstUnalignedBuildDir()) {
const QString msg = Tr::tr("The build directory is not at the same level as the source "
"directory, which could be the reason for the build failure.");
emit addTask(BuildSystemTask(Task::Warning, msg));
}
});
} }
bool QmakeMakeStep::init() bool QmakeMakeStep::init()
@@ -211,20 +202,31 @@ void QmakeMakeStep::setupOutputFormatter(OutputFormatter *formatter)
void QmakeMakeStep::doRun() void QmakeMakeStep::doRun()
{ {
if (m_scriptTarget || m_ignoredNonTopLevelBuild) { using namespace Tasking;
emit finished(true);
return; const auto onSetup = [this] {
} if (m_scriptTarget || m_ignoredNonTopLevelBuild)
return SetupResult::StopWithDone;
if (!m_makeFileToCheck.exists()) { if (!m_makeFileToCheck.exists()) {
const bool success = ignoreReturnValue(); const bool success = ignoreReturnValue();
if (!success) if (!success) {
emit addOutput(Tr::tr("Cannot find Makefile. Check your build settings."), BuildStep::OutputFormat::NormalMessage); emit addOutput(Tr::tr("Cannot find Makefile. Check your build settings."),
emit finished(success); OutputFormat::NormalMessage);
return;
} }
return success ? SetupResult::StopWithDone : SetupResult::StopWithError;
}
return SetupResult::Continue;
};
const auto onError = [this] {
if (m_unalignedBuildDir && settings().warnAgainstUnalignedBuildDir()) {
const QString msg = Tr::tr("The build directory is not at the same level as the source "
"directory, which could be the reason for the build failure.");
emit addTask(BuildSystemTask(Task::Warning, msg));
}
};
AbstractProcessStep::doRun(); runTaskTree({onGroupSetup(onSetup), onGroupError(onError), defaultProcessTask()});
} }
QStringList QmakeMakeStep::displayArguments() const QStringList QmakeMakeStep::displayArguments() const