aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/boot2qt/qdbdeployconfigurationfactory.cpp
blob: 906124157648191e9b5b2624e7db04496826d199 (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
56
57
58
59
60
61
62
63
// Copyright (C) 2019 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#include "qdbdeployconfigurationfactory.h"

#include "qdbconstants.h"

#include <projectexplorer/deploymentdataview.h>
#include "projectexplorer/devicesupport/idevice.h"
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>

#include <remotelinux/remotelinux_constants.h>

using namespace ProjectExplorer;

namespace Qdb {
namespace Internal {

QdbDeployConfigurationFactory::QdbDeployConfigurationFactory()
{
    setConfigBaseId(Constants::QdbDeployConfigurationId);
    addSupportedTargetDeviceType(Constants::QdbLinuxOsType);
    setDefaultDisplayName(QCoreApplication::translate("Qdb::Internal::QdbDeployConfiguration",
                                                      "Deploy to Boot2Qt target"));
    setUseDeploymentDataView();

    addInitialStep(RemoteLinux::Constants::MakeInstallStepId, [](Target *target) {
        const Project * const prj = target->project();
        return prj->deploymentKnowledge() == DeploymentKnowledge::Bad
                && prj->hasMakeInstallEquivalent();
    });
    addInitialStep(Qdb::Constants::QdbStopApplicationStepId);
    addInitialStep(RemoteLinux::Constants::RsyncDeployStepId, [](Target *target) {
        auto device = DeviceKitAspect::device(target->kit());
        auto buildDevice = BuildDeviceKitAspect::device(target->kit());
        if (buildDevice && buildDevice->rootPath().needsDevice())
            return false;
        return !device
               || (device && device->extraData(RemoteLinux::Constants::SupportsRSync).toBool());
    });
    addInitialStep(RemoteLinux::Constants::DirectUploadStepId, [](Target *target) {
        auto device = DeviceKitAspect::device(target->kit());
        auto buildDevice = BuildDeviceKitAspect::device(target->kit());
        if (buildDevice && buildDevice->rootPath().needsDevice())
            return false;
        return device && !device->extraData(RemoteLinux::Constants::SupportsRSync).toBool();
    });
    // This step is for:
    // a) A remote build device, as they do not support real rsync yet.
    // b) If there is no target device setup yet.
    addInitialStep(RemoteLinux::Constants::DirectUploadStepId, [](Target *target) {
        auto device = DeviceKitAspect::device(target->kit());
        auto buildDevice = BuildDeviceKitAspect::device(target->kit());
        if (buildDevice && buildDevice->rootPath().needsDevice())
            return true;
        return false;
    });
}

} // namespace Internal
} // namespace Qdb