forked from qt-creator/qt-creator
QNX: Export QnxDeviceConfiguration
Allow other plugins to use the existing Qnx device implementation. Move QnxDeviceProcess into separate header/source files. Change-Id: I3fe62aefbe8a71adf75acfc1a2c0c8ac1cc3d1e1 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -34,7 +34,8 @@ SOURCES += qnxplugin.cpp \
|
|||||||
qnxconfigurationmanager.cpp \
|
qnxconfigurationmanager.cpp \
|
||||||
qnxsettingspage.cpp \
|
qnxsettingspage.cpp \
|
||||||
qnxversionnumber.cpp \
|
qnxversionnumber.cpp \
|
||||||
qnxdeployqtlibrariesdialog.cpp
|
qnxdeployqtlibrariesdialog.cpp \
|
||||||
|
qnxdeviceprocess.cpp
|
||||||
|
|
||||||
HEADERS += qnxplugin.h\
|
HEADERS += qnxplugin.h\
|
||||||
qnxconstants.h \
|
qnxconstants.h \
|
||||||
@@ -69,14 +70,16 @@ HEADERS += qnxplugin.h\
|
|||||||
qnxconfigurationmanager.h \
|
qnxconfigurationmanager.h \
|
||||||
qnxsettingspage.h \
|
qnxsettingspage.h \
|
||||||
qnxversionnumber.h \
|
qnxversionnumber.h \
|
||||||
qnxdeployqtlibrariesdialog.h
|
qnxdeployqtlibrariesdialog.h \
|
||||||
|
qnx_export.h \
|
||||||
|
qnxdeviceprocess.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
qnxsettingswidget.ui \
|
qnxsettingswidget.ui \
|
||||||
qnxdeployqtlibrariesdialog.ui
|
qnxdeployqtlibrariesdialog.ui
|
||||||
|
|
||||||
|
|
||||||
DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
|
DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII QNX_LIBRARY
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
qnx.qrc
|
qnx.qrc
|
||||||
|
|||||||
42
src/plugins/qnx/qnx_export.h
Normal file
42
src/plugins/qnx/qnx_export.h
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2015 The Qt Company Ltd.
|
||||||
|
** Contact: http://www.qt.io/licensing
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms and
|
||||||
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||||
|
** use the contact form at http://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 or version 3 as published by the Free
|
||||||
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||||
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||||
|
** following information to ensure the GNU Lesser General Public License
|
||||||
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||||
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||||
|
** rights. These rights are described in The Qt Company LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef QNX_EXPORT_H
|
||||||
|
#define QNX_EXPORT_H
|
||||||
|
|
||||||
|
#include <qglobal.h>
|
||||||
|
|
||||||
|
#if defined(QNX_LIBRARY)
|
||||||
|
# define QNX_EXPORT Q_DECL_EXPORT
|
||||||
|
#else
|
||||||
|
# define QNX_EXPORT Q_DECL_IMPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // QNX_EXPORT_H
|
||||||
@@ -35,11 +35,11 @@
|
|||||||
#include "qnxdeviceprocesslist.h"
|
#include "qnxdeviceprocesslist.h"
|
||||||
#include "qnxdeviceprocesssignaloperation.h"
|
#include "qnxdeviceprocesssignaloperation.h"
|
||||||
#include "qnxdeployqtlibrariesdialog.h"
|
#include "qnxdeployqtlibrariesdialog.h"
|
||||||
|
#include "qnxdeviceprocess.h"
|
||||||
|
|
||||||
#include <projectexplorer/devicesupport/sshdeviceprocess.h>
|
#include <projectexplorer/devicesupport/sshdeviceprocess.h>
|
||||||
#include <ssh/sshconnection.h>
|
#include <ssh/sshconnection.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/qtcprocess.h>
|
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
@@ -50,51 +50,12 @@ using namespace ProjectExplorer;
|
|||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
namespace Internal {
|
|
||||||
|
using namespace Internal;
|
||||||
|
|
||||||
const char QnxVersionKey[] = "QnxVersion";
|
const char QnxVersionKey[] = "QnxVersion";
|
||||||
const char DeployQtLibrariesActionId [] = "Qnx.Qnx.DeployQtLibrariesAction";
|
const char DeployQtLibrariesActionId [] = "Qnx.Qnx.DeployQtLibrariesAction";
|
||||||
|
|
||||||
static int pidFileCounter = 0;
|
|
||||||
|
|
||||||
QnxDeviceProcess::QnxDeviceProcess(const QSharedPointer<const IDevice> &device, QObject *parent)
|
|
||||||
: SshDeviceProcess(device, parent)
|
|
||||||
{
|
|
||||||
setEnvironment(Environment(OsTypeLinux));
|
|
||||||
m_pidFile = QString::fromLatin1("/var/run/qtc.%1.pid").arg(++pidFileCounter);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QnxDeviceProcess::fullCommandLine() const
|
|
||||||
{
|
|
||||||
QStringList args = arguments();
|
|
||||||
args.prepend(executable());
|
|
||||||
QString cmd = QtcProcess::Arguments::createUnixArgs(args).toString();
|
|
||||||
|
|
||||||
QString fullCommandLine = QLatin1String(
|
|
||||||
"test -f /etc/profile && . /etc/profile ; "
|
|
||||||
"test -f $HOME/profile && . $HOME/profile ; "
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!m_workingDir.isEmpty())
|
|
||||||
fullCommandLine += QString::fromLatin1("cd %1 ; ").arg(QtcProcess::quoteArg(m_workingDir));
|
|
||||||
|
|
||||||
for (auto it = environment().constBegin(); it != environment().constEnd(); ++it)
|
|
||||||
fullCommandLine += QString::fromLatin1("%1='%2' ").arg(it.key()).arg(it.value());
|
|
||||||
|
|
||||||
fullCommandLine += QString::fromLatin1("%1 & echo $! > %2").arg(cmd).arg(m_pidFile);
|
|
||||||
|
|
||||||
return fullCommandLine;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QnxDeviceProcess::doSignal(int sig)
|
|
||||||
{
|
|
||||||
auto signaler = new SshDeviceProcess(device(), this);
|
|
||||||
QString cmd = QString::fromLatin1("kill -%2 `cat %1`").arg(m_pidFile).arg(sig);
|
|
||||||
connect(signaler, &SshDeviceProcess::finished, signaler, &QObject::deleteLater);
|
|
||||||
signaler->start(cmd, QStringList());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class QnxPortsGatheringMethod : public PortsGatheringMethod
|
class QnxPortsGatheringMethod : public PortsGatheringMethod
|
||||||
{
|
{
|
||||||
// TODO: The command is probably needlessly complicated because the parsing method
|
// TODO: The command is probably needlessly complicated because the parsing method
|
||||||
@@ -276,5 +237,4 @@ DeviceProcessSignalOperation::Ptr QnxDeviceConfiguration::signalOperation() cons
|
|||||||
new QnxDeviceProcessSignalOperation(sshParameters()));
|
new QnxDeviceProcessSignalOperation(sshParameters()));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Qnx
|
} // namespace Qnx
|
||||||
|
|||||||
@@ -33,31 +33,13 @@
|
|||||||
#ifndef QNX_INTERNAL_QNXDEVICECONFIGURATION_H
|
#ifndef QNX_INTERNAL_QNXDEVICECONFIGURATION_H
|
||||||
#define QNX_INTERNAL_QNXDEVICECONFIGURATION_H
|
#define QNX_INTERNAL_QNXDEVICECONFIGURATION_H
|
||||||
|
|
||||||
|
#include "qnx_export.h"
|
||||||
|
|
||||||
#include <remotelinux/linuxdevice.h>
|
#include <remotelinux/linuxdevice.h>
|
||||||
#include <projectexplorer/devicesupport/sshdeviceprocess.h>
|
|
||||||
|
|
||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class QnxDeviceProcess : public ProjectExplorer::SshDeviceProcess
|
class QNX_EXPORT QnxDeviceConfiguration : public RemoteLinux::LinuxDevice
|
||||||
{
|
|
||||||
public:
|
|
||||||
QnxDeviceProcess(const QSharedPointer<const ProjectExplorer::IDevice> &device, QObject *parent);
|
|
||||||
|
|
||||||
void setWorkingDirectory(const QString &directory) { m_workingDir = directory; }
|
|
||||||
|
|
||||||
void interrupt() { doSignal(2); }
|
|
||||||
void terminate() { doSignal(15); }
|
|
||||||
void kill() { doSignal(9); }
|
|
||||||
QString fullCommandLine() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void doSignal(int sig);
|
|
||||||
QString m_pidFile;
|
|
||||||
QString m_workingDir;
|
|
||||||
};
|
|
||||||
|
|
||||||
class QnxDeviceConfiguration : public RemoteLinux::LinuxDevice
|
|
||||||
{
|
{
|
||||||
Q_DECLARE_TR_FUNCTIONS(Qnx::Internal::QnxDeviceConfiguration)
|
Q_DECLARE_TR_FUNCTIONS(Qnx::Internal::QnxDeviceConfiguration)
|
||||||
|
|
||||||
@@ -103,7 +85,6 @@ private:
|
|||||||
mutable int m_versionNumber;
|
mutable int m_versionNumber;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Qnx
|
} // namespace Qnx
|
||||||
|
|
||||||
#endif // QNX_INTERNAL_QNXDEVICECONFIGURATION_H
|
#endif // QNX_INTERNAL_QNXDEVICECONFIGURATION_H
|
||||||
|
|||||||
84
src/plugins/qnx/qnxdeviceprocess.cpp
Normal file
84
src/plugins/qnx/qnxdeviceprocess.cpp
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2012 - 2014 BlackBerry Limited. All rights reserved.
|
||||||
|
**
|
||||||
|
** Contact: BlackBerry (qt@blackberry.com)
|
||||||
|
** Contact: KDAB (info@kdab.com)
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms and
|
||||||
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||||
|
** use the contact form at http://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 or version 3 as published by the Free
|
||||||
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||||
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||||
|
** following information to ensure the GNU Lesser General Public License
|
||||||
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||||
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||||
|
** rights. These rights are described in The Qt Company LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "qnxdeviceprocess.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/devicesupport/sshdeviceprocess.h>
|
||||||
|
#include <utils/qtcprocess.h>
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
|
namespace Qnx {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
static int pidFileCounter = 0;
|
||||||
|
|
||||||
|
QnxDeviceProcess::QnxDeviceProcess(const QSharedPointer<const IDevice> &device, QObject *parent)
|
||||||
|
: SshDeviceProcess(device, parent)
|
||||||
|
{
|
||||||
|
setEnvironment(Environment(OsTypeLinux));
|
||||||
|
m_pidFile = QString::fromLatin1("/var/run/qtc.%1.pid").arg(++pidFileCounter);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString QnxDeviceProcess::fullCommandLine() const
|
||||||
|
{
|
||||||
|
QStringList args = arguments();
|
||||||
|
args.prepend(executable());
|
||||||
|
QString cmd = QtcProcess::Arguments::createUnixArgs(args).toString();
|
||||||
|
|
||||||
|
QString fullCommandLine = QLatin1String(
|
||||||
|
"test -f /etc/profile && . /etc/profile ; "
|
||||||
|
"test -f $HOME/profile && . $HOME/profile ; "
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!m_workingDir.isEmpty())
|
||||||
|
fullCommandLine += QString::fromLatin1("cd %1 ; ").arg(QtcProcess::quoteArg(m_workingDir));
|
||||||
|
|
||||||
|
for (auto it = environment().constBegin(); it != environment().constEnd(); ++it)
|
||||||
|
fullCommandLine += QString::fromLatin1("%1='%2' ").arg(it.key()).arg(it.value());
|
||||||
|
|
||||||
|
fullCommandLine += QString::fromLatin1("%1 & echo $! > %2").arg(cmd).arg(m_pidFile);
|
||||||
|
|
||||||
|
return fullCommandLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QnxDeviceProcess::doSignal(int sig)
|
||||||
|
{
|
||||||
|
auto signaler = new SshDeviceProcess(device(), this);
|
||||||
|
QString cmd = QString::fromLatin1("kill -%2 `cat %1`").arg(m_pidFile).arg(sig);
|
||||||
|
connect(signaler, &SshDeviceProcess::finished, signaler, &QObject::deleteLater);
|
||||||
|
signaler->start(cmd, QStringList());
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Qnx
|
||||||
64
src/plugins/qnx/qnxdeviceprocess.h
Normal file
64
src/plugins/qnx/qnxdeviceprocess.h
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2012 - 2014 BlackBerry Limited. All rights reserved.
|
||||||
|
**
|
||||||
|
** Contact: BlackBerry (qt@blackberry.com)
|
||||||
|
** Contact: KDAB (info@kdab.com)
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms and
|
||||||
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||||
|
** use the contact form at http://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 or version 3 as published by the Free
|
||||||
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||||
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||||
|
** following information to ensure the GNU Lesser General Public License
|
||||||
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||||
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||||
|
** rights. These rights are described in The Qt Company LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef QNXDEVICEPROCESS_H
|
||||||
|
#define QNXDEVICEPROCESS_H
|
||||||
|
|
||||||
|
#include "qnx_export.h"
|
||||||
|
#include <remotelinux/linuxdevice.h>
|
||||||
|
#include <projectexplorer/devicesupport/sshdeviceprocess.h>
|
||||||
|
|
||||||
|
namespace Qnx {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
class QnxDeviceProcess : public ProjectExplorer::SshDeviceProcess
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QnxDeviceProcess(const QSharedPointer<const ProjectExplorer::IDevice> &device, QObject *parent);
|
||||||
|
|
||||||
|
void setWorkingDirectory(const QString &directory) { m_workingDir = directory; }
|
||||||
|
|
||||||
|
void interrupt() { doSignal(2); }
|
||||||
|
void terminate() { doSignal(15); }
|
||||||
|
void kill() { doSignal(9); }
|
||||||
|
QString fullCommandLine() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void doSignal(int sig);
|
||||||
|
QString m_pidFile;
|
||||||
|
QString m_workingDir;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Qnx
|
||||||
|
|
||||||
|
#endif // QNXDEVICEPROCESS_H
|
||||||
@@ -36,6 +36,8 @@
|
|||||||
#include <remotelinux/remotelinuxsignaloperation.h>
|
#include <remotelinux/remotelinuxsignaloperation.h>
|
||||||
|
|
||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
|
class QnxDeviceConfiguration;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QnxDeviceProcessSignalOperation : public RemoteLinux::RemoteLinuxSignalOperation
|
class QnxDeviceProcessSignalOperation : public RemoteLinux::RemoteLinuxSignalOperation
|
||||||
@@ -48,7 +50,7 @@ private:
|
|||||||
QString killProcessByNameCommandLine(const QString &filePath) const;
|
QString killProcessByNameCommandLine(const QString &filePath) const;
|
||||||
QString interruptProcessByNameCommandLine(const QString &filePath) const;
|
QString interruptProcessByNameCommandLine(const QString &filePath) const;
|
||||||
|
|
||||||
friend class QnxDeviceConfiguration;
|
friend class Qnx::QnxDeviceConfiguration;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include "slog2inforunner.h"
|
#include "slog2inforunner.h"
|
||||||
|
|
||||||
#include "qnxdeviceconfiguration.h"
|
#include "qnxdeviceprocess.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user