forked from qt-creator/qt-creator
RemoteLinux: Merge abstractremotelinuxdeploy{step,service} file pairs
Plan is to merge the class hierarchies, this is a mechanical first step. Change-Id: I163578297a4badb5b8c861283f0d6a44c25f124f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -3,17 +3,37 @@
|
||||
|
||||
#include "abstractremotelinuxdeploystep.h"
|
||||
|
||||
#include "abstractremotelinuxdeployservice.h"
|
||||
#include "deploymenttimeinfo.h"
|
||||
#include "remotelinuxtr.h"
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/deployablefile.h>
|
||||
#include <projectexplorer/devicesupport/idevice.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/tasktree.h>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QPointer>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace RemoteLinux {
|
||||
namespace Internal {
|
||||
|
||||
class AbstractRemoteLinuxDeployServicePrivate
|
||||
{
|
||||
public:
|
||||
IDevice::ConstPtr deviceConfiguration;
|
||||
QPointer<Target> target;
|
||||
|
||||
DeploymentTimeInfo deployTimes;
|
||||
std::unique_ptr<TaskTree> m_taskTree;
|
||||
};
|
||||
|
||||
class AbstractRemoteLinuxDeployStepPrivate
|
||||
{
|
||||
public:
|
||||
@@ -23,7 +43,117 @@ public:
|
||||
AbstractRemoteLinuxDeployService *deployService = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // Internal
|
||||
|
||||
using namespace Internal;
|
||||
|
||||
AbstractRemoteLinuxDeployService::AbstractRemoteLinuxDeployService(QObject *parent)
|
||||
: QObject(parent), d(new AbstractRemoteLinuxDeployServicePrivate)
|
||||
{
|
||||
}
|
||||
|
||||
AbstractRemoteLinuxDeployService::~AbstractRemoteLinuxDeployService()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
const Target *AbstractRemoteLinuxDeployService::target() const
|
||||
{
|
||||
return d->target;
|
||||
}
|
||||
|
||||
const Kit *AbstractRemoteLinuxDeployService::kit() const
|
||||
{
|
||||
return d->target ? d->target->kit() : nullptr;
|
||||
}
|
||||
|
||||
IDevice::ConstPtr AbstractRemoteLinuxDeployService::deviceConfiguration() const
|
||||
{
|
||||
return d->deviceConfiguration;
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxDeployService::saveDeploymentTimeStamp(const DeployableFile &deployableFile,
|
||||
const QDateTime &remoteTimestamp)
|
||||
{
|
||||
d->deployTimes.saveDeploymentTimeStamp(deployableFile, kit(), remoteTimestamp);
|
||||
}
|
||||
|
||||
bool AbstractRemoteLinuxDeployService::hasLocalFileChanged(
|
||||
const DeployableFile &deployableFile) const
|
||||
{
|
||||
return d->deployTimes.hasLocalFileChanged(deployableFile, kit());
|
||||
}
|
||||
|
||||
bool AbstractRemoteLinuxDeployService::hasRemoteFileChanged(
|
||||
const DeployableFile &deployableFile, const QDateTime &remoteTimestamp) const
|
||||
{
|
||||
return d->deployTimes.hasRemoteFileChanged(deployableFile, kit(), remoteTimestamp);
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxDeployService::setTarget(Target *target)
|
||||
{
|
||||
d->target = target;
|
||||
d->deviceConfiguration = DeviceKitAspect::device(kit());
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxDeployService::setDevice(const IDevice::ConstPtr &device)
|
||||
{
|
||||
d->deviceConfiguration = device;
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxDeployService::start()
|
||||
{
|
||||
QTC_ASSERT(!d->m_taskTree, return);
|
||||
|
||||
const CheckResult check = isDeploymentPossible();
|
||||
if (!check) {
|
||||
emit errorMessage(check.errorMessage());
|
||||
emit finished();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isDeploymentNecessary()) {
|
||||
emit progressMessage(Tr::tr("No deployment action necessary. Skipping."));
|
||||
emit finished();
|
||||
return;
|
||||
}
|
||||
|
||||
d->m_taskTree.reset(new TaskTree(deployRecipe()));
|
||||
const auto endHandler = [this] {
|
||||
d->m_taskTree.release()->deleteLater();
|
||||
emit finished();
|
||||
};
|
||||
connect(d->m_taskTree.get(), &TaskTree::done, this, endHandler);
|
||||
connect(d->m_taskTree.get(), &TaskTree::errorOccurred, this, endHandler);
|
||||
d->m_taskTree->start();
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxDeployService::stop()
|
||||
{
|
||||
if (!d->m_taskTree)
|
||||
return;
|
||||
d->m_taskTree.reset();
|
||||
emit finished();
|
||||
}
|
||||
|
||||
CheckResult AbstractRemoteLinuxDeployService::isDeploymentPossible() const
|
||||
{
|
||||
if (!deviceConfiguration())
|
||||
return CheckResult::failure(Tr::tr("No device configuration set."));
|
||||
return CheckResult::success();
|
||||
}
|
||||
|
||||
QVariantMap AbstractRemoteLinuxDeployService::exportDeployTimes() const
|
||||
{
|
||||
return d->deployTimes.exportDeployTimes();
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxDeployService::importDeployTimes(const QVariantMap &map)
|
||||
{
|
||||
d->deployTimes.importDeployTimes(map);
|
||||
}
|
||||
|
||||
|
||||
|
||||
AbstractRemoteLinuxDeployStep::AbstractRemoteLinuxDeployStep(BuildStepList *bsl, Utils::Id id)
|
||||
: BuildStep(bsl, id), d(new Internal::AbstractRemoteLinuxDeployStepPrivate)
|
||||
|
||||
Reference in New Issue
Block a user