diff --git a/src/plugins/remotelinux/makeinstallstep.cpp b/src/plugins/remotelinux/makeinstallstep.cpp index 2e85a3be162..1e44933f270 100644 --- a/src/plugins/remotelinux/makeinstallstep.cpp +++ b/src/plugins/remotelinux/makeinstallstep.cpp @@ -41,6 +41,7 @@ private: bool fromMap(const QVariantMap &map) override; QWidget *createConfigWidget() override; bool init() override; + void doRun() override; bool isJobCountSupported() const override { return false; } void updateCommandFromAspect(); @@ -131,35 +132,6 @@ MakeInstallStep::MakeInstallStep(BuildStepList *parent, Id id) : MakeStep(parent if (format == OutputFormat::Stderr && string.contains("target 'install'")) m_noInstallTarget = true; }); - - setDoneHook([this](bool success) { - if (success) { - const FilePath rootDir = makeCommand().withNewPath(m_installRoot().path()); // FIXME: Needed? - - m_deploymentData = DeploymentData(); - m_deploymentData.setLocalInstallRoot(rootDir); - - const int startPos = rootDir.path().length(); - - const auto appFileNames = transform>(buildSystem()->applicationTargets(), - [](const BuildTargetInfo &appTarget) { return appTarget.targetFilePath.fileName(); }); - - auto handleFile = [this, &appFileNames, startPos](const FilePath &filePath) { - const DeployableFile::Type type = appFileNames.contains(filePath.fileName()) - ? DeployableFile::TypeExecutable : DeployableFile::TypeNormal; - const QString targetDir = filePath.parentDir().path().mid(startPos); - m_deploymentData.addFile(filePath, targetDir, type); - return IterationPolicy::Continue; - }; - rootDir.iterateDirectory( - handleFile, {{}, QDir::Files | QDir::Hidden, QDirIterator::Subdirectories}); - - buildSystem()->setDeploymentData(m_deploymentData); - } else if (m_noInstallTarget && m_isCmakeProject) { - emit addTask(DeploymentTask(Task::Warning, Tr::tr("You need to add an install statement " - "to your CMakeLists.txt file for deployment to work."))); - } - }); } QWidget *MakeInstallStep::createConfigWidget() @@ -216,6 +188,43 @@ bool MakeInstallStep::init() return true; } +void MakeInstallStep::doRun() +{ + using namespace Tasking; + + const auto onDone = [this] { + const FilePath rootDir = makeCommand().withNewPath(m_installRoot().path()); // FIXME: Needed? + + m_deploymentData = DeploymentData(); + m_deploymentData.setLocalInstallRoot(rootDir); + + const int startPos = rootDir.path().length(); + + const auto appFileNames = transform>(buildSystem()->applicationTargets(), + [](const BuildTargetInfo &appTarget) { return appTarget.targetFilePath.fileName(); }); + + auto handleFile = [this, &appFileNames, startPos](const FilePath &filePath) { + const DeployableFile::Type type = appFileNames.contains(filePath.fileName()) + ? DeployableFile::TypeExecutable : DeployableFile::TypeNormal; + const QString targetDir = filePath.parentDir().path().mid(startPos); + m_deploymentData.addFile(filePath, targetDir, type); + return IterationPolicy::Continue; + }; + rootDir.iterateDirectory( + handleFile, {{}, QDir::Files | QDir::Hidden, QDirIterator::Subdirectories}); + + buildSystem()->setDeploymentData(m_deploymentData); + }; + const auto onError = [this] { + if (m_noInstallTarget && m_isCmakeProject) { + emit addTask(DeploymentTask(Task::Warning, Tr::tr("You need to add an install " + "statement to your CMakeLists.txt file for deployment to work."))); + } + }; + + runTaskTree({onGroupDone(onDone), onGroupError(onError), defaultProcessTask()}); +} + void MakeInstallStep::updateCommandFromAspect() { if (m_customCommand.isChecked())