aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/remotelinux/remotelinuxplugin.cpp
blob: fe0d4ad537c809d9870032e145f7daea0239a643 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include "customcommanddeploystep.h"
#include "killappstep.h"
#include "linuxdevice.h"
#include "remotelinux_constants.h"
#include "remotelinuxcustomrunconfiguration.h"
#include "remotelinuxdebugsupport.h"
#include "remotelinuxdeploysupport.h"
#include "remotelinuxrunconfiguration.h"
#include "remotelinuxtr.h"
#include "tarpackagecreationstep.h"
#include "tarpackagedeploystep.h"

#include <extensionsystem/iplugin.h>

#include <utils/fsengine/fsengine.h>

#include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/projectexplorerconstants.h>

#ifdef WITH_TESTS
#include "filesystemaccess_test.h"
#endif

using namespace Utils;

namespace RemoteLinux::Internal {

class RsyncToolFactory : public ProjectExplorer::DeviceToolAspectFactory
{
public:
    RsyncToolFactory()
    {
        setToolId(ProjectExplorer::Constants::RSYNC_TOOL_ID);
        setToolType(ProjectExplorer::DeviceToolAspect::BuildTool);
        setFilePattern({"rsync"});
        setLabelText(Tr::tr("Rsync executable:"));
    }
};

class RemoteLinuxPlugin final : public ExtensionSystem::IPlugin
{
    Q_OBJECT
    Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "RemoteLinux.json")

public:
    RemoteLinuxPlugin()
    {
        FSEngine::registerDeviceScheme(u"ssh");
    }

    ~RemoteLinuxPlugin() final
    {
        FSEngine::unregisterDeviceScheme(u"ssh");
        m_linuxDeviceFactory.reset();
    }

    void initialize() final
    {
        m_linuxDeviceFactory = std::make_unique<LinuxDeviceFactory>();
        setupRemoteLinuxRunConfiguration();
        setupRemoteLinuxCustomRunConfiguration();
        setupRemoteLinuxRunAndDebugSupport();
        setupRemoteLinuxDeploySupport();
        setupTarPackageCreationStep();
        setupTarPackageDeployStep();
        setupCustomCommandDeployStep();
        setupKillAppStep();

#ifdef WITH_TESTS
        addTest<FileSystemAccessTest>();
#endif
    }

private:
    std::unique_ptr<LinuxDeviceFactory> m_linuxDeviceFactory;
    RsyncToolFactory m_rsyncToolFactory;
};

} // RemoteLinux::Internal

#include "remotelinuxplugin.moc"