summaryrefslogtreecommitdiff
path: root/src/plugins/remotelinux
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2017-06-19 13:27:59 +0200
committerhjk <hjk@qt.io>2017-06-20 08:04:33 +0000
commitf047e1a2a2ac6667d7d19c95e3f6bb96e17f2a5a (patch)
tree3e5d2c507350212821242829784adacd39244168 /src/plugins/remotelinux
parent1cb8e1d291fdaf46b5d0435249edb72198271ded (diff)
downloadqt-creator-f047e1a2a2ac6667d7d19c95e3f6bb96e17f2a5a.tar.gz
ProjectExplorer: Simplify standard run control construction
A lot of the target-and-tool specific run controls nowadays have something like a single main RunWorker. This patch removes the need to have user-implemented RunControlFactories in those cases and adjusts local run, remote linux, python and nim to take advantage. There's more potential use downstream. Change-Id: Ie2d2f839b8be1fad2be3b79e21de3c0e475d88cf Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/remotelinux')
-rw-r--r--src/plugins/remotelinux/remotelinux.pro2
-rw-r--r--src/plugins/remotelinux/remotelinux.qbs2
-rw-r--r--src/plugins/remotelinux/remotelinuxplugin.cpp22
-rw-r--r--src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp104
-rw-r--r--src/plugins/remotelinux/remotelinuxruncontrolfactory.h46
5 files changed, 20 insertions, 156 deletions
diff --git a/src/plugins/remotelinux/remotelinux.pro b/src/plugins/remotelinux/remotelinux.pro
index 570034882e..5167f61ace 100644
--- a/src/plugins/remotelinux/remotelinux.pro
+++ b/src/plugins/remotelinux/remotelinux.pro
@@ -16,7 +16,6 @@ HEADERS += \
genericlinuxdeviceconfigurationfactory.h \
remotelinuxrunconfigurationwidget.h \
remotelinuxrunconfigurationfactory.h \
- remotelinuxruncontrolfactory.h \
remotelinuxdebugsupport.h \
genericlinuxdeviceconfigurationwizardpages.h \
abstractremotelinuxdeploystep.h \
@@ -63,7 +62,6 @@ SOURCES += \
genericlinuxdeviceconfigurationfactory.cpp \
remotelinuxrunconfigurationwidget.cpp \
remotelinuxrunconfigurationfactory.cpp \
- remotelinuxruncontrolfactory.cpp \
remotelinuxdebugsupport.cpp \
genericlinuxdeviceconfigurationwizardpages.cpp \
abstractremotelinuxdeploystep.cpp \
diff --git a/src/plugins/remotelinux/remotelinux.qbs b/src/plugins/remotelinux/remotelinux.qbs
index 27fce5dbb8..3855efc24b 100644
--- a/src/plugins/remotelinux/remotelinux.qbs
+++ b/src/plugins/remotelinux/remotelinux.qbs
@@ -98,8 +98,6 @@ Project {
"remotelinuxrunconfigurationfactory.h",
"remotelinuxrunconfigurationwidget.cpp",
"remotelinuxrunconfigurationwidget.h",
- "remotelinuxruncontrolfactory.cpp",
- "remotelinuxruncontrolfactory.h",
"remotelinuxsignaloperation.cpp",
"remotelinuxsignaloperation.h",
"remotelinuxutils.cpp",
diff --git a/src/plugins/remotelinux/remotelinuxplugin.cpp b/src/plugins/remotelinux/remotelinuxplugin.cpp
index bde1411edc..15437952d9 100644
--- a/src/plugins/remotelinux/remotelinuxplugin.cpp
+++ b/src/plugins/remotelinux/remotelinuxplugin.cpp
@@ -28,9 +28,12 @@
#include "embeddedlinuxqtversionfactory.h"
#include "genericlinuxdeviceconfigurationfactory.h"
#include "genericremotelinuxdeploystepfactory.h"
+#include "remotelinuxanalyzesupport.h"
+#include "remotelinuxcustomrunconfiguration.h"
+#include "remotelinuxdebugsupport.h"
#include "remotelinuxdeployconfigurationfactory.h"
+#include "remotelinuxrunconfiguration.h"
#include "remotelinuxrunconfigurationfactory.h"
-#include "remotelinuxruncontrolfactory.h"
#include <QtPlugin>
@@ -48,9 +51,24 @@ bool RemoteLinuxPlugin::initialize(const QStringList &arguments,
Q_UNUSED(arguments)
Q_UNUSED(errorMessage)
+ using namespace ProjectExplorer;
+ using namespace ProjectExplorer::Constants;
+
+ auto constraint = [](RunConfiguration *runConfig) {
+ const Core::Id id = runConfig->id();
+ return id == RemoteLinuxCustomRunConfiguration::runConfigId()
+ || id.name().startsWith(RemoteLinuxRunConfiguration::IdPrefix);
+ };
+
+ RunControl::registerWorker<SimpleTargetRunner>(NORMAL_RUN_MODE, constraint);
+ RunControl::registerWorker<LinuxDeviceDebugSupport>(DEBUG_RUN_MODE, constraint);
+ RunControl::registerWorker<LinuxDeviceDebugSupport>(DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN,
+ constraint);
+ RunControl::registerWorker<RemoteLinuxQmlProfilerSupport>(QML_PROFILER_RUN_MODE, constraint);
+ //RunControl::registerWorker<RemoteLinuxPerfSupport>(PERFPROFILER_RUN_MODE, constraint);
+
addAutoReleasedObject(new GenericLinuxDeviceConfigurationFactory);
addAutoReleasedObject(new RemoteLinuxRunConfigurationFactory);
- addAutoReleasedObject(new RemoteLinuxRunControlFactory);
addAutoReleasedObject(new RemoteLinuxDeployConfigurationFactory);
addAutoReleasedObject(new GenericRemoteLinuxDeployStepFactory);
diff --git a/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp b/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp
deleted file mode 100644
index 1d219a15ac..0000000000
--- a/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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 "remotelinuxruncontrolfactory.h"
-
-#include "remotelinuxanalyzesupport.h"
-#include "remotelinuxdebugsupport.h"
-#include "remotelinuxcustomrunconfiguration.h"
-#include "remotelinuxrunconfiguration.h"
-
-#include <debugger/debuggerruncontrol.h>
-
-#include <projectexplorer/kitinformation.h>
-#include <projectexplorer/runnables.h>
-#include <projectexplorer/target.h>
-
-#include <utils/portlist.h>
-#include <utils/qtcassert.h>
-
-using namespace Debugger;
-using namespace ProjectExplorer;
-
-namespace RemoteLinux {
-namespace Internal {
-
-RemoteLinuxRunControlFactory::RemoteLinuxRunControlFactory(QObject *parent)
- : IRunControlFactory(parent)
-{
-}
-
-bool RemoteLinuxRunControlFactory::canRun(RunConfiguration *runConfiguration, Core::Id mode) const
-{
- if (mode != ProjectExplorer::Constants::NORMAL_RUN_MODE
- && mode != ProjectExplorer::Constants::DEBUG_RUN_MODE
- && mode != ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN
- && mode != ProjectExplorer::Constants::QML_PROFILER_RUN_MODE
-// && mode != ProjectExplorer::Constants::PERFPROFILER_RUN_MODE
- ) {
- return false;
- }
-
- const Core::Id id = runConfiguration->id();
- return runConfiguration->isEnabled()
- && (id == RemoteLinuxCustomRunConfiguration::runConfigId()
- || id.name().startsWith(RemoteLinuxRunConfiguration::IdPrefix));
-}
-
-RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Core::Id mode,
- QString *)
-{
- QTC_ASSERT(canRun(runConfig, mode), return 0);
-
- if (mode == ProjectExplorer::Constants::NORMAL_RUN_MODE) {
- auto runControl = new RunControl(runConfig, mode);
- (void) new SimpleTargetRunner(runControl);
- return runControl;
- }
-
- if (mode == ProjectExplorer::Constants::DEBUG_RUN_MODE
- || mode == ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN) {
- auto runControl = new RunControl(runConfig, mode);
- (void) new LinuxDeviceDebugSupport(runControl);
- return runControl;
- }
-
- if (mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
- auto runControl = new RunControl(runConfig, mode);
- (void) new RemoteLinuxQmlProfilerSupport(runControl);
- return runControl;
- }
-
- if ( mode == ProjectExplorer::Constants::PERFPROFILER_RUN_MODE) {
- auto runControl = new RunControl(runConfig, mode);
- (void) new RemoteLinuxPerfSupport(runControl);
- return runControl;
- }
- QTC_CHECK(false);
- return 0;
-}
-
-} // namespace Internal
-} // namespace RemoteLinux
diff --git a/src/plugins/remotelinux/remotelinuxruncontrolfactory.h b/src/plugins/remotelinux/remotelinuxruncontrolfactory.h
deleted file mode 100644
index 6256fa80a8..0000000000
--- a/src/plugins/remotelinux/remotelinuxruncontrolfactory.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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 <projectexplorer/runconfiguration.h>
-
-namespace RemoteLinux {
-namespace Internal {
-
-class RemoteLinuxRunControlFactory : public ProjectExplorer::IRunControlFactory
-{
- Q_OBJECT
-public:
- explicit RemoteLinuxRunControlFactory(QObject *parent = 0);
-
- bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
- Core::Id mode) const override;
- ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration,
- Core::Id mode, QString *errorMessage) override;
-};
-
-} // namespace Internal
-} // namespace RemoteLinux