summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/remotelinux/remotelinux.pro4
-rw-r--r--src/plugins/remotelinux/remotelinux.qbs4
-rw-r--r--src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp4
-rw-r--r--src/plugins/remotelinux/remotelinuxkillappservice.cpp101
-rw-r--r--src/plugins/remotelinux/remotelinuxkillappservice.h60
-rw-r--r--src/plugins/remotelinux/remotelinuxkillappstep.cpp80
-rw-r--r--src/plugins/remotelinux/remotelinuxkillappstep.h52
-rw-r--r--src/plugins/remotelinux/remotelinuxplugin.cpp2
8 files changed, 306 insertions, 1 deletions
diff --git a/src/plugins/remotelinux/remotelinux.pro b/src/plugins/remotelinux/remotelinux.pro
index e1b755a4b0..1abcf3dfde 100644
--- a/src/plugins/remotelinux/remotelinux.pro
+++ b/src/plugins/remotelinux/remotelinux.pro
@@ -40,6 +40,8 @@ HEADERS += \
genericlinuxdeviceconfigurationwidget.h \
remotelinuxcheckforfreediskspaceservice.h \
remotelinuxcheckforfreediskspacestep.h \
+ remotelinuxkillappservice.h \
+ remotelinuxkillappstep.h \
remotelinuxqmltoolingsupport.h \
linuxdeviceprocess.h \
remotelinuxcustomrunconfiguration.h \
@@ -82,6 +84,8 @@ SOURCES += \
genericlinuxdeviceconfigurationwidget.cpp \
remotelinuxcheckforfreediskspaceservice.cpp \
remotelinuxcheckforfreediskspacestep.cpp \
+ remotelinuxkillappservice.cpp \
+ remotelinuxkillappstep.cpp \
remotelinuxqmltoolingsupport.cpp \
linuxdeviceprocess.cpp \
remotelinuxcustomrunconfiguration.cpp \
diff --git a/src/plugins/remotelinux/remotelinux.qbs b/src/plugins/remotelinux/remotelinux.qbs
index 8fb3cae837..7b64a407ff 100644
--- a/src/plugins/remotelinux/remotelinux.qbs
+++ b/src/plugins/remotelinux/remotelinux.qbs
@@ -80,6 +80,10 @@ Project {
"remotelinuxenvironmentaspectwidget.h",
"remotelinuxenvironmentreader.cpp",
"remotelinuxenvironmentreader.h",
+ "remotelinuxkillappservice.cpp",
+ "remotelinuxkillappservice.h",
+ "remotelinuxkillappstep.cpp",
+ "remotelinuxkillappstep.h",
"remotelinuxpackageinstaller.cpp",
"remotelinuxpackageinstaller.h",
"remotelinuxplugin.cpp",
diff --git a/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp b/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp
index fe33f4fe27..a6e5ae8492 100644
--- a/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp
+++ b/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp
@@ -27,6 +27,7 @@
#include "genericdirectuploadstep.h"
#include "remotelinuxcheckforfreediskspacestep.h"
+#include "remotelinuxkillappstep.h"
#include "remotelinux_constants.h"
#include <projectexplorer/abi.h>
@@ -49,7 +50,8 @@ RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(Target *target)
void RemoteLinuxDeployConfiguration::initialize()
{
stepList()->insertStep(0, new RemoteLinuxCheckForFreeDiskSpaceStep(stepList()));
- stepList()->insertStep(1, new GenericDirectUploadStep(stepList()));
+ stepList()->insertStep(1, new RemoteLinuxKillAppStep(stepList()));
+ stepList()->insertStep(2, new GenericDirectUploadStep(stepList()));
}
NamedWidget *RemoteLinuxDeployConfiguration::createConfigWidget()
diff --git a/src/plugins/remotelinux/remotelinuxkillappservice.cpp b/src/plugins/remotelinux/remotelinuxkillappservice.cpp
new file mode 100644
index 0000000000..f033635444
--- /dev/null
+++ b/src/plugins/remotelinux/remotelinuxkillappservice.cpp
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "remotelinuxkillappservice.h"
+
+namespace RemoteLinux {
+namespace Internal {
+class RemoteLinuxKillAppServicePrivate
+{
+public:
+ QString remoteExecutable;
+ ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOp;
+};
+} // namespace Internal
+
+RemoteLinuxKillAppService::RemoteLinuxKillAppService(QObject *parent)
+ : AbstractRemoteLinuxDeployService(parent),
+ d(new Internal::RemoteLinuxKillAppServicePrivate)
+{
+}
+
+RemoteLinuxKillAppService::~RemoteLinuxKillAppService()
+{
+ cleanup();
+ delete d;
+}
+
+void RemoteLinuxKillAppService::setRemoteExecutable(const QString &filePath)
+{
+ d->remoteExecutable = filePath;
+}
+
+bool RemoteLinuxKillAppService::isDeploymentNecessary() const
+{
+ return !d->remoteExecutable.isEmpty();
+}
+
+void RemoteLinuxKillAppService::doDeploy()
+{
+ d->signalOp = deviceConfiguration()->signalOperation();
+ if (!d->signalOp) {
+ handleDeploymentDone();
+ return;
+ }
+ connect(d->signalOp.data(), &ProjectExplorer::DeviceProcessSignalOperation::finished,
+ this, &RemoteLinuxKillAppService::handleSignalOpFinished);
+ emit progressMessage(tr("Trying to kill \"%1\" on remote device...").arg(d->remoteExecutable));
+ d->signalOp->killProcess(d->remoteExecutable);
+}
+
+void RemoteLinuxKillAppService::cleanup()
+{
+ if (d->signalOp) {
+ disconnect(d->signalOp.data(), nullptr, this, nullptr);
+ d->signalOp.clear();
+ }
+}
+
+void RemoteLinuxKillAppService::finishDeployment()
+{
+ cleanup();
+ handleDeploymentDone();
+}
+
+void RemoteLinuxKillAppService::stopDeployment()
+{
+ finishDeployment();
+}
+
+void RemoteLinuxKillAppService::handleSignalOpFinished(const QString &errorMessage)
+{
+ if (errorMessage.isEmpty())
+ emit progressMessage(tr("Remote application killed."));
+ else
+ emit progressMessage(tr("Failed to kill remote application. Assuming it was not running."));
+ finishDeployment();
+}
+
+} // namespace RemoteLinux
diff --git a/src/plugins/remotelinux/remotelinuxkillappservice.h b/src/plugins/remotelinux/remotelinuxkillappservice.h
new file mode 100644
index 0000000000..16dd33908e
--- /dev/null
+++ b/src/plugins/remotelinux/remotelinuxkillappservice.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "abstractremotelinuxdeployservice.h"
+
+namespace RemoteLinux {
+namespace Internal { class RemoteLinuxKillAppServicePrivate; }
+
+class REMOTELINUX_EXPORT RemoteLinuxKillAppService : public AbstractRemoteLinuxDeployService
+{
+ Q_OBJECT
+public:
+ RemoteLinuxKillAppService(QObject *parent = nullptr);
+ ~RemoteLinuxKillAppService() override;
+
+ void setRemoteExecutable(const QString &filePath);
+
+private:
+ void handleStdErr();
+ void handleProcessFinished();
+
+ bool isDeploymentNecessary() const override;
+ void doDeviceSetup() override { handleDeviceSetupDone(true); }
+ void stopDeviceSetup() override { handleDeviceSetupDone(false); }
+
+ void doDeploy() override;
+ void stopDeployment() override;
+
+ void handleSignalOpFinished(const QString &errorMessage);
+ void cleanup();
+ void finishDeployment();
+
+ Internal::RemoteLinuxKillAppServicePrivate * const d;
+};
+
+} // namespace RemoteLinux
diff --git a/src/plugins/remotelinux/remotelinuxkillappstep.cpp b/src/plugins/remotelinux/remotelinuxkillappstep.cpp
new file mode 100644
index 0000000000..050532ba3a
--- /dev/null
+++ b/src/plugins/remotelinux/remotelinuxkillappstep.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "remotelinuxkillappstep.h"
+
+#include "remotelinuxkillappservice.h"
+
+#include <projectexplorer/runconfiguration.h>
+#include <projectexplorer/runnables.h>
+#include <projectexplorer/target.h>
+#include <utils/qtcassert.h>
+
+#include <QString>
+
+using namespace ProjectExplorer;
+
+namespace RemoteLinux {
+
+RemoteLinuxKillAppStep::RemoteLinuxKillAppStep(BuildStepList *bsl, Core::Id id)
+ : AbstractRemoteLinuxDeployStep(bsl, id), m_service(new RemoteLinuxKillAppService(this))
+{
+ setDefaultDisplayName(displayName());
+}
+
+BuildStepConfigWidget *RemoteLinuxKillAppStep::createConfigWidget()
+{
+ return new SimpleBuildStepConfigWidget(this);
+}
+
+bool RemoteLinuxKillAppStep::initInternal(QString *error)
+{
+ Q_UNUSED(error);
+ Target * const theTarget = target();
+ QTC_ASSERT(theTarget, return false);
+ RunConfiguration * const rc = theTarget->activeRunConfiguration();
+ const QString remoteExe = rc && rc->runnable().is<StandardRunnable>()
+ ? rc->runnable().as<StandardRunnable>().executable
+ : QString();
+ m_service->setRemoteExecutable(remoteExe);
+ return true;
+}
+
+AbstractRemoteLinuxDeployService *RemoteLinuxKillAppStep::deployService() const
+{
+ return m_service;
+}
+
+Core::Id RemoteLinuxKillAppStep::stepId()
+{
+ return "RemoteLinux.KillAppStep";
+}
+
+QString RemoteLinuxKillAppStep::displayName()
+{
+ return tr("Kill current application instance");
+}
+
+} // namespace RemoteLinux
diff --git a/src/plugins/remotelinux/remotelinuxkillappstep.h b/src/plugins/remotelinux/remotelinuxkillappstep.h
new file mode 100644
index 0000000000..dc94808ff1
--- /dev/null
+++ b/src/plugins/remotelinux/remotelinuxkillappstep.h
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "abstractremotelinuxdeploystep.h"
+
+namespace RemoteLinux {
+class RemoteLinuxKillAppService;
+
+class REMOTELINUX_EXPORT RemoteLinuxKillAppStep : public AbstractRemoteLinuxDeployStep
+{
+ Q_OBJECT
+public:
+ explicit RemoteLinuxKillAppStep(ProjectExplorer::BuildStepList *bsl,
+ Core::Id id = stepId());
+
+ static Core::Id stepId();
+ static QString displayName();
+
+private:
+ ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
+
+ bool initInternal(QString *error) override;
+ AbstractRemoteLinuxDeployService *deployService() const override;
+
+ RemoteLinuxKillAppService * const m_service;
+};
+
+} // namespace RemoteLinux
diff --git a/src/plugins/remotelinux/remotelinuxplugin.cpp b/src/plugins/remotelinux/remotelinuxplugin.cpp
index a72bfc5e94..509caab5bb 100644
--- a/src/plugins/remotelinux/remotelinuxplugin.cpp
+++ b/src/plugins/remotelinux/remotelinuxplugin.cpp
@@ -38,6 +38,7 @@
#include "remotelinuxcheckforfreediskspacestep.h"
#include "remotelinuxdeployconfiguration.h"
#include "remotelinuxcustomcommanddeploymentstep.h"
+#include "remotelinuxkillappstep.h"
#include "tarpackagecreationstep.h"
#include "uploadandinstalltarpackagestep.h"
@@ -94,6 +95,7 @@ bool RemoteLinuxPlugin::initialize(const QStringList &arguments,
addAutoReleasedObject(new GenericLinuxDeployStepFactory
<GenericRemoteLinuxCustomCommandDeploymentStep>);
addAutoReleasedObject(new GenericLinuxDeployStepFactory<RemoteLinuxCheckForFreeDiskSpaceStep>);
+ addAutoReleasedObject(new GenericLinuxDeployStepFactory<RemoteLinuxKillAppStep>);
addAutoReleasedObject(new EmbeddedLinuxQtVersionFactory);