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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
// Copyright (C) 2016 BlackBerry Limited. All rights reserved.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qnxanalyzesupport.h"
#include "qnxconstants.h"
#include "qnxdebugsupport.h"
#include "qnxdevice.h"
#include "qnxqtversion.h"
#include "qnxrunconfiguration.h"
#include "qnxsettingspage.h"
#include "qnxtoolchain.h"
#include "qnxtr.h"
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/icontext.h>
#include <coreplugin/icore.h>
#include <extensionsystem/iplugin.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildstep.h>
#include <projectexplorer/deployconfiguration.h>
#include <projectexplorer/devicesupport/devicekitaspects.h>
#include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/kitmanager.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchainkitaspect.h>
#include <remotelinux/remotelinux_constants.h>
#include <QAction>
using namespace Core;
using namespace ProjectExplorer;
using namespace Utils;
namespace Qnx::Internal {
class QnxDeployStepFactory : public BuildStepFactory
{
public:
QnxDeployStepFactory(Id existingStepId, Id overrideId = {})
{
cloneStepCreator(existingStepId, overrideId);
setSupportedConfiguration(Constants::QNX_QNX_DEPLOYCONFIGURATION_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
}
};
class QnxDeployConfigurationFactory : public DeployConfigurationFactory
{
public:
QnxDeployConfigurationFactory()
{
setConfigBaseId(Constants::QNX_QNX_DEPLOYCONFIGURATION_ID);
setDefaultDisplayName(Tr::tr("Deploy to QNX Device"));
addSupportedTargetDeviceType(Constants::QNX_QNX_OS_TYPE);
setUseDeploymentDataView();
addInitialStep(RemoteLinux::Constants::MakeInstallStepId, [](BuildConfiguration *bc) {
const Project * const prj = bc->project();
return prj->deploymentKnowledge() == DeploymentKnowledge::Bad
&& prj->hasMakeInstallEquivalent();
});
addInitialStep(ProjectExplorer::Constants::DEVICE_CHECK_STEP);
addInitialStep(Constants::QNX_DIRECT_UPLOAD_STEP_ID);
}
};
void setupQnxDeployment()
{
static QnxDeployConfigurationFactory deployConfigFactory;
static QnxDeployStepFactory directUploadDeployFactory{RemoteLinux::Constants::DirectUploadStepId,
Constants::QNX_DIRECT_UPLOAD_STEP_ID};
static QnxDeployStepFactory makeInstallStepFactory{RemoteLinux::Constants::MakeInstallStepId};
}
class QnxSdpEnvFileToolAspectFactory : public DeviceToolAspectFactory
{
public:
QnxSdpEnvFileToolAspectFactory()
{
setToolId(Constants::QNX_SDPENVFILE_TOOL_ID);
setToolType(DeviceToolAspect::BuildTool);
setFilePattern({"/opt/qnx710/qnxsdp-env.sh", "/opt/qnx710/qnxsdp-env.bat",
"/opt/qnx800/qnxsdp-env.sh", "/opt/qnx800/qnxsdp-env.bat"});
setLabelText(Tr::tr("QNX sdpenv.sh:"));
setToolTip(Tr::tr("QNX Software Development Platform environment file."));
setChecker([](const DeviceConstRef &device, const FilePath &candidate) -> Result<> {
IDevice::ConstPtr dev = device.lock();
QTC_ASSERT(dev, return ResultError(ResultAssert));
if (dev->osType() == OsTypeWindows && candidate.suffix() == "bat")
return ResultOk;
if (dev->osType() != OsTypeWindows && candidate.suffix() == "sh")
return ResultOk;
return ResultError(Tr::tr("File suffix does not match OS type."));
});
}
};
void setupQnxSdpEnvFileToolAspect()
{
static QnxSdpEnvFileToolAspectFactory theQnxSdpEnvFileToolAspectFactory;
}
class QnxPlugin final : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Qnx.json")
void initialize() final
{
setupQnxDevice();
setupQnxToolchain();
setupQnxQtVersion();
setupQnxDeployment();
setupQnxRunnning();
setupQnxDebugging();
setupQnxQmlProfiler();
setupQnxSdpEnvFileToolAspect();
setupQnxSettingsPage(this);
}
void extensionsInitialized() final
{
const Utils::Id QNX_DEBUGGING_GROUP = "Debugger.Group.Qnx";
QAction *debugSeparator = nullptr;
QAction *attachToQnxApplication = nullptr;
ActionContainer *mstart = Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_DEBUG_STARTDEBUGGING);
mstart->appendGroup(QNX_DEBUGGING_GROUP);
mstart->addSeparator(Core::Context(Core::Constants::C_GLOBAL), QNX_DEBUGGING_GROUP,
&debugSeparator);
// Attach support
ActionBuilder(this, "Debugger.AttachToQnxApplication")
.setText(Tr::tr("Attach to remote QNX application..."))
.addToContainer(ProjectExplorer::Constants::M_DEBUG_STARTDEBUGGING, QNX_DEBUGGING_GROUP)
.bindContextAction(&attachToQnxApplication)
.addOnTriggered(this, &showAttachToProcessDialog);
connect(KitManager::instance(), &KitManager::kitsChanged, this,
[attachToQnxApplication, debugSeparator] {
auto isQnxKit = [](const Kit *kit) {
return RunDeviceTypeKitAspect::deviceTypeId(kit) == Constants::QNX_QNX_OS_TYPE
&& RunDeviceKitAspect::device(kit) && kit->isValid();
};
const bool hasValidQnxKit = KitManager::kit(isQnxKit) != nullptr;
attachToQnxApplication->setVisible(hasValidQnxKit);
debugSeparator->setVisible(hasValidQnxKit);
});
}
};
} // Qnx::Internal
#include "qnxplugin.moc"
|