blob: a417125caea1a5fa0d068471366644e46bb1cb75 (
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
// 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 "remotelinuxcustomrunconfiguration.h"
#include "remotelinux_constants.h"
#include "remotelinuxtr.h"
#include "remotelinuxenvironmentaspect.h"
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/target.h>
#include <utils/hostosinfo.h>
using namespace ProjectExplorer;
using namespace Utils;
namespace RemoteLinux::Internal {
class RemoteLinuxCustomRunConfiguration : public RunConfiguration
{
public:
RemoteLinuxCustomRunConfiguration(BuildConfiguration *bc, Id id);
QString runConfigDefaultDisplayName();
private:
Tasks checkForIssues() const override;
RemoteLinuxEnvironmentAspect environment{this};
ExecutableAspect executable{this};
SymbolFileAspect symbolFile{this};
ArgumentsAspect arguments{this};
WorkingDirectoryAspect workingDir{this};
TerminalAspect terminal{this};
X11ForwardingAspect x11Forwarding{this};
};
RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(BuildConfiguration *bc, Id id)
: RunConfiguration(bc, id)
{
environment.setDeviceSelector(kit(), EnvironmentAspect::RunDevice);
executable.setDeviceSelector(kit(), ExecutableAspect::RunDevice);
executable.setSettingsKey("RemoteLinux.CustomRunConfig.RemoteExecutable");
executable.setLabelText(Tr::tr("Remote executable:"));
executable.setReadOnly(false);
executable.setHistoryCompleter("RemoteLinux.CustomExecutable.History");
executable.setExpectedKind(PathChooser::Any);
symbolFile.setSettingsKey("RemoteLinux.CustomRunConfig.LocalExecutable");
symbolFile.setLabelText(Tr::tr("Local executable:"));
workingDir.setEnvironment(&environment);
terminal.setVisible(HostOsInfo::isAnyUnixHost());
setDefaultDisplayName(runConfigDefaultDisplayName());
setUsesEmptyBuildKeys();
}
QString RemoteLinuxCustomRunConfiguration::runConfigDefaultDisplayName()
{
FilePath remoteExecutable = executable();
QString display = remoteExecutable.isEmpty()
? Tr::tr("Custom Executable")
: Tr::tr("Run \"%1\"").arg(remoteExecutable.toUserOutput());
return RunConfigurationFactory::decoratedTargetName(display, kit());
}
Tasks RemoteLinuxCustomRunConfiguration::checkForIssues() const
{
Tasks tasks;
if (executable().isEmpty()) {
tasks << createConfigurationIssue(Tr::tr("The remote executable must be set in order to run "
"a custom remote run configuration."));
}
return tasks;
}
// RemoteLinuxCustomRunConfigurationFactory
class RemoteLinuxCustomRunConfigurationFactory
: public FixedRunConfigurationFactory
{
public:
RemoteLinuxCustomRunConfigurationFactory()
: FixedRunConfigurationFactory(Tr::tr("Custom Executable"), true)
{
registerRunConfiguration<RemoteLinuxCustomRunConfiguration>(Constants::CustomRunConfigId);
setExecutionTypeId(Constants::ExecutionType);
}
};
void setupRemoteLinuxCustomRunConfiguration()
{
static RemoteLinuxCustomRunConfigurationFactory theRemoteLinuxCustomRunConfigurationFactory;
}
} // RemoteLinux::Internal
|