RemoteLinux: Simplify GenericDirectUploadStep

The IncrementalDeployment::NotSupported was alwasy overridden with
Enabled or Disabled before actual action started, so it was not more
than a bool.

Change-Id: Ia4e986d08cdd10e20a741868ecb43e0c7ed4bf33
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2023-07-05 09:52:05 +02:00
parent 886ef1e262
commit ada4429bcb

View File

@@ -34,8 +34,6 @@ struct UploadStorage
QList<DeployableFile> filesToUpload; QList<DeployableFile> filesToUpload;
}; };
enum class IncrementalDeployment { Enabled, Disabled, NotSupported };
class GenericDirectUploadStep : public AbstractRemoteLinuxDeployStep class GenericDirectUploadStep : public AbstractRemoteLinuxDeployStep
{ {
public: public:
@@ -52,8 +50,6 @@ public:
ignoreMissingFiles.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBox); ignoreMissingFiles.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBox);
setInternalInitializer([this] { setInternalInitializer([this] {
m_incremental = incremental()
? IncrementalDeployment::Enabled : IncrementalDeployment::Disabled;
return isDeploymentPossible(); return isDeploymentPossible();
}); });
@@ -78,7 +74,6 @@ public:
GroupItem chmodTask(const DeployableFile &file); GroupItem chmodTask(const DeployableFile &file);
GroupItem chmodTree(const TreeStorage<UploadStorage> &storage); GroupItem chmodTree(const TreeStorage<UploadStorage> &storage);
IncrementalDeployment m_incremental = IncrementalDeployment::NotSupported;
mutable QList<DeployableFile> m_deployableFiles; mutable QList<DeployableFile> m_deployableFiles;
BoolAspect incremental{this}; BoolAspect incremental{this};
@@ -268,12 +263,10 @@ Group GenericDirectUploadStep::deployRecipe()
const auto preFilesToStat = [this](UploadStorage *storage) { const auto preFilesToStat = [this](UploadStorage *storage) {
QList<DeployableFile> filesToStat; QList<DeployableFile> filesToStat;
for (const DeployableFile &file : std::as_const(m_deployableFiles)) { for (const DeployableFile &file : std::as_const(m_deployableFiles)) {
if (m_incremental != IncrementalDeployment::Enabled || hasLocalFileChanged(file)) { if (!incremental() || hasLocalFileChanged(file)) {
storage->filesToUpload.append(file); storage->filesToUpload.append(file);
continue; continue;
} }
if (m_incremental == IncrementalDeployment::NotSupported)
continue;
filesToStat << file; filesToStat << file;
} }
return filesToStat; return filesToStat;
@@ -285,8 +278,7 @@ Group GenericDirectUploadStep::deployRecipe()
}; };
const auto postFilesToStat = [this](UploadStorage *storage) { const auto postFilesToStat = [this](UploadStorage *storage) {
return m_incremental == IncrementalDeployment::NotSupported return storage->filesToUpload;
? QList<DeployableFile>() : storage->filesToUpload;
}; };
const auto postStatEndHandler = [this](UploadStorage *storage, const DeployableFile &file, const auto postStatEndHandler = [this](UploadStorage *storage, const DeployableFile &file,
const QDateTime &timestamp) { const QDateTime &timestamp) {