aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/remotelinux/abstractremotelinuxdeploystep.h
blob: 1312e47331a2d4bee0420b60ec7858a4cddafe77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include "remotelinux_export.h"

#include <projectexplorer/buildstep.h>
#include <projectexplorer/devicesupport/idevicefwd.h>

namespace ProjectExplorer { class DeployableFile; }

namespace RemoteLinux {

namespace Internal { class AbstractRemoteLinuxDeployStepPrivate; }

class REMOTELINUX_EXPORT AbstractRemoteLinuxDeployStep : public ProjectExplorer::BuildStep
{
public:
    explicit AbstractRemoteLinuxDeployStep(ProjectExplorer::BuildStepList *bsl, Utils::Id id);
    ~AbstractRemoteLinuxDeployStep() override;

protected:
    ProjectExplorer::IDeviceConstPtr deviceConfiguration() const;
    virtual Utils::expected_str<void> isDeploymentPossible() const;
    void handleStdOutData(const QString &data);
    void handleStdErrData(const QString &data);

    void fromMap(const Utils::Store &map) final;
    void toMap(Utils::Store &map) const final;
    bool init() final;

    void setInternalInitializer(const std::function<Utils::expected_str<void>()> &init);

    void saveDeploymentTimeStamp(const ProjectExplorer::DeployableFile &deployableFile,
                                 const QDateTime &remoteTimestamp);
    bool hasLocalFileChanged(const ProjectExplorer::DeployableFile &deployableFile) const;
    bool hasRemoteFileChanged(const ProjectExplorer::DeployableFile &deployableFile,
                              const QDateTime &remoteTimestamp) const;

    void addProgressMessage(const QString &message);
    void addErrorMessage(const QString &message);
    void addWarningMessage(const QString &message);

protected:
    void addSkipDeploymentMessage();

private:
    virtual Tasking::GroupItem deployRecipe() = 0;
    Tasking::GroupItem runRecipe() final;

    Internal::AbstractRemoteLinuxDeployStepPrivate *d;
};

} // RemoteLinux