forked from qt-creator/qt-creator
AbstractRemoteLinuxDeployStep: Enclose prechecks in recipe
This is a preparation step toward making the recipe more general. Add a runRecipe() method (private for now) which describes the whole step's execution. Later, when virtual BuildStep::runRecipe() is added, we just make this newly added method virtual. Make deployRecipe() pure virtual. Change-Id: Ic9c4e3eea7d4a3eb95fd419575f4f747224d0499 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -117,20 +117,7 @@ void AbstractRemoteLinuxDeployStep::doRun()
|
||||
|
||||
QTC_ASSERT(!d->m_taskTree, return);
|
||||
|
||||
const auto canDeploy = isDeploymentPossible();
|
||||
if (!canDeploy) {
|
||||
addErrorMessage(canDeploy.error());
|
||||
handleFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isDeploymentNecessary()) {
|
||||
addProgressMessage(Tr::tr("No deployment action necessary. Skipping."));
|
||||
handleFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
d->m_taskTree.reset(new TaskTree(deployRecipe()));
|
||||
d->m_taskTree.reset(new TaskTree(runRecipe()));
|
||||
const auto endHandler = [this] {
|
||||
d->m_taskTree.release()->deleteLater();
|
||||
handleFinished();
|
||||
@@ -198,9 +185,23 @@ bool AbstractRemoteLinuxDeployStep::isDeploymentNecessary() const
|
||||
return true;
|
||||
}
|
||||
|
||||
Group AbstractRemoteLinuxDeployStep::deployRecipe()
|
||||
Group AbstractRemoteLinuxDeployStep::runRecipe()
|
||||
{
|
||||
return {};
|
||||
const auto onSetup = [this] {
|
||||
const auto canDeploy = isDeploymentPossible();
|
||||
if (!canDeploy) {
|
||||
addErrorMessage(canDeploy.error());
|
||||
handleFinished();
|
||||
return SetupResult::StopWithError;
|
||||
}
|
||||
if (!isDeploymentNecessary()) {
|
||||
addProgressMessage(Tr::tr("No deployment action necessary. Skipping."));
|
||||
handleFinished();
|
||||
return SetupResult::StopWithDone;
|
||||
}
|
||||
return SetupResult::Continue;
|
||||
};
|
||||
return Group { onGroupSetup(onSetup), deployRecipe() };
|
||||
}
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
@@ -53,7 +53,8 @@ protected:
|
||||
|
||||
private:
|
||||
virtual bool isDeploymentNecessary() const;
|
||||
virtual Tasking::Group deployRecipe();
|
||||
virtual Tasking::Group deployRecipe() = 0;
|
||||
Tasking::Group runRecipe();
|
||||
|
||||
Internal::AbstractRemoteLinuxDeployStepPrivate *d;
|
||||
};
|
||||
|
Reference in New Issue
Block a user