2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2016-01-15 14:57:40 +01:00
|
|
|
** 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.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** 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.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "runconfiguration.h"
|
2010-01-07 18:17:24 +01:00
|
|
|
|
2011-08-18 13:46:52 +02:00
|
|
|
#include "abi.h"
|
2009-10-28 17:21:27 +01:00
|
|
|
#include "buildconfiguration.h"
|
2019-10-25 09:55:32 +02:00
|
|
|
#include "buildsystem.h"
|
2017-01-25 16:18:30 +01:00
|
|
|
#include "environmentaspect.h"
|
2012-09-03 18:31:44 +02:00
|
|
|
#include "kitinformation.h"
|
2019-08-02 12:00:39 +02:00
|
|
|
#include "kitinformation.h"
|
|
|
|
|
#include "project.h"
|
|
|
|
|
#include "projectexplorer.h"
|
2019-12-04 17:23:02 +01:00
|
|
|
#include "projectnodes.h"
|
2018-04-20 13:40:15 +02:00
|
|
|
#include "runconfigurationaspects.h"
|
2019-08-02 12:00:39 +02:00
|
|
|
#include "runcontrol.h"
|
2017-06-30 08:41:08 +02:00
|
|
|
#include "session.h"
|
2019-08-02 12:00:39 +02:00
|
|
|
#include "target.h"
|
|
|
|
|
#include "toolchain.h"
|
2017-03-10 09:05:52 +01:00
|
|
|
|
2017-01-05 12:49:45 +01:00
|
|
|
#include <utils/algorithm.h>
|
2011-01-17 13:52:14 +01:00
|
|
|
#include <utils/checkablemessagebox.h>
|
2018-03-20 13:09:16 +01:00
|
|
|
#include <utils/detailswidget.h>
|
2017-03-10 09:05:52 +01:00
|
|
|
#include <utils/outputformatter.h>
|
2017-02-27 17:25:58 +01:00
|
|
|
#include <utils/qtcassert.h>
|
2017-03-10 09:05:52 +01:00
|
|
|
#include <utils/utilsicons.h>
|
2011-01-17 13:52:14 +01:00
|
|
|
|
2013-03-26 11:32:14 +01:00
|
|
|
#include <coreplugin/icontext.h>
|
2017-08-18 08:49:16 +02:00
|
|
|
#include <coreplugin/icore.h>
|
2018-04-20 13:40:15 +02:00
|
|
|
#include <coreplugin/variablechooser.h>
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2017-03-10 09:05:52 +01:00
|
|
|
#include <QDir>
|
2018-04-06 17:23:06 +02:00
|
|
|
#include <QFormLayout>
|
2019-01-31 18:23:10 +01:00
|
|
|
#include <QHash>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QPushButton>
|
2017-03-10 09:05:52 +01:00
|
|
|
#include <QTimer>
|
2017-05-09 10:25:11 +02:00
|
|
|
#include <QLoggingCategory>
|
|
|
|
|
#include <QSettings>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2017-01-16 15:53:53 +01:00
|
|
|
using namespace Utils;
|
2017-03-29 14:08:44 +02:00
|
|
|
using namespace ProjectExplorer::Internal;
|
2011-07-06 10:25:18 +02:00
|
|
|
|
2017-01-16 15:53:53 +01:00
|
|
|
namespace ProjectExplorer {
|
2011-07-06 10:25:18 +02:00
|
|
|
|
2019-08-12 12:42:21 +02:00
|
|
|
const char BUILD_KEY[] = "ProjectExplorer.RunConfiguration.BuildKey";
|
|
|
|
|
|
2013-08-12 17:04:10 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// ISettingsAspect
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2019-08-28 08:55:28 +02:00
|
|
|
ISettingsAspect::ISettingsAspect() = default;
|
2018-04-26 11:04:03 +02:00
|
|
|
|
2018-09-10 15:39:27 +02:00
|
|
|
QWidget *ISettingsAspect::createConfigWidget() const
|
2018-04-26 11:04:03 +02:00
|
|
|
{
|
2018-09-10 15:39:27 +02:00
|
|
|
QTC_ASSERT(m_configWidgetCreator, return nullptr);
|
|
|
|
|
return m_configWidgetCreator();
|
2013-08-12 17:04:10 +02:00
|
|
|
}
|
|
|
|
|
|
2019-08-28 08:55:28 +02:00
|
|
|
void ISettingsAspect::setConfigWidgetCreator(const ConfigWidgetCreator &configWidgetCreator)
|
|
|
|
|
{
|
|
|
|
|
m_configWidgetCreator = configWidgetCreator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2013-08-12 17:04:10 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// IRunConfigurationAspect
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2018-09-13 15:48:16 +02:00
|
|
|
GlobalOrProjectAspect::GlobalOrProjectAspect() = default;
|
2013-08-12 17:04:10 +02:00
|
|
|
|
2018-09-13 15:48:16 +02:00
|
|
|
GlobalOrProjectAspect::~GlobalOrProjectAspect()
|
2013-08-12 17:04:10 +02:00
|
|
|
{
|
|
|
|
|
delete m_projectSettings;
|
|
|
|
|
}
|
2012-02-17 19:05:11 +01:00
|
|
|
|
2018-09-13 15:48:16 +02:00
|
|
|
void GlobalOrProjectAspect::setProjectSettings(ISettingsAspect *settings)
|
2013-08-12 17:04:10 +02:00
|
|
|
{
|
|
|
|
|
m_projectSettings = settings;
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-13 15:48:16 +02:00
|
|
|
void GlobalOrProjectAspect::setGlobalSettings(ISettingsAspect *settings)
|
2013-08-12 17:04:10 +02:00
|
|
|
{
|
|
|
|
|
m_globalSettings = settings;
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-13 15:48:16 +02:00
|
|
|
void GlobalOrProjectAspect::setUsingGlobalSettings(bool value)
|
2013-08-12 17:04:10 +02:00
|
|
|
{
|
|
|
|
|
m_useGlobalSettings = value;
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-13 15:48:16 +02:00
|
|
|
ISettingsAspect *GlobalOrProjectAspect::currentSettings() const
|
2013-08-12 17:04:10 +02:00
|
|
|
{
|
|
|
|
|
return m_useGlobalSettings ? m_globalSettings : m_projectSettings;
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-13 15:48:16 +02:00
|
|
|
void GlobalOrProjectAspect::fromMap(const QVariantMap &map)
|
2013-08-12 17:04:10 +02:00
|
|
|
{
|
2017-11-09 16:06:19 +01:00
|
|
|
if (m_projectSettings)
|
|
|
|
|
m_projectSettings->fromMap(map);
|
2013-08-12 17:04:10 +02:00
|
|
|
m_useGlobalSettings = map.value(m_id.toString() + QLatin1String(".UseGlobalSettings"), true).toBool();
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-13 15:48:16 +02:00
|
|
|
void GlobalOrProjectAspect::toMap(QVariantMap &map) const
|
2013-08-12 17:04:10 +02:00
|
|
|
{
|
2017-11-09 16:06:19 +01:00
|
|
|
if (m_projectSettings)
|
|
|
|
|
m_projectSettings->toMap(map);
|
2013-08-12 17:04:10 +02:00
|
|
|
map.insert(m_id.toString() + QLatin1String(".UseGlobalSettings"), m_useGlobalSettings);
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-13 15:48:16 +02:00
|
|
|
void GlobalOrProjectAspect::resetProjectToGlobalSettings()
|
2013-08-12 17:04:10 +02:00
|
|
|
{
|
|
|
|
|
QTC_ASSERT(m_globalSettings, return);
|
|
|
|
|
QVariantMap map;
|
|
|
|
|
m_globalSettings->toMap(map);
|
2017-11-09 16:06:19 +01:00
|
|
|
if (m_projectSettings)
|
|
|
|
|
m_projectSettings->fromMap(map);
|
2013-08-12 17:04:10 +02:00
|
|
|
}
|
|
|
|
|
|
2013-03-27 17:17:24 +01:00
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
|
|
|
|
\class ProjectExplorer::RunConfiguration
|
2013-06-05 14:29:24 +02:00
|
|
|
\brief The RunConfiguration class is the base class for a run configuration.
|
2011-04-14 12:58:14 +02:00
|
|
|
|
2013-06-05 14:29:24 +02:00
|
|
|
A run configuration specifies how a target should be run, while a runner
|
|
|
|
|
does the actual running.
|
|
|
|
|
|
2017-07-17 14:34:05 +02:00
|
|
|
The target owns the RunConfiguraitons and a RunControl will need to copy all
|
|
|
|
|
necessary data as the RunControl may continue to exist after the RunConfiguration
|
|
|
|
|
has been destroyed.
|
|
|
|
|
|
2019-08-14 15:28:03 +02:00
|
|
|
A RunConfiguration disables itself if the project has no parsing
|
2017-07-17 14:34:05 +02:00
|
|
|
data available. The disabledReason() method can be used to get a user-facing string
|
|
|
|
|
describing why the RunConfiguration considers itself unfit for use.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
2017-07-14 09:36:09 +02:00
|
|
|
static std::vector<RunConfiguration::AspectFactory> theAspectFactories;
|
|
|
|
|
|
ProjectExplorer/all: Re-organize BuildSteps/{Deploy,Build}Config setup
This follow the rough pattern of recent *RunConfigurationFactory changes
for build and deploy configurations.
- Collapse the two lines of constructors similar to what
890c1906e6fb2ec did for RunConfigurations
* Deploy* was purely mechanical
* Build* ctors are split in connects() in the ctor body
to create "empty shell for clone" etc
and build step additions in initialize() functions which
are only used in the create() case.
-- Allows to collapse the shared 'ctor()' functions, too.
- Move FooBuildConfigurationFactory::create() implementations
to FooBuildConfiguration() constructor. That was a strange
and unneeded ping-pong between factories and objects, and
furthermore allows one level less of indirection (and for a
later, left out here, some reduction of the
FooBuildConfiguration interfaces that were only used to
accommodate the *Factory::create() functions.
- Most {Build,Deploy}Configuration{,Factory} classes had a canHandle(),
but there wasn't one in the base classses. Have one there.
- Most canHandle() functions were checking simple restrictions on
e.g. project or target types, specify those by setters in the
constructors instead and check them in the base canHandle()
- clone() is generally replaced by a creation of a "shell object"
and a fromMap(source->toMap()), implemented in the base, there
are two cases left for Android and Qbs that needed(?) some extra
polish
- generally use canHandle() in base implementation, instead
of doing that in all Derived::canFoo()
- as a result, canCreate/create/canClone/clone reimplementations
are not needed anymore, keep the base implementation for
now (could be inlined into their only users later), but
de-virtualize them.
- Combine Ios{Preset,DSym}BuildStepFactory. There was only one
'dsym' build step they could create.
- Split the 'mangled' id into the ProjectConfiguration subtype
specific constant identifier, and a QString extraId() bit.
Only maintain the mangled id in saved settings.
- Make ProjectConfiguration::m_id a constant member, adapt
all constructors of derived classe.
Not done in this patch:
- Finish possible cosmetic changes on top
- Add a way to specify restrictions to supported Qt versions
(used in Android/Ios), as the base implementation does not
depend on the qtsupport plugin
- Combine the QList<X> availableFoo() + createFoo(X) function
pairs to somthing like a direct
QList<struct { X; std::function<X()>; }> fooCreators()
to avoid e.g. the baseId.withSuffix() <-> id.suffixAfter(base)
pingpong
- Remove the *Factories from the global object pool
- Do something about priority(). Falling back to plain
qmake in android+qmake setup is not helpful.
Change-Id: I2be7d88d554c5aa8b7db8edf5b93278e1ae0112a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-11-29 12:28:40 +01:00
|
|
|
RunConfiguration::RunConfiguration(Target *target, Core::Id id)
|
2019-04-03 18:43:28 +02:00
|
|
|
: ProjectConfiguration(target, id)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2019-07-26 16:08:13 +02:00
|
|
|
QTC_CHECK(target && target == this->target());
|
2019-12-04 09:19:50 +01:00
|
|
|
connect(target, &Target::parsingFinished, this, &RunConfiguration::enabledChanged);
|
2017-09-01 13:23:02 +02:00
|
|
|
|
2019-08-02 12:00:39 +02:00
|
|
|
connect(this, &RunConfiguration::enabledChanged, this, [this] {
|
|
|
|
|
if (isActive() && project() == SessionManager::startupProject())
|
|
|
|
|
emit ProjectExplorerPlugin::instance()->updateRunActions();
|
|
|
|
|
});
|
2017-09-01 13:23:02 +02:00
|
|
|
|
|
|
|
|
Utils::MacroExpander *expander = macroExpander();
|
|
|
|
|
expander->setDisplayName(tr("Run Settings"));
|
|
|
|
|
expander->setAccumulating(true);
|
|
|
|
|
expander->registerSubProvider([target] {
|
|
|
|
|
BuildConfiguration *bc = target->activeBuildConfiguration();
|
|
|
|
|
return bc ? bc->macroExpander() : target->macroExpander();
|
|
|
|
|
});
|
|
|
|
|
expander->registerPrefix("CurrentRun:Env", tr("Variables in the current run environment"),
|
|
|
|
|
[this](const QString &var) {
|
2018-09-07 13:29:45 +02:00
|
|
|
const auto envAspect = aspect<EnvironmentAspect>();
|
2019-08-19 14:29:14 +02:00
|
|
|
return envAspect ? envAspect->environment().expandedValueForKey(var) : QString();
|
2017-09-01 13:23:02 +02:00
|
|
|
});
|
2019-05-14 17:19:04 +02:00
|
|
|
|
|
|
|
|
expander->registerVariable(Constants::VAR_CURRENTRUN_WORKINGDIR,
|
|
|
|
|
tr("The currently active run configuration's working directory"),
|
|
|
|
|
[this, expander] {
|
|
|
|
|
const auto wdAspect = aspect<WorkingDirectoryAspect>();
|
|
|
|
|
return wdAspect ? wdAspect->workingDirectory(expander).toString() : QString();
|
|
|
|
|
});
|
|
|
|
|
|
2017-09-01 13:23:02 +02:00
|
|
|
expander->registerVariable(Constants::VAR_CURRENTRUN_NAME,
|
|
|
|
|
QCoreApplication::translate("ProjectExplorer", "The currently active run configuration's name."),
|
|
|
|
|
[this] { return displayName(); }, false);
|
2017-11-09 16:06:19 +01:00
|
|
|
|
2019-06-11 14:39:39 +02:00
|
|
|
m_commandLineGetter = [this] {
|
|
|
|
|
FilePath executable;
|
2019-05-23 18:10:34 +02:00
|
|
|
if (const auto executableAspect = aspect<ExecutableAspect>())
|
2019-06-11 14:39:39 +02:00
|
|
|
executable = executableAspect->executable();
|
|
|
|
|
QString arguments;
|
|
|
|
|
if (const auto argumentsAspect = aspect<ArgumentsAspect>())
|
|
|
|
|
arguments = argumentsAspect->arguments(macroExpander());
|
|
|
|
|
return CommandLine{executable, arguments, CommandLine::Raw};
|
2019-05-23 18:10:34 +02:00
|
|
|
};
|
2017-09-01 13:23:02 +02:00
|
|
|
}
|
|
|
|
|
|
2018-09-13 15:48:16 +02:00
|
|
|
RunConfiguration::~RunConfiguration() = default;
|
2017-09-01 13:23:02 +02:00
|
|
|
|
2016-05-02 16:04:45 +02:00
|
|
|
bool RunConfiguration::isActive() const
|
|
|
|
|
{
|
|
|
|
|
return target()->isActive() && target()->activeRunConfiguration() == this;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-25 09:55:32 +02:00
|
|
|
QString RunConfiguration::disabledReason() const
|
2019-04-03 18:43:28 +02:00
|
|
|
{
|
2019-10-25 09:55:32 +02:00
|
|
|
BuildSystem *bs = activeBuildSystem();
|
|
|
|
|
return bs ? bs->disabledReason(m_buildKey) : tr("No build system active");
|
2019-04-03 18:43:28 +02:00
|
|
|
}
|
|
|
|
|
|
2019-10-25 09:55:32 +02:00
|
|
|
bool RunConfiguration::isEnabled() const
|
2017-07-17 14:34:05 +02:00
|
|
|
{
|
2019-10-25 09:55:32 +02:00
|
|
|
BuildSystem *bs = activeBuildSystem();
|
|
|
|
|
return bs && bs->hasParsingData();
|
2017-07-17 14:34:05 +02:00
|
|
|
}
|
|
|
|
|
|
2018-04-20 13:40:15 +02:00
|
|
|
QWidget *RunConfiguration::createConfigurationWidget()
|
|
|
|
|
{
|
|
|
|
|
auto widget = new QWidget;
|
2019-10-15 17:20:51 +02:00
|
|
|
{
|
|
|
|
|
LayoutBuilder builder(widget);
|
|
|
|
|
for (ProjectConfigurationAspect *aspect : m_aspects) {
|
2019-11-07 12:22:29 +01:00
|
|
|
if (aspect->isVisible())
|
|
|
|
|
aspect->addToLayout(builder.startNewRow());
|
2019-10-15 17:20:51 +02:00
|
|
|
}
|
2018-09-04 08:38:44 +02:00
|
|
|
}
|
2018-04-20 13:40:15 +02:00
|
|
|
|
|
|
|
|
Core::VariableChooser::addSupportForChildWidgets(widget, macroExpander());
|
|
|
|
|
|
2018-09-26 09:17:55 +02:00
|
|
|
auto detailsWidget = new Utils::DetailsWidget;
|
|
|
|
|
detailsWidget->setState(DetailsWidget::NoSummary);
|
|
|
|
|
detailsWidget->setWidget(widget);
|
|
|
|
|
return detailsWidget;
|
2018-04-20 13:40:15 +02:00
|
|
|
}
|
|
|
|
|
|
2017-07-14 09:36:09 +02:00
|
|
|
void RunConfiguration::addAspectFactory(const AspectFactory &aspectFactory)
|
2011-02-28 12:23:12 +01:00
|
|
|
{
|
2017-07-14 09:36:09 +02:00
|
|
|
theAspectFactories.push_back(aspectFactory);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2019-08-27 16:44:42 +02:00
|
|
|
QMap<Core::Id, QVariantMap> RunConfiguration::aspectData() const
|
|
|
|
|
{
|
|
|
|
|
QMap<Core::Id, QVariantMap> data;
|
|
|
|
|
for (ProjectConfigurationAspect *aspect : m_aspects)
|
|
|
|
|
aspect->toMap(data[aspect->id()]);
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-19 13:41:02 +01:00
|
|
|
BuildConfiguration *RunConfiguration::activeBuildConfiguration() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-02-08 15:50:06 +01:00
|
|
|
return target()->activeBuildConfiguration();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2019-10-25 09:55:32 +02:00
|
|
|
BuildSystem *RunConfiguration::activeBuildSystem() const
|
|
|
|
|
{
|
|
|
|
|
return target()->buildSystem();
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-25 11:10:11 +01:00
|
|
|
void RunConfiguration::setUpdater(const Updater &updater)
|
|
|
|
|
{
|
|
|
|
|
m_updater = updater;
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-05 16:28:52 +01:00
|
|
|
Task RunConfiguration::createConfigurationIssue(const QString &description) const
|
|
|
|
|
{
|
|
|
|
|
return {Task::Error, description, FilePath(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM};
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-01 11:34:34 +02:00
|
|
|
QVariantMap RunConfiguration::toMap() const
|
|
|
|
|
{
|
2012-02-22 11:56:08 +01:00
|
|
|
QVariantMap map = ProjectConfiguration::toMap();
|
|
|
|
|
|
2019-08-12 12:42:21 +02:00
|
|
|
map.insert(BUILD_KEY, m_buildKey);
|
|
|
|
|
|
2018-04-09 12:33:10 +02:00
|
|
|
// FIXME: Remove this id mangling, e.g. by using a separate entry for the build key.
|
|
|
|
|
if (!m_buildKey.isEmpty()) {
|
|
|
|
|
const Core::Id mangled = id().withSuffix(m_buildKey);
|
|
|
|
|
map.insert(settingsIdKey(), mangled.toSetting());
|
|
|
|
|
}
|
2011-02-28 12:23:12 +01:00
|
|
|
|
2010-09-01 11:34:34 +02:00
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-11 14:39:39 +02:00
|
|
|
void RunConfiguration::setCommandLineGetter(const CommandLineGetter &cmdGetter)
|
2019-05-23 18:10:34 +02:00
|
|
|
{
|
2019-06-11 14:39:39 +02:00
|
|
|
m_commandLineGetter = cmdGetter;
|
2019-05-23 18:10:34 +02:00
|
|
|
}
|
|
|
|
|
|
2019-06-11 14:39:39 +02:00
|
|
|
CommandLine RunConfiguration::commandLine() const
|
2019-05-23 18:10:34 +02:00
|
|
|
{
|
2019-06-11 14:39:39 +02:00
|
|
|
return m_commandLineGetter();
|
2019-05-23 18:10:34 +02:00
|
|
|
}
|
|
|
|
|
|
2019-11-25 11:10:11 +01:00
|
|
|
void RunConfiguration::update()
|
|
|
|
|
{
|
2019-12-04 09:19:50 +01:00
|
|
|
if (m_updater)
|
|
|
|
|
m_updater();
|
|
|
|
|
|
|
|
|
|
emit enabledChanged();
|
2019-11-25 11:10:11 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-26 08:37:56 +02:00
|
|
|
BuildTargetInfo RunConfiguration::buildTargetInfo() const
|
|
|
|
|
{
|
2019-10-25 09:55:32 +02:00
|
|
|
BuildSystem *bs = target()->buildSystem();
|
|
|
|
|
QTC_ASSERT(bs, return {});
|
|
|
|
|
return bs->buildTarget(m_buildKey);
|
2018-04-26 08:37:56 +02:00
|
|
|
}
|
|
|
|
|
|
2019-12-04 17:23:02 +01:00
|
|
|
ProjectNode *RunConfiguration::productNode() const
|
|
|
|
|
{
|
|
|
|
|
return project()->rootProjectNode()->findProjectNode([this](const ProjectNode *candidate) {
|
|
|
|
|
return candidate->buildKey() == buildKey();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-01 11:34:34 +02:00
|
|
|
bool RunConfiguration::fromMap(const QVariantMap &map)
|
|
|
|
|
{
|
2018-04-09 12:33:10 +02:00
|
|
|
if (!ProjectConfiguration::fromMap(map))
|
|
|
|
|
return false;
|
|
|
|
|
|
2019-08-12 12:42:21 +02:00
|
|
|
m_buildKey = map.value(BUILD_KEY).toString();
|
|
|
|
|
|
|
|
|
|
if (m_buildKey.isEmpty()) {
|
|
|
|
|
const Core::Id mangledId = Core::Id::fromSetting(map.value(settingsIdKey()));
|
|
|
|
|
m_buildKey = mangledId.suffixAfter(id());
|
2019-10-17 13:02:43 +02:00
|
|
|
|
|
|
|
|
// Hack for cmake projects 4.10 -> 4.11.
|
|
|
|
|
const QString magicSeparator = "///::///";
|
|
|
|
|
const int magicIndex = m_buildKey.indexOf(magicSeparator);
|
|
|
|
|
if (magicIndex != -1)
|
|
|
|
|
m_buildKey = m_buildKey.mid(magicIndex + magicSeparator.length());
|
2019-08-12 12:42:21 +02:00
|
|
|
}
|
2018-04-09 12:33:10 +02:00
|
|
|
|
|
|
|
|
return true;
|
2010-09-01 11:34:34 +02:00
|
|
|
}
|
|
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
|
|
|
|
\class ProjectExplorer::IRunConfigurationAspect
|
|
|
|
|
|
2013-06-05 14:29:24 +02:00
|
|
|
\brief The IRunConfigurationAspect class provides an additional
|
|
|
|
|
configuration aspect.
|
2011-04-14 12:58:14 +02:00
|
|
|
|
2013-09-10 17:16:10 +02:00
|
|
|
Aspects are a mechanism to add RunControl-specific options to a run
|
|
|
|
|
configuration without subclassing the run configuration for every addition.
|
|
|
|
|
This prevents a combinatorial explosion of subclasses and eliminates
|
|
|
|
|
the need to add all options to the base class.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
2016-01-20 14:50:34 +01:00
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
|
|
|
|
|
\class ProjectExplorer::Runnable
|
|
|
|
|
|
|
|
|
|
\brief The ProjectExplorer::Runnable class wraps information needed
|
|
|
|
|
to execute a process on a target device.
|
|
|
|
|
|
|
|
|
|
A target specific \l RunConfiguration implementation can specify
|
|
|
|
|
what information it considers necessary to execute a process
|
2017-07-18 10:39:03 +02:00
|
|
|
on the target. Target specific) \n RunWorker implementation
|
2016-01-20 14:50:34 +01:00
|
|
|
can use that information either unmodified or tweak it or ignore
|
|
|
|
|
it when setting up a RunControl.
|
|
|
|
|
|
|
|
|
|
From Qt Creator's core perspective a Runnable object is opaque.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
|
|
|
|
|
\brief Returns a \l Runnable described by this RunConfiguration.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
Runnable RunConfiguration::runnable() const
|
|
|
|
|
{
|
2018-05-16 15:42:03 +02:00
|
|
|
Runnable r;
|
2019-06-11 14:39:39 +02:00
|
|
|
r.setCommandLine(commandLine());
|
2018-09-07 13:29:45 +02:00
|
|
|
if (auto workingDirectoryAspect = aspect<WorkingDirectoryAspect>())
|
|
|
|
|
r.workingDirectory = workingDirectoryAspect->workingDirectory(macroExpander()).toString();
|
|
|
|
|
if (auto environmentAspect = aspect<EnvironmentAspect>())
|
|
|
|
|
r.environment = environmentAspect->environment();
|
2018-04-20 13:40:15 +02:00
|
|
|
return r;
|
2016-01-20 14:50:34 +01:00
|
|
|
}
|
|
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
|
|
|
|
\class ProjectExplorer::IRunConfigurationFactory
|
|
|
|
|
|
2013-06-05 14:29:24 +02:00
|
|
|
\brief The IRunConfigurationFactory class restores run configurations from
|
|
|
|
|
settings.
|
2011-04-14 12:58:14 +02:00
|
|
|
|
|
|
|
|
The run configuration factory is used for restoring run configurations from
|
2013-09-10 17:16:10 +02:00
|
|
|
settings and for creating new run configurations in the \gui {Run Settings}
|
|
|
|
|
dialog.
|
|
|
|
|
To restore run configurations, use the
|
|
|
|
|
\c {bool canRestore(Target *parent, const QString &id)}
|
|
|
|
|
and \c {RunConfiguration* create(Target *parent, const QString &id)}
|
|
|
|
|
functions.
|
|
|
|
|
|
|
|
|
|
To generate a list of creatable run configurations, use the
|
|
|
|
|
\c {QStringList availableCreationIds(Target *parent)} and
|
|
|
|
|
\c {QString displayNameForType(const QString&)} functions. To create a
|
|
|
|
|
run configuration, use \c create().
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn QStringList ProjectExplorer::IRunConfigurationFactory::availableCreationIds(Target *parent) const
|
|
|
|
|
|
2013-09-10 17:16:10 +02:00
|
|
|
Shows the list of possible additions to a target. Returns a list of types.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
2014-07-01 11:08:26 +02:00
|
|
|
\fn QString ProjectExplorer::IRunConfigurationFactory::displayNameForId(Core::Id id) const
|
2013-09-10 17:16:10 +02:00
|
|
|
Translates the types to names to display to the user.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
2018-03-06 17:14:43 +01:00
|
|
|
static QList<RunConfigurationFactory *> g_runConfigurationFactories;
|
2017-12-08 17:20:48 +01:00
|
|
|
|
2018-03-06 17:14:43 +01:00
|
|
|
RunConfigurationFactory::RunConfigurationFactory()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2017-12-08 17:20:48 +01:00
|
|
|
g_runConfigurationFactories.append(this);
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-06 17:14:43 +01:00
|
|
|
RunConfigurationFactory::~RunConfigurationFactory()
|
2017-12-08 17:20:48 +01:00
|
|
|
{
|
|
|
|
|
g_runConfigurationFactories.removeOne(this);
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-15 10:32:56 +01:00
|
|
|
QString RunConfigurationFactory::decoratedTargetName(const QString &targetName, Target *target)
|
2018-02-14 10:25:47 +01:00
|
|
|
{
|
2018-02-15 16:52:50 +01:00
|
|
|
QString displayName;
|
|
|
|
|
if (!targetName.isEmpty())
|
|
|
|
|
displayName = QFileInfo(targetName).completeBaseName();
|
2019-02-06 12:50:51 +01:00
|
|
|
Core::Id devType = DeviceTypeKitAspect::deviceTypeId(target->kit());
|
2018-02-14 10:25:47 +01:00
|
|
|
if (devType != Constants::DESKTOP_DEVICE_TYPE) {
|
2019-02-06 12:50:51 +01:00
|
|
|
if (IDevice::ConstPtr dev = DeviceKitAspect::device(target->kit())) {
|
2018-02-15 16:52:50 +01:00
|
|
|
if (displayName.isEmpty()) {
|
|
|
|
|
//: Shown in Run configuration if no executable is given, %1 is device name
|
2018-04-06 14:13:07 +02:00
|
|
|
displayName = RunConfiguration::tr("Run on %1").arg(dev->displayName());
|
2018-02-15 16:52:50 +01:00
|
|
|
} else {
|
|
|
|
|
//: Shown in Run configuration, Add menu: "name of runnable (on device name)"
|
2018-04-06 14:13:07 +02:00
|
|
|
displayName = RunConfiguration::tr("%1 (on %2)").arg(displayName, dev->displayName());
|
2018-02-15 16:52:50 +01:00
|
|
|
}
|
|
|
|
|
}
|
2018-02-14 10:25:47 +01:00
|
|
|
}
|
|
|
|
|
return displayName;
|
|
|
|
|
}
|
|
|
|
|
|
ProjectExplorer/all: Re-organize BuildSteps/{Deploy,Build}Config setup
This follow the rough pattern of recent *RunConfigurationFactory changes
for build and deploy configurations.
- Collapse the two lines of constructors similar to what
890c1906e6fb2ec did for RunConfigurations
* Deploy* was purely mechanical
* Build* ctors are split in connects() in the ctor body
to create "empty shell for clone" etc
and build step additions in initialize() functions which
are only used in the create() case.
-- Allows to collapse the shared 'ctor()' functions, too.
- Move FooBuildConfigurationFactory::create() implementations
to FooBuildConfiguration() constructor. That was a strange
and unneeded ping-pong between factories and objects, and
furthermore allows one level less of indirection (and for a
later, left out here, some reduction of the
FooBuildConfiguration interfaces that were only used to
accommodate the *Factory::create() functions.
- Most {Build,Deploy}Configuration{,Factory} classes had a canHandle(),
but there wasn't one in the base classses. Have one there.
- Most canHandle() functions were checking simple restrictions on
e.g. project or target types, specify those by setters in the
constructors instead and check them in the base canHandle()
- clone() is generally replaced by a creation of a "shell object"
and a fromMap(source->toMap()), implemented in the base, there
are two cases left for Android and Qbs that needed(?) some extra
polish
- generally use canHandle() in base implementation, instead
of doing that in all Derived::canFoo()
- as a result, canCreate/create/canClone/clone reimplementations
are not needed anymore, keep the base implementation for
now (could be inlined into their only users later), but
de-virtualize them.
- Combine Ios{Preset,DSym}BuildStepFactory. There was only one
'dsym' build step they could create.
- Split the 'mangled' id into the ProjectConfiguration subtype
specific constant identifier, and a QString extraId() bit.
Only maintain the mangled id in saved settings.
- Make ProjectConfiguration::m_id a constant member, adapt
all constructors of derived classe.
Not done in this patch:
- Finish possible cosmetic changes on top
- Add a way to specify restrictions to supported Qt versions
(used in Android/Ios), as the base implementation does not
depend on the qtsupport plugin
- Combine the QList<X> availableFoo() + createFoo(X) function
pairs to somthing like a direct
QList<struct { X; std::function<X()>; }> fooCreators()
to avoid e.g. the baseId.withSuffix() <-> id.suffixAfter(base)
pingpong
- Remove the *Factories from the global object pool
- Do something about priority(). Falling back to plain
qmake in android+qmake setup is not helpful.
Change-Id: I2be7d88d554c5aa8b7db8edf5b93278e1ae0112a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-11-29 12:28:40 +01:00
|
|
|
QList<RunConfigurationCreationInfo>
|
2018-03-06 17:14:43 +01:00
|
|
|
RunConfigurationFactory::availableCreators(Target *parent) const
|
2017-11-20 11:56:19 +01:00
|
|
|
{
|
2019-05-03 17:26:49 +02:00
|
|
|
const QList<BuildTargetInfo> buildTargets = parent->applicationTargets();
|
2018-02-21 12:30:09 +01:00
|
|
|
const bool hasAnyQtcRunnable = Utils::anyOf(buildTargets,
|
|
|
|
|
Utils::equal(&BuildTargetInfo::isQtcRunnable, true));
|
|
|
|
|
return Utils::transform(buildTargets, [&](const BuildTargetInfo &ti) {
|
2018-03-07 09:32:04 +01:00
|
|
|
QString displayName = ti.displayName;
|
|
|
|
|
if (displayName.isEmpty())
|
2018-04-09 12:33:10 +02:00
|
|
|
displayName = decoratedTargetName(ti.buildKey, parent);
|
2018-03-21 09:44:33 +01:00
|
|
|
else if (m_decorateDisplayNames)
|
|
|
|
|
displayName = decoratedTargetName(displayName, parent);
|
2018-05-03 17:22:13 +02:00
|
|
|
RunConfigurationCreationInfo rci;
|
|
|
|
|
rci.factory = this;
|
|
|
|
|
rci.id = m_runConfigBaseId;
|
|
|
|
|
rci.buildKey = ti.buildKey;
|
2019-02-19 12:56:28 +01:00
|
|
|
rci.projectFilePath = ti.projectFilePath;
|
2018-05-03 17:22:13 +02:00
|
|
|
rci.displayName = displayName;
|
2019-01-31 18:23:10 +01:00
|
|
|
rci.displayNameUniquifier = ti.displayNameUniquifier;
|
2018-02-21 12:30:09 +01:00
|
|
|
rci.creationMode = ti.isQtcRunnable || !hasAnyQtcRunnable
|
|
|
|
|
? RunConfigurationCreationInfo::AlwaysCreate
|
|
|
|
|
: RunConfigurationCreationInfo::ManualCreationOnly;
|
|
|
|
|
rci.useTerminal = ti.usesTerminal;
|
|
|
|
|
rci.buildKey = ti.buildKey;
|
|
|
|
|
return rci;
|
2018-01-19 15:02:02 +01:00
|
|
|
});
|
2017-11-20 11:56:19 +01:00
|
|
|
}
|
|
|
|
|
|
2017-11-17 08:24:47 +01:00
|
|
|
/*!
|
2018-03-19 13:18:27 +01:00
|
|
|
Adds a list of device types for which this RunConfigurationFactory
|
|
|
|
|
can create RunConfigurations.
|
2017-11-17 08:24:47 +01:00
|
|
|
|
2018-03-19 13:18:27 +01:00
|
|
|
If this function is never called for a RunConfiguarionFactory,
|
|
|
|
|
the factory will create RunConfigurations for all device types.
|
2017-11-17 08:24:47 +01:00
|
|
|
*/
|
|
|
|
|
|
2018-03-06 17:14:43 +01:00
|
|
|
void RunConfigurationFactory::addSupportedTargetDeviceType(Core::Id id)
|
2018-02-22 08:36:45 +01:00
|
|
|
{
|
|
|
|
|
m_supportedTargetDeviceTypes.append(id);
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-21 09:44:33 +01:00
|
|
|
void RunConfigurationFactory::setDecorateDisplayNames(bool on)
|
|
|
|
|
{
|
|
|
|
|
m_decorateDisplayNames = on;
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-06 17:14:43 +01:00
|
|
|
void RunConfigurationFactory::addSupportedProjectType(Core::Id id)
|
2017-12-08 14:50:57 +01:00
|
|
|
{
|
|
|
|
|
m_supportedProjectTypes.append(id);
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-06 17:14:43 +01:00
|
|
|
bool RunConfigurationFactory::canHandle(Target *target) const
|
2017-11-17 08:24:47 +01:00
|
|
|
{
|
2017-12-08 14:50:57 +01:00
|
|
|
const Project *project = target->project();
|
|
|
|
|
Kit *kit = target->kit();
|
2017-11-17 08:24:47 +01:00
|
|
|
|
2018-04-18 13:39:05 +02:00
|
|
|
if (containsType(target->project()->projectIssues(kit), Task::TaskType::Error))
|
2017-11-17 08:24:47 +01:00
|
|
|
return false;
|
|
|
|
|
|
2017-12-08 14:50:57 +01:00
|
|
|
if (!m_supportedProjectTypes.isEmpty())
|
|
|
|
|
if (!m_supportedProjectTypes.contains(project->id()))
|
|
|
|
|
return false;
|
|
|
|
|
|
2017-11-17 08:24:47 +01:00
|
|
|
if (!m_supportedTargetDeviceTypes.isEmpty())
|
|
|
|
|
if (!m_supportedTargetDeviceTypes.contains(
|
2019-02-06 12:50:51 +01:00
|
|
|
DeviceTypeKitAspect::deviceTypeId(kit)))
|
2017-11-17 08:24:47 +01:00
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-01 17:49:33 +02:00
|
|
|
RunConfiguration *RunConfigurationFactory::create(Target *target) const
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(m_creator, return nullptr);
|
|
|
|
|
RunConfiguration *rc = m_creator(target);
|
|
|
|
|
QTC_ASSERT(rc, return nullptr);
|
|
|
|
|
|
|
|
|
|
// Add the universal aspects.
|
|
|
|
|
for (const RunConfiguration::AspectFactory &factory : theAspectFactories)
|
|
|
|
|
rc->m_aspects.append(factory(target));
|
|
|
|
|
|
|
|
|
|
rc->acquaintAspects();
|
|
|
|
|
return rc;
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-08 12:39:03 +01:00
|
|
|
RunConfiguration *RunConfigurationCreationInfo::create(Target *target) const
|
2017-11-20 11:56:19 +01:00
|
|
|
{
|
2018-03-08 12:39:03 +01:00
|
|
|
QTC_ASSERT(factory->canHandle(target), return nullptr);
|
|
|
|
|
QTC_ASSERT(id == factory->runConfigurationBaseId(), return nullptr);
|
2018-03-19 13:18:27 +01:00
|
|
|
|
2019-10-01 17:49:33 +02:00
|
|
|
RunConfiguration *rc = factory->create(target);
|
2013-03-26 16:39:41 +01:00
|
|
|
if (!rc)
|
2016-04-13 15:52:14 +02:00
|
|
|
return nullptr;
|
2013-03-26 16:39:41 +01:00
|
|
|
|
2018-04-09 12:33:10 +02:00
|
|
|
rc->m_buildKey = buildKey;
|
2018-03-08 12:39:03 +01:00
|
|
|
rc->doAdditionalSetup(*this);
|
2019-01-31 18:23:10 +01:00
|
|
|
rc->setDisplayName(displayName);
|
2018-03-06 16:48:51 +01:00
|
|
|
|
ProjectExplorer/all: Re-organize BuildSteps/{Deploy,Build}Config setup
This follow the rough pattern of recent *RunConfigurationFactory changes
for build and deploy configurations.
- Collapse the two lines of constructors similar to what
890c1906e6fb2ec did for RunConfigurations
* Deploy* was purely mechanical
* Build* ctors are split in connects() in the ctor body
to create "empty shell for clone" etc
and build step additions in initialize() functions which
are only used in the create() case.
-- Allows to collapse the shared 'ctor()' functions, too.
- Move FooBuildConfigurationFactory::create() implementations
to FooBuildConfiguration() constructor. That was a strange
and unneeded ping-pong between factories and objects, and
furthermore allows one level less of indirection (and for a
later, left out here, some reduction of the
FooBuildConfiguration interfaces that were only used to
accommodate the *Factory::create() functions.
- Most {Build,Deploy}Configuration{,Factory} classes had a canHandle(),
but there wasn't one in the base classses. Have one there.
- Most canHandle() functions were checking simple restrictions on
e.g. project or target types, specify those by setters in the
constructors instead and check them in the base canHandle()
- clone() is generally replaced by a creation of a "shell object"
and a fromMap(source->toMap()), implemented in the base, there
are two cases left for Android and Qbs that needed(?) some extra
polish
- generally use canHandle() in base implementation, instead
of doing that in all Derived::canFoo()
- as a result, canCreate/create/canClone/clone reimplementations
are not needed anymore, keep the base implementation for
now (could be inlined into their only users later), but
de-virtualize them.
- Combine Ios{Preset,DSym}BuildStepFactory. There was only one
'dsym' build step they could create.
- Split the 'mangled' id into the ProjectConfiguration subtype
specific constant identifier, and a QString extraId() bit.
Only maintain the mangled id in saved settings.
- Make ProjectConfiguration::m_id a constant member, adapt
all constructors of derived classe.
Not done in this patch:
- Finish possible cosmetic changes on top
- Add a way to specify restrictions to supported Qt versions
(used in Android/Ios), as the base implementation does not
depend on the qtsupport plugin
- Combine the QList<X> availableFoo() + createFoo(X) function
pairs to somthing like a direct
QList<struct { X; std::function<X()>; }> fooCreators()
to avoid e.g. the baseId.withSuffix() <-> id.suffixAfter(base)
pingpong
- Remove the *Factories from the global object pool
- Do something about priority(). Falling back to plain
qmake in android+qmake setup is not helpful.
Change-Id: I2be7d88d554c5aa8b7db8edf5b93278e1ae0112a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-11-29 12:28:40 +01:00
|
|
|
return rc;
|
2017-11-20 11:56:19 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-06 17:14:43 +01:00
|
|
|
RunConfiguration *RunConfigurationFactory::restore(Target *parent, const QVariantMap &map)
|
2018-02-27 09:08:01 +01:00
|
|
|
{
|
2018-03-06 17:14:43 +01:00
|
|
|
for (RunConfigurationFactory *factory : g_runConfigurationFactories) {
|
2018-02-27 09:08:01 +01:00
|
|
|
if (factory->canHandle(parent)) {
|
|
|
|
|
const Core::Id id = idFromMap(map);
|
|
|
|
|
if (id.name().startsWith(factory->m_runConfigBaseId.name())) {
|
2019-10-01 17:49:33 +02:00
|
|
|
RunConfiguration *rc = factory->create(parent);
|
2018-02-27 09:08:01 +01:00
|
|
|
if (rc->fromMap(map))
|
|
|
|
|
return rc;
|
|
|
|
|
delete rc;
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-03-28 14:53:12 +01:00
|
|
|
}
|
2018-02-27 09:08:01 +01:00
|
|
|
return nullptr;
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-06 17:14:43 +01:00
|
|
|
RunConfiguration *RunConfigurationFactory::clone(Target *parent, RunConfiguration *source)
|
2012-09-20 14:42:57 +02:00
|
|
|
{
|
2018-02-27 09:08:01 +01:00
|
|
|
return restore(parent, source->toMap());
|
2012-09-20 14:42:57 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-08 12:39:03 +01:00
|
|
|
const QList<RunConfigurationCreationInfo> RunConfigurationFactory::creatorsForTarget(Target *parent)
|
|
|
|
|
{
|
|
|
|
|
QList<RunConfigurationCreationInfo> items;
|
|
|
|
|
for (RunConfigurationFactory *factory : g_runConfigurationFactories) {
|
|
|
|
|
if (factory->canHandle(parent))
|
|
|
|
|
items.append(factory->availableCreators(parent));
|
|
|
|
|
}
|
2019-01-31 18:23:10 +01:00
|
|
|
QHash<QString, QList<RunConfigurationCreationInfo *>> itemsPerDisplayName;
|
|
|
|
|
for (RunConfigurationCreationInfo &item : items)
|
|
|
|
|
itemsPerDisplayName[item.displayName] << &item;
|
|
|
|
|
for (auto it = itemsPerDisplayName.cbegin(); it != itemsPerDisplayName.cend(); ++it) {
|
|
|
|
|
if (it.value().size() == 1)
|
|
|
|
|
continue;
|
|
|
|
|
for (RunConfigurationCreationInfo * const rci : it.value())
|
|
|
|
|
rci->displayName += rci->displayNameUniquifier;
|
|
|
|
|
}
|
2018-03-08 12:39:03 +01:00
|
|
|
return items;
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-19 15:02:02 +01:00
|
|
|
FixedRunConfigurationFactory::FixedRunConfigurationFactory(const QString &displayName,
|
2018-03-06 17:14:43 +01:00
|
|
|
bool addDeviceName) :
|
2018-02-14 10:25:47 +01:00
|
|
|
m_fixedBuildTarget(displayName),
|
|
|
|
|
m_decorateTargetName(addDeviceName)
|
2018-01-19 15:02:02 +01:00
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
QList<RunConfigurationCreationInfo>
|
2018-02-08 15:07:10 +01:00
|
|
|
FixedRunConfigurationFactory::availableCreators(Target *parent) const
|
2018-01-19 15:02:02 +01:00
|
|
|
{
|
2018-02-14 10:25:47 +01:00
|
|
|
QString displayName = m_decorateTargetName ? decoratedTargetName(m_fixedBuildTarget, parent)
|
|
|
|
|
: m_fixedBuildTarget;
|
2018-05-03 17:22:13 +02:00
|
|
|
RunConfigurationCreationInfo rci;
|
|
|
|
|
rci.factory = this;
|
|
|
|
|
rci.id = runConfigurationBaseId();
|
|
|
|
|
rci.displayName = displayName;
|
|
|
|
|
return {rci};
|
2018-01-19 15:02:02 +01:00
|
|
|
}
|
|
|
|
|
|
2015-06-29 10:36:29 +03:00
|
|
|
} // namespace ProjectExplorer
|