forked from qt-creator/qt-creator
MakeInstallStep: Employ task tree for running
Task-number: QTCREATORBUG-29168 Change-Id: I1e4e971f980935425b5bb9dd0355a5ae09f3843e Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -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<QSet<QString>>(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<QSet<QString>>(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())
|
||||
|
Reference in New Issue
Block a user