2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-02-08 15:50:06 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2010-02-08 15:50:06 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-02-08 15:50:06 +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.
|
2010-02-08 15:50:06 +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
|
|
|
****************************************************************************/
|
2010-02-08 15:50:06 +01:00
|
|
|
|
|
|
|
|
#include "target.h"
|
|
|
|
|
|
2018-08-29 13:00:04 +02:00
|
|
|
#include "buildconfiguration.h"
|
2013-07-22 15:53:57 +02:00
|
|
|
#include "buildinfo.h"
|
2018-08-29 13:00:04 +02:00
|
|
|
#include "buildmanager.h"
|
2012-08-20 12:41:52 +02:00
|
|
|
#include "buildtargetinfo.h"
|
2018-08-29 13:00:04 +02:00
|
|
|
#include "deployconfiguration.h"
|
2012-08-20 12:41:52 +02:00
|
|
|
#include "deploymentdata.h"
|
2018-08-29 13:00:04 +02:00
|
|
|
#include "devicesupport/devicemanager.h"
|
2012-09-03 18:31:44 +02:00
|
|
|
#include "kit.h"
|
|
|
|
|
#include "kitinformation.h"
|
|
|
|
|
#include "kitmanager.h"
|
2010-02-08 15:50:06 +01:00
|
|
|
#include "project.h"
|
2018-08-29 13:00:04 +02:00
|
|
|
#include "projectexplorer.h"
|
|
|
|
|
#include "projectexplorericons.h"
|
|
|
|
|
#include "projectexplorersettings.h"
|
2010-02-08 15:50:06 +01:00
|
|
|
#include "runconfiguration.h"
|
2015-07-28 18:29:52 +02:00
|
|
|
#include "session.h"
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2012-03-26 11:15:11 +02:00
|
|
|
#include <coreplugin/coreconstants.h>
|
2018-08-29 13:00:04 +02:00
|
|
|
|
2012-03-26 11:15:11 +02:00
|
|
|
#include <extensionsystem/pluginmanager.h>
|
2018-08-29 13:00:04 +02:00
|
|
|
|
2014-07-07 19:02:26 +02:00
|
|
|
#include <utils/algorithm.h>
|
2018-03-28 16:03:11 +02:00
|
|
|
#include <utils/qtcassert.h>
|
|
|
|
|
#include <utils/stringutils.h>
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
#include <QDebug>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QIcon>
|
2012-03-26 11:15:11 +02:00
|
|
|
#include <QPainter>
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2018-08-29 13:00:04 +02:00
|
|
|
#include <limits>
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
namespace {
|
2011-11-02 16:45:13 +01:00
|
|
|
const char ACTIVE_BC_KEY[] = "ProjectExplorer.Target.ActiveBuildConfiguration";
|
|
|
|
|
const char BC_KEY_PREFIX[] = "ProjectExplorer.Target.BuildConfiguration.";
|
|
|
|
|
const char BC_COUNT_KEY[] = "ProjectExplorer.Target.BuildConfigurationCount";
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2011-11-02 16:45:13 +01:00
|
|
|
const char ACTIVE_DC_KEY[] = "ProjectExplorer.Target.ActiveDeployConfiguration";
|
|
|
|
|
const char DC_KEY_PREFIX[] = "ProjectExplorer.Target.DeployConfiguration.";
|
|
|
|
|
const char DC_COUNT_KEY[] = "ProjectExplorer.Target.DeployConfigurationCount";
|
2010-07-16 14:00:41 +02:00
|
|
|
|
2011-11-02 16:45:13 +01:00
|
|
|
const char ACTIVE_RC_KEY[] = "ProjectExplorer.Target.ActiveRunConfiguration";
|
|
|
|
|
const char RC_KEY_PREFIX[] = "ProjectExplorer.Target.RunConfiguration.";
|
|
|
|
|
const char RC_COUNT_KEY[] = "ProjectExplorer.Target.RunConfigurationCount";
|
2013-04-19 16:27:31 +02:00
|
|
|
const char PLUGIN_SETTINGS_KEY[] = "ProjectExplorer.Target.PluginSettings";
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2017-03-02 14:24:25 +01:00
|
|
|
static QString formatDeviceInfo(const ProjectExplorer::IDevice::DeviceInfo &input)
|
|
|
|
|
{
|
|
|
|
|
const QStringList lines
|
|
|
|
|
= Utils::transform(input, [](const ProjectExplorer::IDevice::DeviceInfoItem &i) {
|
|
|
|
|
return QString::fromLatin1("<b>%1:</b> %2").arg(i.key, i.value);
|
|
|
|
|
});
|
|
|
|
|
return lines.join(QLatin1String("<br>"));
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
// Target
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
2010-09-21 09:17:37 +02:00
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
|
2011-04-21 15:01:48 +02:00
|
|
|
class TargetPrivate
|
|
|
|
|
{
|
2010-09-21 09:17:37 +02:00
|
|
|
public:
|
2015-11-16 17:08:04 +01:00
|
|
|
TargetPrivate(Kit *k);
|
2011-03-09 12:07:35 +01:00
|
|
|
|
2015-11-16 17:08:04 +01:00
|
|
|
bool m_isEnabled = true;
|
2010-09-21 09:17:37 +02:00
|
|
|
QIcon m_overlayIcon;
|
|
|
|
|
|
|
|
|
|
QList<BuildConfiguration *> m_buildConfigurations;
|
2018-05-24 12:57:00 +02:00
|
|
|
BuildConfiguration *m_activeBuildConfiguration = nullptr;
|
2010-09-21 09:17:37 +02:00
|
|
|
QList<DeployConfiguration *> m_deployConfigurations;
|
2018-05-24 12:57:00 +02:00
|
|
|
DeployConfiguration *m_activeDeployConfiguration = nullptr;
|
2010-09-21 09:17:37 +02:00
|
|
|
QList<RunConfiguration *> m_runConfigurations;
|
2018-05-24 12:57:00 +02:00
|
|
|
RunConfiguration* m_activeRunConfiguration = nullptr;
|
2012-08-20 12:41:52 +02:00
|
|
|
DeploymentData m_deploymentData;
|
|
|
|
|
BuildTargetInfoList m_appTargets;
|
2013-04-19 16:27:31 +02:00
|
|
|
QVariantMap m_pluginSettings;
|
2012-03-26 11:15:11 +02:00
|
|
|
|
2015-11-16 17:08:04 +01:00
|
|
|
Kit *const m_kit;
|
2010-09-21 09:17:37 +02:00
|
|
|
};
|
|
|
|
|
|
2015-11-16 17:08:04 +01:00
|
|
|
TargetPrivate::TargetPrivate(Kit *k) :
|
|
|
|
|
m_kit(k)
|
|
|
|
|
{ }
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2018-05-24 12:57:00 +02:00
|
|
|
Target::Target(Project *project, Kit *k, _constructor_tag) :
|
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
|
|
|
ProjectConfiguration(project, k->id()),
|
2018-07-16 13:59:39 +02:00
|
|
|
d(std::make_unique<TargetPrivate>(k))
|
2010-09-21 09:17:37 +02:00
|
|
|
{
|
2015-11-16 17:08:04 +01:00
|
|
|
QTC_CHECK(d->m_kit);
|
2015-11-16 16:57:54 +01:00
|
|
|
connect(DeviceManager::instance(), &DeviceManager::updated, this, &Target::updateDeviceState);
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-09-04 15:27:10 +02:00
|
|
|
setDisplayName(d->m_kit->displayName());
|
2017-03-02 14:24:25 +01:00
|
|
|
setToolTip(d->m_kit->toHtml());
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2015-11-16 16:57:54 +01:00
|
|
|
KitManager *km = KitManager::instance();
|
|
|
|
|
connect(km, &KitManager::kitUpdated, this, &Target::handleKitUpdates);
|
|
|
|
|
connect(km, &KitManager::kitRemoved, this, &Target::handleKitRemoval);
|
2014-11-05 14:01:26 +01:00
|
|
|
|
|
|
|
|
Utils::MacroExpander *expander = macroExpander();
|
2014-11-05 15:45:56 +01:00
|
|
|
expander->setDisplayName(tr("Target Settings"));
|
|
|
|
|
expander->setAccumulating(true);
|
2014-11-05 14:01:26 +01:00
|
|
|
|
|
|
|
|
expander->registerSubProvider([this] { return kit()->macroExpander(); });
|
|
|
|
|
|
2014-11-05 15:45:56 +01:00
|
|
|
expander->registerVariable("sourceDir", tr("Source directory"),
|
|
|
|
|
[project] { return project->projectDirectory().toUserOutput(); });
|
|
|
|
|
|
2014-11-05 14:01:26 +01:00
|
|
|
// Legacy support.
|
|
|
|
|
expander->registerVariable(Constants::VAR_CURRENTPROJECT_NAME,
|
|
|
|
|
QCoreApplication::translate("ProjectExplorer", "Name of current project"),
|
|
|
|
|
[project] { return project->displayName(); },
|
|
|
|
|
false);
|
|
|
|
|
|
2010-09-21 09:17:37 +02:00
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
Target::~Target()
|
|
|
|
|
{
|
2010-09-21 09:17:37 +02:00
|
|
|
qDeleteAll(d->m_buildConfigurations);
|
2012-04-24 15:49:09 +02:00
|
|
|
qDeleteAll(d->m_deployConfigurations);
|
2010-09-21 09:17:37 +02:00
|
|
|
qDeleteAll(d->m_runConfigurations);
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
|
|
|
|
|
2012-09-09 20:41:30 +03:00
|
|
|
void Target::handleKitUpdates(Kit *k)
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2012-09-09 20:41:30 +03:00
|
|
|
if (k != d->m_kit)
|
2012-04-24 15:49:09 +02:00
|
|
|
return;
|
|
|
|
|
|
2012-09-09 20:41:30 +03:00
|
|
|
setDisplayName(k->displayName());
|
2012-04-24 15:49:09 +02:00
|
|
|
updateDefaultDeployConfigurations();
|
2012-09-28 14:33:26 +02:00
|
|
|
updateDeviceState(); // in case the device changed...
|
2017-03-02 14:24:25 +01:00
|
|
|
setToolTip(k->toHtml());
|
|
|
|
|
|
|
|
|
|
emit iconChanged();
|
2012-09-03 18:31:44 +02:00
|
|
|
emit kitChanged();
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
2012-09-09 20:41:30 +03:00
|
|
|
void Target::handleKitRemoval(Kit *k)
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2012-09-09 20:41:30 +03:00
|
|
|
if (k != d->m_kit)
|
2012-04-24 15:49:09 +02:00
|
|
|
return;
|
|
|
|
|
project()->removeTarget(this);
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-02 16:04:45 +02:00
|
|
|
bool Target::isActive() const
|
|
|
|
|
{
|
|
|
|
|
return project()->activeTarget() == this;
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
Project *Target::project() const
|
|
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
return static_cast<Project *>(parent());
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
Kit *Target::kit() const
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2012-09-04 15:27:10 +02:00
|
|
|
return d->m_kit;
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
2016-05-02 15:47:06 +02:00
|
|
|
void Target::addBuildConfiguration(BuildConfiguration *bc)
|
2010-02-08 15:50:06 +01:00
|
|
|
{
|
2016-05-02 15:47:06 +02:00
|
|
|
QTC_ASSERT(bc && !d->m_buildConfigurations.contains(bc), return);
|
|
|
|
|
Q_ASSERT(bc->target() == this);
|
2010-02-08 15:50:06 +01:00
|
|
|
|
|
|
|
|
// Check that we don't have a configuration with the same displayName
|
2016-05-02 15:47:06 +02:00
|
|
|
QString configurationDisplayName = bc->displayName();
|
2014-07-07 19:02:26 +02:00
|
|
|
QStringList displayNames = Utils::transform(d->m_buildConfigurations, &BuildConfiguration::displayName);
|
2018-03-28 16:03:11 +02:00
|
|
|
configurationDisplayName = Utils::makeUniquelyNumbered(configurationDisplayName, displayNames);
|
2016-05-02 15:47:06 +02:00
|
|
|
if (configurationDisplayName != bc->displayName()) {
|
|
|
|
|
if (bc->usesDefaultDisplayName())
|
|
|
|
|
bc->setDefaultDisplayName(configurationDisplayName);
|
2012-04-24 15:49:09 +02:00
|
|
|
else
|
2016-05-02 15:47:06 +02:00
|
|
|
bc->setDisplayName(configurationDisplayName);
|
2011-05-20 12:52:59 +02:00
|
|
|
}
|
2010-02-08 15:50:06 +01:00
|
|
|
|
|
|
|
|
// add it
|
2016-05-02 15:47:06 +02:00
|
|
|
d->m_buildConfigurations.push_back(bc);
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2016-05-02 15:44:14 +02:00
|
|
|
emit addedProjectConfiguration(bc);
|
2016-05-02 15:47:06 +02:00
|
|
|
emit addedBuildConfiguration(bc);
|
2010-02-08 15:50:06 +01:00
|
|
|
|
|
|
|
|
if (!activeBuildConfiguration())
|
2016-05-02 15:47:06 +02:00
|
|
|
setActiveBuildConfiguration(bc);
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
|
|
|
|
|
2016-05-02 15:47:06 +02:00
|
|
|
bool Target::removeBuildConfiguration(BuildConfiguration *bc)
|
2010-02-08 15:50:06 +01:00
|
|
|
{
|
|
|
|
|
//todo: this might be error prone
|
2016-05-02 15:47:06 +02:00
|
|
|
if (!d->m_buildConfigurations.contains(bc))
|
2011-10-24 13:10:38 +00:00
|
|
|
return false;
|
|
|
|
|
|
2016-05-02 15:47:06 +02:00
|
|
|
if (BuildManager::isBuilding(bc))
|
2011-10-24 13:10:38 +00:00
|
|
|
return false;
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2016-05-02 15:47:06 +02:00
|
|
|
d->m_buildConfigurations.removeOne(bc);
|
2016-05-02 15:44:14 +02:00
|
|
|
emit aboutToRemoveProjectConfiguration(bc);
|
|
|
|
|
d->m_buildConfigurations.removeOne(bc);
|
2010-02-08 15:50:06 +01:00
|
|
|
|
|
|
|
|
|
2016-05-02 15:47:06 +02:00
|
|
|
if (activeBuildConfiguration() == bc) {
|
2010-09-21 09:17:37 +02:00
|
|
|
if (d->m_buildConfigurations.isEmpty())
|
2016-04-13 15:52:14 +02:00
|
|
|
SessionManager::setActiveBuildConfiguration(this, nullptr, SetActive::Cascade);
|
2010-02-08 15:50:06 +01:00
|
|
|
else
|
2015-07-28 18:29:52 +02:00
|
|
|
SessionManager::setActiveBuildConfiguration(this, d->m_buildConfigurations.at(0), SetActive::Cascade);
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
|
|
|
|
|
2016-05-02 15:44:14 +02:00
|
|
|
emit removedBuildConfiguration(bc);
|
|
|
|
|
emit removedProjectConfiguration(bc);
|
|
|
|
|
|
2016-05-02 15:47:06 +02:00
|
|
|
delete bc;
|
2011-10-24 13:10:38 +00:00
|
|
|
return true;
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QList<BuildConfiguration *> Target::buildConfigurations() const
|
|
|
|
|
{
|
2010-09-21 09:17:37 +02:00
|
|
|
return d->m_buildConfigurations;
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BuildConfiguration *Target::activeBuildConfiguration() const
|
|
|
|
|
{
|
2010-09-21 09:17:37 +02:00
|
|
|
return d->m_activeBuildConfiguration;
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
|
|
|
|
|
2016-05-02 15:44:14 +02:00
|
|
|
void Target::setActiveBuildConfiguration(BuildConfiguration *bc)
|
2010-02-08 15:50:06 +01:00
|
|
|
{
|
2016-05-02 15:44:14 +02:00
|
|
|
if ((!bc && d->m_buildConfigurations.isEmpty()) ||
|
|
|
|
|
(bc && d->m_buildConfigurations.contains(bc) &&
|
|
|
|
|
bc != d->m_activeBuildConfiguration)) {
|
|
|
|
|
d->m_activeBuildConfiguration = bc;
|
2017-08-01 14:19:25 +02:00
|
|
|
emit activeProjectConfigurationChanged(d->m_activeBuildConfiguration);
|
2010-09-21 09:17:37 +02:00
|
|
|
emit activeBuildConfigurationChanged(d->m_activeBuildConfiguration);
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
void Target::addDeployConfiguration(DeployConfiguration *dc)
|
|
|
|
|
{
|
2010-09-21 09:17:37 +02:00
|
|
|
QTC_ASSERT(dc && !d->m_deployConfigurations.contains(dc), return);
|
2010-07-16 14:00:41 +02:00
|
|
|
Q_ASSERT(dc->target() == this);
|
|
|
|
|
|
|
|
|
|
// Check that we don't have a configuration with the same displayName
|
|
|
|
|
QString configurationDisplayName = dc->displayName();
|
2014-07-07 19:02:26 +02:00
|
|
|
QStringList displayNames = Utils::transform(d->m_deployConfigurations, &DeployConfiguration::displayName);
|
2018-03-28 16:03:11 +02:00
|
|
|
configurationDisplayName = Utils::makeUniquelyNumbered(configurationDisplayName, displayNames);
|
2010-07-16 14:00:41 +02:00
|
|
|
dc->setDisplayName(configurationDisplayName);
|
|
|
|
|
|
|
|
|
|
// add it
|
2010-09-21 09:17:37 +02:00
|
|
|
d->m_deployConfigurations.push_back(dc);
|
2010-07-16 14:00:41 +02:00
|
|
|
|
2016-05-02 15:44:14 +02:00
|
|
|
emit addedProjectConfiguration(dc);
|
2010-07-16 14:00:41 +02:00
|
|
|
emit addedDeployConfiguration(dc);
|
|
|
|
|
|
2010-09-21 09:17:37 +02:00
|
|
|
if (!d->m_activeDeployConfiguration)
|
2010-07-16 14:00:41 +02:00
|
|
|
setActiveDeployConfiguration(dc);
|
|
|
|
|
Q_ASSERT(activeDeployConfiguration());
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-24 13:10:38 +00:00
|
|
|
bool Target::removeDeployConfiguration(DeployConfiguration *dc)
|
2010-07-16 14:00:41 +02:00
|
|
|
{
|
|
|
|
|
//todo: this might be error prone
|
2010-09-21 09:17:37 +02:00
|
|
|
if (!d->m_deployConfigurations.contains(dc))
|
2011-10-24 13:10:38 +00:00
|
|
|
return false;
|
|
|
|
|
|
2013-09-05 14:36:20 +02:00
|
|
|
if (BuildManager::isBuilding(dc))
|
2011-10-24 13:10:38 +00:00
|
|
|
return false;
|
2010-07-16 14:00:41 +02:00
|
|
|
|
2016-05-02 15:44:14 +02:00
|
|
|
emit aboutToRemoveProjectConfiguration(dc);
|
2010-09-21 09:17:37 +02:00
|
|
|
d->m_deployConfigurations.removeOne(dc);
|
2010-07-16 14:00:41 +02:00
|
|
|
|
|
|
|
|
if (activeDeployConfiguration() == dc) {
|
2010-09-21 09:17:37 +02:00
|
|
|
if (d->m_deployConfigurations.isEmpty())
|
2016-04-13 15:52:14 +02:00
|
|
|
SessionManager::setActiveDeployConfiguration(this, nullptr, SetActive::Cascade);
|
2010-07-16 14:00:41 +02:00
|
|
|
else
|
2015-07-28 18:29:52 +02:00
|
|
|
SessionManager::setActiveDeployConfiguration(this, d->m_deployConfigurations.at(0),
|
|
|
|
|
SetActive::Cascade);
|
2010-07-16 14:00:41 +02:00
|
|
|
}
|
|
|
|
|
|
2016-05-02 15:44:14 +02:00
|
|
|
emit removedProjectConfiguration(dc);
|
|
|
|
|
emit removedDeployConfiguration(dc);
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
delete dc;
|
2011-10-24 13:10:38 +00:00
|
|
|
return true;
|
2010-07-16 14:00:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QList<DeployConfiguration *> Target::deployConfigurations() const
|
|
|
|
|
{
|
2010-09-21 09:17:37 +02:00
|
|
|
return d->m_deployConfigurations;
|
2010-07-16 14:00:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DeployConfiguration *Target::activeDeployConfiguration() const
|
|
|
|
|
{
|
2010-09-21 09:17:37 +02:00
|
|
|
return d->m_activeDeployConfiguration;
|
2010-07-16 14:00:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Target::setActiveDeployConfiguration(DeployConfiguration *dc)
|
|
|
|
|
{
|
2010-09-21 09:17:37 +02:00
|
|
|
if ((!dc && d->m_deployConfigurations.isEmpty()) ||
|
|
|
|
|
(dc && d->m_deployConfigurations.contains(dc) &&
|
|
|
|
|
dc != d->m_activeDeployConfiguration)) {
|
|
|
|
|
d->m_activeDeployConfiguration = dc;
|
2017-08-01 14:19:25 +02:00
|
|
|
emit activeProjectConfigurationChanged(d->m_activeDeployConfiguration);
|
2010-09-21 09:17:37 +02:00
|
|
|
emit activeDeployConfigurationChanged(d->m_activeDeployConfiguration);
|
2010-07-16 14:00:41 +02:00
|
|
|
}
|
2012-03-26 11:15:11 +02:00
|
|
|
updateDeviceState();
|
2010-07-16 14:00:41 +02:00
|
|
|
}
|
|
|
|
|
|
2012-08-20 12:41:52 +02:00
|
|
|
void Target::setDeploymentData(const DeploymentData &deploymentData)
|
|
|
|
|
{
|
2012-08-29 15:52:47 +02:00
|
|
|
if (d->m_deploymentData != deploymentData) {
|
|
|
|
|
d->m_deploymentData = deploymentData;
|
|
|
|
|
emit deploymentDataChanged();
|
|
|
|
|
}
|
2012-08-20 12:41:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DeploymentData Target::deploymentData() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_deploymentData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Target::setApplicationTargets(const BuildTargetInfoList &appTargets)
|
|
|
|
|
{
|
2012-08-29 15:52:47 +02:00
|
|
|
if (d->m_appTargets != appTargets) {
|
|
|
|
|
d->m_appTargets = appTargets;
|
|
|
|
|
emit applicationTargetsChanged();
|
|
|
|
|
}
|
2012-08-20 12:41:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BuildTargetInfoList Target::applicationTargets() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_appTargets;
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-02 17:12:12 +02:00
|
|
|
QList<ProjectConfiguration *> Target::projectConfigurations() const
|
|
|
|
|
{
|
|
|
|
|
QList<ProjectConfiguration *> result;
|
2018-05-29 10:59:27 +02:00
|
|
|
result.append(Utils::static_container_cast<ProjectConfiguration *>(buildConfigurations()));
|
|
|
|
|
result.append(Utils::static_container_cast<ProjectConfiguration *>(deployConfigurations()));
|
|
|
|
|
result.append(Utils::static_container_cast<ProjectConfiguration *>(runConfigurations()));
|
2016-05-02 17:12:12 +02:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
QList<RunConfiguration *> Target::runConfigurations() const
|
|
|
|
|
{
|
2010-09-21 09:17:37 +02:00
|
|
|
return d->m_runConfigurations;
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
|
|
|
|
|
2016-05-02 15:47:06 +02:00
|
|
|
void Target::addRunConfiguration(RunConfiguration *rc)
|
2010-02-08 15:50:06 +01:00
|
|
|
{
|
2016-05-02 15:47:06 +02:00
|
|
|
QTC_ASSERT(rc && !d->m_runConfigurations.contains(rc), return);
|
|
|
|
|
Q_ASSERT(rc->target() == this);
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2010-08-18 15:38:42 +02:00
|
|
|
// Check that we don't have a configuration with the same displayName
|
2016-05-02 15:47:06 +02:00
|
|
|
QString configurationDisplayName = rc->displayName();
|
2014-07-07 19:02:26 +02:00
|
|
|
QStringList displayNames = Utils::transform(d->m_runConfigurations, &RunConfiguration::displayName);
|
2018-03-28 16:03:11 +02:00
|
|
|
configurationDisplayName = Utils::makeUniquelyNumbered(configurationDisplayName, displayNames);
|
2016-05-02 15:47:06 +02:00
|
|
|
rc->setDisplayName(configurationDisplayName);
|
2010-08-18 15:38:42 +02:00
|
|
|
|
2016-05-02 15:47:06 +02:00
|
|
|
d->m_runConfigurations.push_back(rc);
|
2012-03-29 13:16:25 +02:00
|
|
|
|
2016-05-02 15:44:14 +02:00
|
|
|
emit addedProjectConfiguration(rc);
|
2016-05-02 15:47:06 +02:00
|
|
|
emit addedRunConfiguration(rc);
|
2010-02-08 15:50:06 +01:00
|
|
|
|
|
|
|
|
if (!activeRunConfiguration())
|
2016-05-02 15:47:06 +02:00
|
|
|
setActiveRunConfiguration(rc);
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
|
|
|
|
|
2016-05-02 15:47:06 +02:00
|
|
|
void Target::removeRunConfiguration(RunConfiguration *rc)
|
2010-02-08 15:50:06 +01:00
|
|
|
{
|
2016-05-02 15:47:06 +02:00
|
|
|
QTC_ASSERT(rc && d->m_runConfigurations.contains(rc), return);
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2016-05-02 15:44:14 +02:00
|
|
|
emit aboutToRemoveProjectConfiguration(rc);
|
2016-05-02 15:47:06 +02:00
|
|
|
d->m_runConfigurations.removeOne(rc);
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2016-05-02 15:47:06 +02:00
|
|
|
if (activeRunConfiguration() == rc) {
|
2010-09-21 09:17:37 +02:00
|
|
|
if (d->m_runConfigurations.isEmpty())
|
2016-04-13 15:52:14 +02:00
|
|
|
setActiveRunConfiguration(nullptr);
|
2010-02-08 15:50:06 +01:00
|
|
|
else
|
2010-09-21 09:17:37 +02:00
|
|
|
setActiveRunConfiguration(d->m_runConfigurations.at(0));
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
|
|
|
|
|
2016-05-02 15:47:06 +02:00
|
|
|
emit removedRunConfiguration(rc);
|
2016-05-02 15:44:14 +02:00
|
|
|
emit removedProjectConfiguration(rc);
|
|
|
|
|
|
2016-05-02 15:47:06 +02:00
|
|
|
delete rc;
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
|
|
|
|
|
2016-05-02 15:47:06 +02:00
|
|
|
RunConfiguration *Target::activeRunConfiguration() const
|
2010-02-08 15:50:06 +01:00
|
|
|
{
|
2010-09-21 09:17:37 +02:00
|
|
|
return d->m_activeRunConfiguration;
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
|
|
|
|
|
2016-05-02 15:47:06 +02:00
|
|
|
void Target::setActiveRunConfiguration(RunConfiguration *rc)
|
2010-02-08 15:50:06 +01:00
|
|
|
{
|
2016-05-02 15:47:06 +02:00
|
|
|
if ((!rc && d->m_runConfigurations.isEmpty()) ||
|
|
|
|
|
(rc && d->m_runConfigurations.contains(rc) &&
|
|
|
|
|
rc != d->m_activeRunConfiguration)) {
|
|
|
|
|
d->m_activeRunConfiguration = rc;
|
2017-08-01 14:19:25 +02:00
|
|
|
emit activeProjectConfigurationChanged(d->m_activeRunConfiguration);
|
2010-09-21 09:17:37 +02:00
|
|
|
emit activeRunConfigurationChanged(d->m_activeRunConfiguration);
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
2012-03-26 11:15:11 +02:00
|
|
|
updateDeviceState();
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Target::isEnabled() const
|
|
|
|
|
{
|
2010-09-21 09:17:37 +02:00
|
|
|
return d->m_isEnabled;
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QIcon Target::icon() const
|
|
|
|
|
{
|
2017-03-02 14:24:25 +01:00
|
|
|
return d->m_kit->icon();
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
|
|
|
|
|
2010-02-23 16:52:03 +01:00
|
|
|
QIcon Target::overlayIcon() const
|
|
|
|
|
{
|
2010-09-21 09:17:37 +02:00
|
|
|
return d->m_overlayIcon;
|
2010-02-23 16:52:03 +01:00
|
|
|
}
|
|
|
|
|
|
2017-04-14 10:12:30 +02:00
|
|
|
void Target::setOverlayIcon(const QIcon &icon)
|
2010-02-23 16:52:03 +01:00
|
|
|
{
|
2010-09-21 09:17:37 +02:00
|
|
|
d->m_overlayIcon = icon;
|
2010-02-23 16:52:03 +01:00
|
|
|
emit overlayIconChanged();
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-02 14:24:25 +01:00
|
|
|
QString Target::overlayIconToolTip()
|
2010-02-09 19:05:15 +01:00
|
|
|
{
|
2017-03-02 14:24:25 +01:00
|
|
|
IDevice::ConstPtr current = DeviceKitInformation::device(kit());
|
|
|
|
|
return current.isNull() ? QString() : formatDeviceInfo(current->deviceInformation());
|
2010-02-09 19:05:15 +01:00
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
QVariantMap Target::toMap() const
|
|
|
|
|
{
|
2012-09-04 15:27:10 +02:00
|
|
|
if (!d->m_kit) // Kit was deleted, target is only around to be copied.
|
2012-04-24 15:49:09 +02:00
|
|
|
return QVariantMap();
|
2010-02-08 15:50:06 +01:00
|
|
|
|
|
|
|
|
QVariantMap map(ProjectConfiguration::toMap());
|
2012-04-24 15:49:09 +02:00
|
|
|
|
|
|
|
|
const QList<BuildConfiguration *> bcs = buildConfigurations();
|
2010-09-21 09:17:37 +02:00
|
|
|
map.insert(QLatin1String(ACTIVE_BC_KEY), bcs.indexOf(d->m_activeBuildConfiguration));
|
2010-02-08 15:50:06 +01:00
|
|
|
map.insert(QLatin1String(BC_COUNT_KEY), bcs.size());
|
|
|
|
|
for (int i = 0; i < bcs.size(); ++i)
|
|
|
|
|
map.insert(QString::fromLatin1(BC_KEY_PREFIX) + QString::number(i), bcs.at(i)->toMap());
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
const QList<DeployConfiguration *> dcs = deployConfigurations();
|
2010-09-21 09:17:37 +02:00
|
|
|
map.insert(QLatin1String(ACTIVE_DC_KEY), dcs.indexOf(d->m_activeDeployConfiguration));
|
2010-07-16 14:00:41 +02:00
|
|
|
map.insert(QLatin1String(DC_COUNT_KEY), dcs.size());
|
|
|
|
|
for (int i = 0; i < dcs.size(); ++i)
|
|
|
|
|
map.insert(QString::fromLatin1(DC_KEY_PREFIX) + QString::number(i), dcs.at(i)->toMap());
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
const QList<RunConfiguration *> rcs = runConfigurations();
|
2010-09-21 09:17:37 +02:00
|
|
|
map.insert(QLatin1String(ACTIVE_RC_KEY), rcs.indexOf(d->m_activeRunConfiguration));
|
2010-02-08 15:50:06 +01:00
|
|
|
map.insert(QLatin1String(RC_COUNT_KEY), rcs.size());
|
|
|
|
|
for (int i = 0; i < rcs.size(); ++i)
|
|
|
|
|
map.insert(QString::fromLatin1(RC_KEY_PREFIX) + QString::number(i), rcs.at(i)->toMap());
|
|
|
|
|
|
2013-04-19 16:27:31 +02:00
|
|
|
map.insert(QLatin1String(PLUGIN_SETTINGS_KEY), d->m_pluginSettings);
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
void Target::updateDefaultBuildConfigurations()
|
|
|
|
|
{
|
|
|
|
|
IBuildConfigurationFactory *bcFactory = IBuildConfigurationFactory::find(this);
|
|
|
|
|
if (!bcFactory) {
|
|
|
|
|
qWarning("No build configuration factory found for target id '%s'.", qPrintable(id().toString()));
|
|
|
|
|
return;
|
|
|
|
|
}
|
2014-05-02 12:22:58 +02:00
|
|
|
QList<BuildInfo *> infoList = bcFactory->availableSetups(this->kit(), project()->projectFilePath().toString());
|
2013-07-22 15:53:57 +02:00
|
|
|
foreach (BuildInfo *info, infoList) {
|
|
|
|
|
BuildConfiguration *bc = bcFactory->create(this, info);
|
2012-04-24 15:49:09 +02:00
|
|
|
if (!bc)
|
|
|
|
|
continue;
|
|
|
|
|
addBuildConfiguration(bc);
|
|
|
|
|
}
|
2013-07-22 15:53:57 +02:00
|
|
|
qDeleteAll(infoList);
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Target::updateDefaultDeployConfigurations()
|
|
|
|
|
{
|
2013-03-04 14:48:24 +01:00
|
|
|
QList<DeployConfigurationFactory *> dcFactories = DeployConfigurationFactory::find(this);
|
|
|
|
|
if (dcFactories.isEmpty()) {
|
2012-04-24 15:49:09 +02:00
|
|
|
qWarning("No deployment configuration factory found for target id '%s'.", qPrintable(id().toString()));
|
|
|
|
|
return;
|
|
|
|
|
}
|
2013-03-04 14:48:24 +01:00
|
|
|
|
|
|
|
|
QList<Core::Id> dcIds;
|
|
|
|
|
foreach (DeployConfigurationFactory *dcFactory, dcFactories)
|
2019-01-15 15:48:01 +01:00
|
|
|
dcIds.append(dcFactory->creationId());
|
2013-03-04 14:48:24 +01:00
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
QList<DeployConfiguration *> dcList = deployConfigurations();
|
2013-12-02 11:53:59 +01:00
|
|
|
QList<Core::Id> toCreate = dcIds;
|
2012-04-24 15:49:09 +02:00
|
|
|
|
|
|
|
|
foreach (DeployConfiguration *dc, dcList) {
|
|
|
|
|
if (dcIds.contains(dc->id()))
|
2013-12-02 11:53:59 +01:00
|
|
|
toCreate.removeOne(dc->id());
|
2012-04-24 15:49:09 +02:00
|
|
|
else
|
|
|
|
|
removeDeployConfiguration(dc);
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-02 11:53:59 +01:00
|
|
|
foreach (Core::Id id, toCreate) {
|
2013-03-04 14:48:24 +01:00
|
|
|
foreach (DeployConfigurationFactory *dcFactory, dcFactories) {
|
|
|
|
|
if (dcFactory->canCreate(this, id)) {
|
|
|
|
|
DeployConfiguration *dc = dcFactory->create(this, id);
|
|
|
|
|
if (dc) {
|
|
|
|
|
QTC_CHECK(dc->id() == id);
|
|
|
|
|
addDeployConfiguration(dc);
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Target::updateDefaultRunConfigurations()
|
|
|
|
|
{
|
2018-03-08 12:39:03 +01:00
|
|
|
// Manual and Auto
|
|
|
|
|
const QList<RunConfigurationCreationInfo> creators
|
|
|
|
|
= RunConfigurationFactory::creatorsForTarget(this);
|
2018-02-22 08:51:20 +01:00
|
|
|
|
2018-03-08 12:39:03 +01:00
|
|
|
if (creators.isEmpty()) {
|
2012-04-24 15:49:09 +02:00
|
|
|
qWarning("No run configuration factory found for target id '%s'.", qPrintable(id().toString()));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QList<RunConfiguration *> existingConfigured; // Existing configured RCs
|
|
|
|
|
QList<RunConfiguration *> existingUnconfigured; // Existing unconfigured RCs
|
|
|
|
|
QList<RunConfiguration *> newConfigured; // NEW configured Rcs
|
|
|
|
|
QList<RunConfiguration *> newUnconfigured; // NEW unconfigured RCs
|
|
|
|
|
|
|
|
|
|
// sort existing RCs into configured/unconfigured.
|
2016-04-01 16:19:55 +02:00
|
|
|
std::tie(existingConfigured, existingUnconfigured)
|
|
|
|
|
= Utils::partition(runConfigurations(),
|
|
|
|
|
[](const RunConfiguration *rc) { return rc->isConfigured(); });
|
2012-04-24 15:49:09 +02:00
|
|
|
int configuredCount = existingConfigured.count();
|
|
|
|
|
|
|
|
|
|
// Put outdated RCs into toRemove, do not bother with factories
|
|
|
|
|
// that produce already existing RCs
|
|
|
|
|
QList<RunConfiguration *> toRemove;
|
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> existing;
|
2012-04-24 15:49:09 +02:00
|
|
|
foreach (RunConfiguration *rc, existingConfigured) {
|
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
|
|
|
bool present = false;
|
2018-03-08 12:39:03 +01:00
|
|
|
for (const RunConfigurationCreationInfo &item : creators) {
|
2018-04-09 12:33:10 +02:00
|
|
|
QString buildKey = rc->buildKey();
|
|
|
|
|
if (item.id == rc->id() && item.buildKey == buildKey) {
|
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
|
|
|
existing.append(item);
|
|
|
|
|
present = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!present && project()->knowsAllBuildExecutables())
|
|
|
|
|
toRemove.append(rc);
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
configuredCount -= toRemove.count();
|
|
|
|
|
|
2018-08-29 13:00:04 +02:00
|
|
|
bool removeExistingUnconfigured = false;
|
|
|
|
|
if (ProjectExplorerPlugin::projectExplorerSettings().automaticallyCreateRunConfigurations) {
|
|
|
|
|
// Create new "automatic" RCs and put them into newConfigured/newUnconfigured
|
|
|
|
|
foreach (const RunConfigurationCreationInfo &item, creators) {
|
|
|
|
|
if (item.creationMode == RunConfigurationCreationInfo::ManualCreationOnly)
|
|
|
|
|
continue;
|
|
|
|
|
bool exists = false;
|
|
|
|
|
for (const RunConfigurationCreationInfo &ex : existing) {
|
|
|
|
|
if (ex.id == item.id && ex.buildKey == item.buildKey)
|
|
|
|
|
exists = true;
|
|
|
|
|
}
|
|
|
|
|
if (exists)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
RunConfiguration *rc = item.create(this);
|
|
|
|
|
if (!rc)
|
|
|
|
|
continue;
|
|
|
|
|
QTC_CHECK(rc->id() == item.id);
|
|
|
|
|
if (!rc->isConfigured())
|
|
|
|
|
newUnconfigured << rc;
|
|
|
|
|
else
|
|
|
|
|
newConfigured << rc;
|
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
|
|
|
}
|
2018-08-29 13:00:04 +02:00
|
|
|
configuredCount += newConfigured.count();
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2018-08-29 13:00:04 +02:00
|
|
|
// Decide what to do with the different categories:
|
|
|
|
|
if (configuredCount > 0) {
|
|
|
|
|
// new non-Custom Executable RCs were added
|
|
|
|
|
removeExistingUnconfigured = true;
|
2012-04-24 15:49:09 +02:00
|
|
|
qDeleteAll(newUnconfigured);
|
|
|
|
|
newUnconfigured.clear();
|
2018-08-29 13:00:04 +02:00
|
|
|
} else {
|
|
|
|
|
// no new RCs, use old or new CERCs?
|
|
|
|
|
if (!existingUnconfigured.isEmpty()) {
|
|
|
|
|
qDeleteAll(newUnconfigured);
|
|
|
|
|
newUnconfigured.clear();
|
|
|
|
|
}
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Do actual changes:
|
2013-10-18 17:46:40 +02:00
|
|
|
foreach (RunConfiguration *rc, newConfigured)
|
|
|
|
|
addRunConfiguration(rc);
|
|
|
|
|
foreach (RunConfiguration *rc, newUnconfigured)
|
|
|
|
|
addRunConfiguration(rc);
|
|
|
|
|
|
|
|
|
|
// Generate complete list of RCs to remove later:
|
|
|
|
|
QList<RunConfiguration *> removalList;
|
2013-05-29 15:27:05 +02:00
|
|
|
foreach (RunConfiguration *rc, toRemove) {
|
2013-10-18 17:46:40 +02:00
|
|
|
removalList << rc;
|
2013-05-29 15:27:05 +02:00
|
|
|
existingConfigured.removeOne(rc); // make sure to also remove them from existingConfigured!
|
|
|
|
|
}
|
2012-04-24 15:49:09 +02:00
|
|
|
|
|
|
|
|
if (removeExistingUnconfigured) {
|
2013-10-18 17:46:40 +02:00
|
|
|
removalList.append(existingUnconfigured);
|
2012-04-24 15:49:09 +02:00
|
|
|
existingUnconfigured.clear();
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-18 17:46:40 +02:00
|
|
|
// Make sure a configured RC will be active after we delete the RCs:
|
|
|
|
|
RunConfiguration *active = activeRunConfiguration();
|
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
|
|
|
if (active && (removalList.contains(active) || !active->isEnabled())) {
|
2016-04-01 16:19:55 +02:00
|
|
|
RunConfiguration *newConfiguredDefault = newConfigured.isEmpty() ? nullptr : newConfigured.at(0);
|
|
|
|
|
|
|
|
|
|
RunConfiguration *rc
|
|
|
|
|
= Utils::findOrDefault(existingConfigured,
|
|
|
|
|
[](RunConfiguration *rc) { return rc->isEnabled(); });
|
|
|
|
|
if (!rc) {
|
|
|
|
|
rc = Utils::findOr(newConfigured, newConfiguredDefault,
|
|
|
|
|
Utils::equal(&RunConfiguration::displayName, project()->displayName()));
|
|
|
|
|
}
|
|
|
|
|
if (!rc)
|
|
|
|
|
rc = newUnconfigured.isEmpty() ? nullptr : newUnconfigured.at(0);
|
|
|
|
|
if (!rc) {
|
|
|
|
|
// No RCs will be deleted, so use the one that will emit the minimum number of signals.
|
|
|
|
|
// One signal will be emitted from the next setActiveRunConfiguration, another one
|
|
|
|
|
// when the RC gets removed (and the activeRunConfiguration turns into a nullptr).
|
|
|
|
|
rc = removalList.isEmpty() ? nullptr : removalList.last();
|
2013-05-15 13:36:11 +02:00
|
|
|
}
|
2016-04-01 16:19:55 +02:00
|
|
|
|
|
|
|
|
if (rc)
|
|
|
|
|
setActiveRunConfiguration(rc);
|
2013-05-15 13:36:11 +02:00
|
|
|
}
|
2013-10-18 17:46:40 +02:00
|
|
|
|
|
|
|
|
// Remove the RCs that are no longer needed:
|
|
|
|
|
foreach (RunConfiguration *rc, removalList)
|
|
|
|
|
removeRunConfiguration(rc);
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
2013-04-19 16:27:31 +02:00
|
|
|
QVariant Target::namedSettings(const QString &name) const
|
|
|
|
|
{
|
|
|
|
|
return d->m_pluginSettings.value(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Target::setNamedSettings(const QString &name, const QVariant &value)
|
|
|
|
|
{
|
|
|
|
|
if (value.isNull())
|
|
|
|
|
d->m_pluginSettings.remove(name);
|
|
|
|
|
else
|
|
|
|
|
d->m_pluginSettings.insert(name, value);
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-20 14:03:01 +02:00
|
|
|
QVariant Target::additionalData(Core::Id id) const
|
|
|
|
|
{
|
|
|
|
|
return project()->additionalData(id, this);
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-26 11:15:11 +02:00
|
|
|
void Target::updateDeviceState()
|
|
|
|
|
{
|
2012-09-03 18:31:44 +02:00
|
|
|
IDevice::ConstPtr current = DeviceKitInformation::device(kit());
|
2012-03-26 11:15:11 +02:00
|
|
|
|
2016-09-27 17:45:42 +02:00
|
|
|
QIcon overlay;
|
2016-11-02 18:28:31 +01:00
|
|
|
static const QIcon disconnected = Icons::DEVICE_DISCONNECTED_INDICATOR_OVERLAY.icon();
|
2012-04-27 15:58:59 +02:00
|
|
|
if (current.isNull()) {
|
2016-09-27 17:45:42 +02:00
|
|
|
overlay = disconnected;
|
2012-04-27 15:58:59 +02:00
|
|
|
} else {
|
2012-05-29 13:49:34 +02:00
|
|
|
switch (current->deviceState()) {
|
|
|
|
|
case IDevice::DeviceStateUnknown:
|
2016-09-27 17:45:42 +02:00
|
|
|
overlay = QIcon();
|
2012-04-27 15:58:59 +02:00
|
|
|
return;
|
2016-09-27 17:45:42 +02:00
|
|
|
case IDevice::DeviceReadyToUse: {
|
2016-11-02 18:28:31 +01:00
|
|
|
static const QIcon ready = Icons::DEVICE_READY_INDICATOR_OVERLAY.icon();
|
2016-09-27 17:45:42 +02:00
|
|
|
overlay = ready;
|
2012-05-29 13:49:34 +02:00
|
|
|
break;
|
2016-09-27 17:45:42 +02:00
|
|
|
}
|
|
|
|
|
case IDevice::DeviceConnected: {
|
2016-11-02 18:28:31 +01:00
|
|
|
static const QIcon connected = Icons::DEVICE_CONNECTED_INDICATOR_OVERLAY.icon();
|
2016-09-27 17:45:42 +02:00
|
|
|
overlay = connected;
|
2012-04-27 15:58:59 +02:00
|
|
|
break;
|
2016-09-27 17:45:42 +02:00
|
|
|
}
|
2012-05-29 13:49:34 +02:00
|
|
|
case IDevice::DeviceDisconnected:
|
2016-09-27 17:45:42 +02:00
|
|
|
overlay = disconnected;
|
2012-04-27 15:58:59 +02:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-27 17:45:42 +02:00
|
|
|
setOverlayIcon(overlay);
|
2012-03-26 11:15:11 +02:00
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
void Target::setEnabled(bool enabled)
|
|
|
|
|
{
|
2010-09-21 09:17:37 +02:00
|
|
|
if (enabled == d->m_isEnabled)
|
2010-02-08 15:50:06 +01:00
|
|
|
return;
|
|
|
|
|
|
2010-09-21 09:17:37 +02:00
|
|
|
d->m_isEnabled = enabled;
|
|
|
|
|
emit targetEnabled(d->m_isEnabled);
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Target::fromMap(const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
if (!ProjectConfiguration::fromMap(map))
|
|
|
|
|
return false;
|
|
|
|
|
|
2017-01-11 17:25:58 +01:00
|
|
|
QTC_ASSERT(d->m_kit == KitManager::kit(id()), return false);
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2013-10-18 11:31:45 +02:00
|
|
|
setDisplayName(d->m_kit->displayName()); // Overwrite displayname read from file
|
|
|
|
|
setDefaultDisplayName(d->m_kit->displayName());
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
bool ok;
|
2011-04-21 15:01:48 +02:00
|
|
|
int bcCount = map.value(QLatin1String(BC_COUNT_KEY), 0).toInt(&ok);
|
2010-02-08 15:50:06 +01:00
|
|
|
if (!ok || bcCount < 0)
|
|
|
|
|
bcCount = 0;
|
2011-04-21 15:01:48 +02:00
|
|
|
int activeConfiguration = map.value(QLatin1String(ACTIVE_BC_KEY), 0).toInt(&ok);
|
2010-02-08 15:50:06 +01:00
|
|
|
if (!ok || activeConfiguration < 0)
|
|
|
|
|
activeConfiguration = 0;
|
|
|
|
|
if (0 > activeConfiguration || bcCount < activeConfiguration)
|
|
|
|
|
activeConfiguration = 0;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < bcCount; ++i) {
|
2011-04-21 15:01:48 +02:00
|
|
|
const QString key = QString::fromLatin1(BC_KEY_PREFIX) + QString::number(i);
|
2010-02-08 15:50:06 +01:00
|
|
|
if (!map.contains(key))
|
|
|
|
|
return false;
|
2012-04-24 15:49:09 +02:00
|
|
|
const QVariantMap valueMap = map.value(key).toMap();
|
2018-03-12 10:11:10 +01:00
|
|
|
BuildConfiguration *bc = IBuildConfigurationFactory::restore(this, valueMap);
|
2012-04-24 15:49:09 +02:00
|
|
|
if (!bc) {
|
2018-03-12 10:11:10 +01:00
|
|
|
qWarning("No factory found to restore build configuration!");
|
2010-02-08 15:50:06 +01:00
|
|
|
continue;
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
QTC_CHECK(bc->id() == ProjectExplorer::idFromMap(valueMap));
|
2010-02-08 15:50:06 +01:00
|
|
|
addBuildConfiguration(bc);
|
|
|
|
|
if (i == activeConfiguration)
|
|
|
|
|
setActiveBuildConfiguration(bc);
|
|
|
|
|
}
|
2012-04-24 15:49:09 +02:00
|
|
|
if (buildConfigurations().isEmpty() && IBuildConfigurationFactory::find(this))
|
2010-02-08 15:50:06 +01:00
|
|
|
return false;
|
|
|
|
|
|
2011-04-21 15:01:48 +02:00
|
|
|
int dcCount = map.value(QLatin1String(DC_COUNT_KEY), 0).toInt(&ok);
|
2010-07-16 14:00:41 +02:00
|
|
|
if (!ok || dcCount < 0)
|
|
|
|
|
dcCount = 0;
|
|
|
|
|
activeConfiguration = map.value(QLatin1String(ACTIVE_DC_KEY), 0).toInt(&ok);
|
|
|
|
|
if (!ok || activeConfiguration < 0)
|
|
|
|
|
activeConfiguration = 0;
|
|
|
|
|
if (0 > activeConfiguration || dcCount < activeConfiguration)
|
|
|
|
|
activeConfiguration = 0;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < dcCount; ++i) {
|
2011-04-21 15:01:48 +02:00
|
|
|
const QString key = QString::fromLatin1(DC_KEY_PREFIX) + QString::number(i);
|
2010-07-16 14:00:41 +02:00
|
|
|
if (!map.contains(key))
|
|
|
|
|
return false;
|
2012-04-24 15:49:09 +02:00
|
|
|
QVariantMap valueMap = map.value(key).toMap();
|
2018-03-12 11:43:59 +01:00
|
|
|
DeployConfiguration *dc = DeployConfigurationFactory::restore(this, valueMap);
|
|
|
|
|
if (!dc) {
|
2012-06-20 15:44:44 +02:00
|
|
|
Core::Id id = idFromMap(valueMap);
|
|
|
|
|
qWarning("No factory found to restore deployment configuration of id '%s'!",
|
2012-11-21 22:40:31 +02:00
|
|
|
id.isValid() ? qPrintable(id.toString()) : "UNKNOWN");
|
2012-04-24 15:49:09 +02:00
|
|
|
continue;
|
2011-03-09 12:07:35 +01:00
|
|
|
}
|
2018-04-09 12:33:10 +02:00
|
|
|
QTC_CHECK(dc->id() == ProjectExplorer::idFromMap(valueMap));
|
2010-07-16 14:00:41 +02:00
|
|
|
addDeployConfiguration(dc);
|
|
|
|
|
if (i == activeConfiguration)
|
|
|
|
|
setActiveDeployConfiguration(dc);
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-21 15:01:48 +02:00
|
|
|
int rcCount = map.value(QLatin1String(RC_COUNT_KEY), 0).toInt(&ok);
|
2010-02-08 15:50:06 +01:00
|
|
|
if (!ok || rcCount < 0)
|
|
|
|
|
rcCount = 0;
|
|
|
|
|
activeConfiguration = map.value(QLatin1String(ACTIVE_RC_KEY), 0).toInt(&ok);
|
|
|
|
|
if (!ok || activeConfiguration < 0)
|
|
|
|
|
activeConfiguration = 0;
|
|
|
|
|
if (0 > activeConfiguration || rcCount < activeConfiguration)
|
|
|
|
|
activeConfiguration = 0;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < rcCount; ++i) {
|
2011-04-21 15:01:48 +02:00
|
|
|
const QString key = QString::fromLatin1(RC_KEY_PREFIX) + QString::number(i);
|
2010-02-08 15:50:06 +01:00
|
|
|
if (!map.contains(key))
|
|
|
|
|
return false;
|
|
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
// Ignore missing RCs: We will just populate them using the default ones.
|
2011-04-21 15:01:48 +02:00
|
|
|
QVariantMap valueMap = map.value(key).toMap();
|
2018-03-06 17:14:43 +01:00
|
|
|
RunConfiguration *rc = RunConfigurationFactory::restore(this, valueMap);
|
2010-02-08 15:50:06 +01:00
|
|
|
if (!rc)
|
|
|
|
|
continue;
|
2018-04-09 12:33:10 +02:00
|
|
|
QTC_CHECK(rc->id().withSuffix(rc->buildKey()) == ProjectExplorer::idFromMap(valueMap));
|
2010-02-08 15:50:06 +01:00
|
|
|
addRunConfiguration(rc);
|
|
|
|
|
if (i == activeConfiguration)
|
|
|
|
|
setActiveRunConfiguration(rc);
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-19 16:27:31 +02:00
|
|
|
if (map.contains(QLatin1String(PLUGIN_SETTINGS_KEY)))
|
|
|
|
|
d->m_pluginSettings = map.value(QLatin1String(PLUGIN_SETTINGS_KEY)).toMap();
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-21 09:17:37 +02:00
|
|
|
} // namespace ProjectExplorer
|