forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -4,12 +4,7 @@ add_qtc_plugin(Docker
|
|||||||
docker_global.h
|
docker_global.h
|
||||||
dockerbuildstep.cpp dockerbuildstep.h
|
dockerbuildstep.cpp dockerbuildstep.h
|
||||||
dockerconstants.h
|
dockerconstants.h
|
||||||
dockerdevice.cpp
|
dockerdevice.cpp dockerdevice.h
|
||||||
dockerdevice.h
|
dockerplugin.cpp dockerplugin.h
|
||||||
dockerplugin.cpp
|
dockersettings.cpp dockersettings.h
|
||||||
dockerplugin.h
|
|
||||||
dockerrunconfiguration.cpp
|
|
||||||
dockerrunconfiguration.h
|
|
||||||
dockersettings.cpp
|
|
||||||
dockersettings.h
|
|
||||||
)
|
)
|
||||||
|
@@ -6,7 +6,6 @@ SOURCES += \
|
|||||||
dockerbuildstep.cpp \
|
dockerbuildstep.cpp \
|
||||||
dockerdevice.cpp \
|
dockerdevice.cpp \
|
||||||
dockerplugin.cpp \
|
dockerplugin.cpp \
|
||||||
dockerrunconfiguration.cpp \
|
|
||||||
dockersettings.cpp
|
dockersettings.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
@@ -15,5 +14,4 @@ HEADERS += \
|
|||||||
dockerconstants.h \
|
dockerconstants.h \
|
||||||
dockerdevice.h \
|
dockerdevice.h \
|
||||||
dockerplugin.h \
|
dockerplugin.h \
|
||||||
dockerrunconfiguration.h \
|
|
||||||
dockersettings.h
|
dockersettings.h
|
||||||
|
@@ -19,8 +19,6 @@ QtcPlugin {
|
|||||||
"dockerdevice.cpp",
|
"dockerdevice.cpp",
|
||||||
"dockerplugin.h",
|
"dockerplugin.h",
|
||||||
"dockerplugin.cpp",
|
"dockerplugin.cpp",
|
||||||
"dockerrunconfiguration.h",
|
|
||||||
"dockerrunconfiguration.cpp",
|
|
||||||
"dockersettings.h",
|
"dockersettings.h",
|
||||||
"dockersettings.cpp"
|
"dockersettings.cpp"
|
||||||
]
|
]
|
||||||
|
@@ -29,11 +29,9 @@
|
|||||||
|
|
||||||
#include "dockerbuildstep.h"
|
#include "dockerbuildstep.h"
|
||||||
#include "dockerdevice.h"
|
#include "dockerdevice.h"
|
||||||
#include "dockerrunconfiguration.h"
|
|
||||||
#include "dockersettings.h"
|
#include "dockersettings.h"
|
||||||
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/runcontrol.h>
|
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
@@ -49,13 +47,6 @@ public:
|
|||||||
// DockerOptionsPage optionsPage{&settings};
|
// DockerOptionsPage optionsPage{&settings};
|
||||||
|
|
||||||
DockerDeviceFactory deviceFactory;
|
DockerDeviceFactory deviceFactory;
|
||||||
// DockerContainerRunConfigurationFactory containerRunConfigFactory;
|
|
||||||
|
|
||||||
// RunWorkerFactory containerRunWorkerFactory{
|
|
||||||
// RunWorkerFactory::make<SimpleTargetRunner>(),
|
|
||||||
// {ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
|
||||||
// {containerRunConfigFactory.runConfigurationId()}
|
|
||||||
// };
|
|
||||||
|
|
||||||
// DockerBuildStepFactory buildStepFactory;
|
// DockerBuildStepFactory buildStepFactory;
|
||||||
Utils::optional<bool> daemonRunning;
|
Utils::optional<bool> daemonRunning;
|
||||||
|
@@ -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
|
|
@@ -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
|
|
Reference in New Issue
Block a user