diff options
author | hjk <hjk@qt.io> | 2021-10-27 07:44:12 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2021-10-27 07:24:35 +0000 |
commit | de2423f5140fa298d361eca12d6ba5d9a5cf4385 (patch) | |
tree | 5f9976dc70e5aed0ee7a7381652dcab6d09728e6 | |
parent | 4b6b9f4dec5890815cecaff4702aacc6fe209797 (diff) |
Docker: Remove DockerRunConfiguration
This was a helper in the initial work on docker support which has
been commented out for a while already.
Using "docker runconfig" would technically work, however, this is
conceptionally the same as the old "matrix problem": We'd need
docker-specific almost-duplicates for every existing non-docker
runconfig. This does not scale.
Change-Id: Idf96abb6487903fdb89e7168a5ed78b9dc9dcecf
Reviewed-by: David Schulz <david.schulz@qt.io>
-rw-r--r-- | src/plugins/docker/CMakeLists.txt | 11 | ||||
-rw-r--r-- | src/plugins/docker/docker.pro | 2 | ||||
-rw-r--r-- | src/plugins/docker/docker.qbs | 2 | ||||
-rw-r--r-- | src/plugins/docker/dockerplugin.cpp | 9 | ||||
-rw-r--r-- | src/plugins/docker/dockerrunconfiguration.cpp | 126 | ||||
-rw-r--r-- | src/plugins/docker/dockerrunconfiguration.h | 41 |
6 files changed, 3 insertions, 188 deletions
diff --git a/src/plugins/docker/CMakeLists.txt b/src/plugins/docker/CMakeLists.txt index 095d7b41c7..e89c5b5ee2 100644 --- a/src/plugins/docker/CMakeLists.txt +++ b/src/plugins/docker/CMakeLists.txt @@ -4,12 +4,7 @@ add_qtc_plugin(Docker docker_global.h dockerbuildstep.cpp dockerbuildstep.h dockerconstants.h - dockerdevice.cpp - dockerdevice.h - dockerplugin.cpp - dockerplugin.h - dockerrunconfiguration.cpp - dockerrunconfiguration.h - dockersettings.cpp - dockersettings.h + dockerdevice.cpp dockerdevice.h + dockerplugin.cpp dockerplugin.h + dockersettings.cpp dockersettings.h ) diff --git a/src/plugins/docker/docker.pro b/src/plugins/docker/docker.pro index ac012006b7..49ddfcd9a0 100644 --- a/src/plugins/docker/docker.pro +++ b/src/plugins/docker/docker.pro @@ -6,7 +6,6 @@ SOURCES += \ dockerbuildstep.cpp \ dockerdevice.cpp \ dockerplugin.cpp \ - dockerrunconfiguration.cpp \ dockersettings.cpp HEADERS += \ @@ -15,5 +14,4 @@ HEADERS += \ dockerconstants.h \ dockerdevice.h \ dockerplugin.h \ - dockerrunconfiguration.h \ dockersettings.h diff --git a/src/plugins/docker/docker.qbs b/src/plugins/docker/docker.qbs index 93ea8a84ba..60c3129063 100644 --- a/src/plugins/docker/docker.qbs +++ b/src/plugins/docker/docker.qbs @@ -19,8 +19,6 @@ QtcPlugin { "dockerdevice.cpp", "dockerplugin.h", "dockerplugin.cpp", - "dockerrunconfiguration.h", - "dockerrunconfiguration.cpp", "dockersettings.h", "dockersettings.cpp" ] diff --git a/src/plugins/docker/dockerplugin.cpp b/src/plugins/docker/dockerplugin.cpp index b1fea6e45e..d195c81d6b 100644 --- a/src/plugins/docker/dockerplugin.cpp +++ b/src/plugins/docker/dockerplugin.cpp @@ -29,11 +29,9 @@ #include "dockerbuildstep.h" #include "dockerdevice.h" -#include "dockerrunconfiguration.h" #include "dockersettings.h" #include <projectexplorer/projectexplorerconstants.h> -#include <projectexplorer/runcontrol.h> using namespace Core; using namespace ProjectExplorer; @@ -49,13 +47,6 @@ public: // DockerOptionsPage optionsPage{&settings}; DockerDeviceFactory deviceFactory; -// DockerContainerRunConfigurationFactory containerRunConfigFactory; - -// RunWorkerFactory containerRunWorkerFactory{ -// RunWorkerFactory::make<SimpleTargetRunner>(), -// {ProjectExplorer::Constants::NORMAL_RUN_MODE}, -// {containerRunConfigFactory.runConfigurationId()} -// }; // DockerBuildStepFactory buildStepFactory; Utils::optional<bool> daemonRunning; diff --git a/src/plugins/docker/dockerrunconfiguration.cpp b/src/plugins/docker/dockerrunconfiguration.cpp deleted file mode 100644 index c9018ae84b..0000000000 --- a/src/plugins/docker/dockerrunconfiguration.cpp +++ /dev/null @@ -1,126 +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 "dockerrunconfiguration.h" - -#include "dockerconstants.h" -#include "dockerdevice.h" - -#include <projectexplorer/kitinformation.h> -#include <projectexplorer/project.h> -#include <projectexplorer/runconfigurationaspects.h> -#include <projectexplorer/runcontrol.h> -#include <projectexplorer/target.h> - -#include <utils/stringutils.h> - -using namespace ProjectExplorer; -using namespace Utils; - -namespace Docker { -namespace Internal { - -class DockerContainerRunConfiguration : public RunConfiguration -{ - Q_DECLARE_TR_FUNCTIONS(Docker::Internal::DockerRunConfiguration) - -public: - DockerContainerRunConfiguration(Target *target, Id id) - : RunConfiguration(target, id) - { - auto rmOption = addAspect<BoolAspect>(); - rmOption->setSettingsKey("Docker.RunConfiguration.RmOption"); - rmOption->setDefaultValue(true); - rmOption->setLabelText(tr("Automatically remove the container when it exits")); - - auto ttyOption = addAspect<BoolAspect>(); - ttyOption->setSettingsKey("Docker.RunConfiguration.TtyOption"); - ttyOption->setLabelText(tr("Allocate a pseudo-TTY")); - ttyOption->setVisible(false); // Not yet. - - auto interactiveOption = addAspect<BoolAspect>(); - interactiveOption->setSettingsKey("Docker.RunConfiguration.InteractiveOption"); - interactiveOption->setLabelText(tr("Keep STDIN open even if not attached")); - interactiveOption->setVisible(false); // Not yet. - - auto effectiveCommand = addAspect<StringAspect>(); - effectiveCommand->setLabelText(tr("Effective command call:")); - effectiveCommand->setDisplayStyle(StringAspect::TextEditDisplay); - effectiveCommand->setReadOnly(true); - - setUpdater([this, effectiveCommand] { - IDevice::ConstPtr device = DeviceKitAspect::device(kit()); - QTC_ASSERT(device, return); - DockerDevice::ConstPtr dockerDevice = qSharedPointerCast<const DockerDevice>(device); - QTC_ASSERT(dockerDevice, return); - const DockerDeviceData &data = dockerDevice->data(); - - const Runnable r = runnable(); - const QStringList dockerRunFlags = r.extraData[Constants::DOCKER_RUN_FLAGS].toStringList(); - - CommandLine cmd("docker"); - cmd.addArg("run"); - cmd.addArgs(dockerRunFlags); - cmd.addArg(data.imageId); - - // FIXME: the global one above is apparently not sufficient. - effectiveCommand->setReadOnly(true); - effectiveCommand->setValue(cmd.toUserOutput()); - }); - - setRunnableModifier([rmOption, interactiveOption, ttyOption](Runnable &runnable) { - QStringList runArgs; - if (!rmOption->value()) - runArgs.append("--rm=false"); - if (interactiveOption->value()) - runArgs.append("--interactive"); - if (ttyOption->value()) - runArgs.append("--tty"); - runnable.extraData[Constants::DOCKER_RUN_FLAGS].toStringList(); - }); - - setCommandLineGetter([] { - return CommandLine(); - }); - - update(); - connect(rmOption, &BaseAspect::changed, this, &RunConfiguration::update); - } - -private: - bool isEnabled() const override { return true; } -}; - - -DockerContainerRunConfigurationFactory::DockerContainerRunConfigurationFactory() : - FixedRunConfigurationFactory(DockerContainerRunConfiguration::tr("Docker Container")) -{ - registerRunConfiguration<DockerContainerRunConfiguration> - ("Docker.DockerContainerRunConfiguration"); - addSupportedTargetDeviceType(Constants::DOCKER_DEVICE_TYPE); -} - -} // Internal -} // Docker diff --git a/src/plugins/docker/dockerrunconfiguration.h b/src/plugins/docker/dockerrunconfiguration.h deleted file mode 100644 index 37eef9ba6c..0000000000 --- a/src/plugins/docker/dockerrunconfiguration.h +++ /dev/null @@ -1,41 +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 Docker { -namespace Internal { - -class DockerContainerRunConfigurationFactory - : public ProjectExplorer::FixedRunConfigurationFactory -{ -public: - DockerContainerRunConfigurationFactory(); -}; - -} // Internal -} // Docker |