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 "buildconfiguration.h"
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
#include "buildsteplist.h"
|
|
|
|
|
#include "projectexplorer.h"
|
2012-09-03 18:31:44 +02:00
|
|
|
#include "kitmanager.h"
|
2010-07-16 14:00:41 +02:00
|
|
|
#include "target.h"
|
2010-09-22 15:14:07 +02:00
|
|
|
#include "project.h"
|
2012-10-16 16:19:40 +02:00
|
|
|
#include "kit.h"
|
2010-07-16 14:00:41 +02:00
|
|
|
|
2012-11-08 16:13:31 +01:00
|
|
|
#include <projectexplorer/buildenvironmentwidget.h>
|
2017-10-17 12:27:37 +02:00
|
|
|
#include <projectexplorer/kitinformation.h>
|
|
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2014-10-22 09:16:55 +02:00
|
|
|
#include <projectexplorer/projectmacroexpander.h>
|
2017-10-17 12:27:37 +02:00
|
|
|
#include <projectexplorer/target.h>
|
2012-04-24 15:49:09 +02:00
|
|
|
#include <extensionsystem/pluginmanager.h>
|
2014-10-06 13:15:40 +02:00
|
|
|
#include <coreplugin/idocument.h>
|
2010-11-12 17:23:55 +01:00
|
|
|
|
2011-12-19 12:06:44 +01:00
|
|
|
#include <utils/qtcassert.h>
|
2014-10-15 14:45:31 +02:00
|
|
|
#include <utils/macroexpander.h>
|
2014-06-06 13:12:47 +02:00
|
|
|
#include <utils/algorithm.h>
|
2011-08-18 13:46:52 +02:00
|
|
|
|
2013-08-01 10:52:55 +02:00
|
|
|
#include <QDebug>
|
|
|
|
|
|
2011-08-18 13:46:52 +02:00
|
|
|
static const char BUILD_STEP_LIST_COUNT[] = "ProjectExplorer.BuildConfiguration.BuildStepListCount";
|
|
|
|
|
static const char BUILD_STEP_LIST_PREFIX[] = "ProjectExplorer.BuildConfiguration.BuildStepList.";
|
|
|
|
|
static const char CLEAR_SYSTEM_ENVIRONMENT_KEY[] = "ProjectExplorer.BuildConfiguration.ClearSystemEnvironment";
|
|
|
|
|
static const char USER_ENVIRONMENT_CHANGES_KEY[] = "ProjectExplorer.BuildConfiguration.UserEnvironmentChanges";
|
2013-08-16 17:45:16 +02:00
|
|
|
static const char BUILDDIRECTORY_KEY[] = "ProjectExplorer.BuildConfiguration.BuildDirectory";
|
2009-09-21 15:50:27 +02:00
|
|
|
|
2011-08-18 13:46:52 +02:00
|
|
|
namespace ProjectExplorer {
|
2010-01-18 12:11:04 +01:00
|
|
|
|
2014-07-01 11:08:26 +02:00
|
|
|
BuildConfiguration::BuildConfiguration(Target *target, Core::Id id) :
|
2017-09-01 13:23:02 +02:00
|
|
|
ProjectConfiguration(target),
|
2014-10-22 18:16:51 +02:00
|
|
|
m_clearSystemEnvironment(false)
|
2009-12-08 12:21:11 +01:00
|
|
|
{
|
2017-09-01 13:23:02 +02:00
|
|
|
initialize(id);
|
2010-07-16 14:00:41 +02:00
|
|
|
Q_ASSERT(target);
|
2016-04-13 15:52:14 +02:00
|
|
|
auto bsl = new BuildStepList(this, Core::Id(Constants::BUILDSTEPS_BUILD));
|
2010-07-16 14:00:41 +02:00
|
|
|
//: Display name of the build build step list. Used as part of the labels in the project window.
|
2010-08-19 12:26:21 +02:00
|
|
|
bsl->setDefaultDisplayName(tr("Build"));
|
2010-07-16 14:00:41 +02:00
|
|
|
m_stepLists.append(bsl);
|
2012-03-15 17:17:40 +01:00
|
|
|
bsl = new BuildStepList(this, Core::Id(Constants::BUILDSTEPS_CLEAN));
|
2010-07-16 14:00:41 +02:00
|
|
|
//: Display name of the clean build step list. Used as part of the labels in the project window.
|
2010-08-19 12:26:21 +02:00
|
|
|
bsl->setDefaultDisplayName(tr("Clean"));
|
2010-07-16 14:00:41 +02:00
|
|
|
m_stepLists.append(bsl);
|
2011-03-24 11:58:40 +01:00
|
|
|
|
2017-10-18 16:21:39 +02:00
|
|
|
updateCacheAndEmitEnvironmentChanged();
|
2013-04-19 13:19:46 +02:00
|
|
|
|
2016-01-29 16:38:37 +02:00
|
|
|
connect(target, &Target::kitChanged,
|
|
|
|
|
this, &BuildConfiguration::handleKitUpdate);
|
|
|
|
|
connect(this, &BuildConfiguration::environmentChanged,
|
|
|
|
|
this, &BuildConfiguration::emitBuildDirectoryChanged);
|
2014-11-05 14:01:26 +01:00
|
|
|
|
2014-11-05 15:45:56 +01:00
|
|
|
ctor();
|
2009-12-08 12:21:11 +01:00
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
BuildConfiguration::BuildConfiguration(Target *target, BuildConfiguration *source) :
|
2017-09-01 13:23:02 +02:00
|
|
|
ProjectConfiguration(target),
|
2010-03-11 17:47:09 +01:00
|
|
|
m_clearSystemEnvironment(source->m_clearSystemEnvironment),
|
2010-11-12 17:23:55 +01:00
|
|
|
m_userEnvironmentChanges(source->m_userEnvironmentChanges),
|
2013-08-16 17:45:16 +02:00
|
|
|
m_buildDirectory(source->m_buildDirectory)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2017-09-01 13:23:02 +02:00
|
|
|
copyFrom(source);
|
2010-07-16 14:00:41 +02:00
|
|
|
Q_ASSERT(target);
|
|
|
|
|
// Do not clone stepLists here, do that in the derived constructor instead
|
|
|
|
|
// otherwise BuildStepFactories might reject to set up a BuildStep for us
|
|
|
|
|
// since we are not yet the derived class!
|
2011-03-24 11:58:40 +01:00
|
|
|
|
2017-10-18 16:21:39 +02:00
|
|
|
updateCacheAndEmitEnvironmentChanged();
|
2013-04-19 13:19:46 +02:00
|
|
|
|
2016-01-29 16:38:37 +02:00
|
|
|
connect(target, &Target::kitChanged,
|
|
|
|
|
this, &BuildConfiguration::handleKitUpdate);
|
2014-10-22 18:16:51 +02:00
|
|
|
|
2014-11-05 15:45:56 +01:00
|
|
|
ctor();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BuildConfiguration::ctor()
|
|
|
|
|
{
|
|
|
|
|
Utils::MacroExpander *expander = macroExpander();
|
|
|
|
|
expander->setDisplayName(tr("Build Settings"));
|
|
|
|
|
expander->setAccumulating(true);
|
|
|
|
|
expander->registerSubProvider([this] { return target()->macroExpander(); });
|
|
|
|
|
|
|
|
|
|
expander->registerVariable("buildDir", tr("Build directory"),
|
|
|
|
|
[this] { return buildDirectory().toUserOutput(); });
|
|
|
|
|
|
2017-01-25 16:15:54 +01:00
|
|
|
expander->registerVariable(Constants::VAR_CURRENTBUILD_NAME, tr("Name of current build"),
|
2014-11-05 15:45:56 +01:00
|
|
|
[this] { return displayName(); }, false);
|
2017-01-25 16:15:54 +01:00
|
|
|
|
|
|
|
|
expander->registerPrefix(Constants::VAR_CURRENTBUILD_ENV,
|
|
|
|
|
tr("Variables in the current build environment"),
|
|
|
|
|
[this](const QString &var) { return environment().value(var); });
|
2014-10-22 18:16:51 +02:00
|
|
|
}
|
|
|
|
|
|
2013-08-16 17:45:16 +02:00
|
|
|
Utils::FileName BuildConfiguration::buildDirectory() const
|
|
|
|
|
{
|
2017-11-03 15:23:40 +01:00
|
|
|
const QString path = macroExpander()->expand(QDir::cleanPath(environment().expandVariables(m_buildDirectory.toString())));
|
2014-05-02 12:53:36 +02:00
|
|
|
return Utils::FileName::fromString(QDir::cleanPath(QDir(target()->project()->projectDirectory().toString()).absoluteFilePath(path)));
|
2013-08-16 17:45:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Utils::FileName BuildConfiguration::rawBuildDirectory() const
|
|
|
|
|
{
|
|
|
|
|
return m_buildDirectory;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BuildConfiguration::setBuildDirectory(const Utils::FileName &dir)
|
|
|
|
|
{
|
2016-12-05 09:37:40 +01:00
|
|
|
if (dir == m_buildDirectory)
|
|
|
|
|
return;
|
2013-08-16 17:45:16 +02:00
|
|
|
m_buildDirectory = dir;
|
|
|
|
|
emitBuildDirectoryChanged();
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-08 18:02:50 +01:00
|
|
|
QList<NamedWidget *> BuildConfiguration::createSubConfigWidgets()
|
2012-11-08 16:10:34 +01:00
|
|
|
{
|
2014-10-13 22:37:28 +03:00
|
|
|
return QList<NamedWidget *>() << new BuildEnvironmentWidget(this);
|
2012-11-08 16:10:34 +01:00
|
|
|
}
|
|
|
|
|
|
2012-03-15 17:17:40 +01:00
|
|
|
QList<Core::Id> BuildConfiguration::knownStepLists() const
|
2009-10-27 14:16:28 +01:00
|
|
|
{
|
2014-07-07 19:02:26 +02:00
|
|
|
return Utils::transform(m_stepLists, &BuildStepList::id);
|
2010-07-16 14:00:41 +02:00
|
|
|
}
|
|
|
|
|
|
2012-03-15 17:17:40 +01:00
|
|
|
BuildStepList *BuildConfiguration::stepList(Core::Id id) const
|
2010-07-16 14:00:41 +02:00
|
|
|
{
|
2014-07-10 12:57:06 +02:00
|
|
|
return Utils::findOrDefault(m_stepLists, Utils::equal(&BuildStepList::id, id));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-01-18 12:11:04 +01:00
|
|
|
QVariantMap BuildConfiguration::toMap() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-01-18 12:11:04 +01:00
|
|
|
QVariantMap map(ProjectConfiguration::toMap());
|
2010-03-11 17:47:09 +01:00
|
|
|
map.insert(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY), m_clearSystemEnvironment);
|
2010-09-23 10:35:23 +02:00
|
|
|
map.insert(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY), Utils::EnvironmentItem::toStringList(m_userEnvironmentChanges));
|
2013-08-16 17:45:16 +02:00
|
|
|
map.insert(QLatin1String(BUILDDIRECTORY_KEY), m_buildDirectory.toString());
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
map.insert(QLatin1String(BUILD_STEP_LIST_COUNT), m_stepLists.count());
|
|
|
|
|
for (int i = 0; i < m_stepLists.count(); ++i)
|
2010-08-02 14:29:32 +02:00
|
|
|
map.insert(QLatin1String(BUILD_STEP_LIST_PREFIX) + QString::number(i), m_stepLists.at(i)->toMap());
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
return map;
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
2010-01-18 12:11:04 +01:00
|
|
|
|
|
|
|
|
bool BuildConfiguration::fromMap(const QVariantMap &map)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-03-11 17:47:09 +01:00
|
|
|
m_clearSystemEnvironment = map.value(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY)).toBool();
|
2010-09-23 10:35:23 +02:00
|
|
|
m_userEnvironmentChanges = Utils::EnvironmentItem::fromStringList(map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList());
|
2013-08-16 17:45:16 +02:00
|
|
|
m_buildDirectory = Utils::FileName::fromString(map.value(QLatin1String(BUILDDIRECTORY_KEY)).toString());
|
2010-03-11 17:47:09 +01:00
|
|
|
|
2017-10-18 16:21:39 +02:00
|
|
|
updateCacheAndEmitEnvironmentChanged();
|
2012-10-17 15:55:20 +02:00
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
qDeleteAll(m_stepLists);
|
|
|
|
|
m_stepLists.clear();
|
2009-10-27 14:16:28 +01:00
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
int maxI = map.value(QLatin1String(BUILD_STEP_LIST_COUNT), 0).toInt();
|
|
|
|
|
for (int i = 0; i < maxI; ++i) {
|
2010-08-02 14:29:32 +02:00
|
|
|
QVariantMap data = map.value(QLatin1String(BUILD_STEP_LIST_PREFIX) + QString::number(i)).toMap();
|
2010-07-16 14:00:41 +02:00
|
|
|
if (data.isEmpty()) {
|
|
|
|
|
qWarning() << "No data for build step list" << i << "found!";
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2016-06-15 10:37:51 +02:00
|
|
|
auto list = new BuildStepList(this, Core::Id());
|
|
|
|
|
if (!list->fromMap(data)) {
|
2010-07-16 14:00:41 +02:00
|
|
|
qWarning() << "Failed to restore build step list" << i;
|
|
|
|
|
delete list;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2012-08-03 15:24:33 +02:00
|
|
|
if (list->id() == Constants::BUILDSTEPS_BUILD)
|
2011-11-22 09:57:27 +01:00
|
|
|
list->setDefaultDisplayName(tr("Build"));
|
2012-08-03 15:24:33 +02:00
|
|
|
else if (list->id() == Constants::BUILDSTEPS_CLEAN)
|
2011-11-22 09:57:27 +01:00
|
|
|
list->setDefaultDisplayName(tr("Clean"));
|
2010-07-16 14:00:41 +02:00
|
|
|
m_stepLists.append(list);
|
|
|
|
|
}
|
2010-04-13 15:04:21 +02:00
|
|
|
|
2012-05-03 17:05:38 +02:00
|
|
|
// We currently assume there to be at least a clean and build list!
|
2014-10-13 22:37:28 +03:00
|
|
|
QTC_CHECK(knownStepLists().contains(Core::Id(Constants::BUILDSTEPS_BUILD)));
|
|
|
|
|
QTC_CHECK(knownStepLists().contains(Core::Id(Constants::BUILDSTEPS_CLEAN)));
|
2010-04-13 15:04:21 +02:00
|
|
|
|
2010-08-19 12:26:21 +02:00
|
|
|
return ProjectConfiguration::fromMap(map);
|
2009-10-27 14:16:28 +01:00
|
|
|
}
|
|
|
|
|
|
2017-10-18 16:21:39 +02:00
|
|
|
void BuildConfiguration::updateCacheAndEmitEnvironmentChanged()
|
2012-10-17 15:55:20 +02:00
|
|
|
{
|
2013-04-19 13:19:46 +02:00
|
|
|
Utils::Environment env = baseEnvironment();
|
|
|
|
|
env.modify(userEnvironmentChanges());
|
|
|
|
|
if (env == m_cachedEnvironment)
|
|
|
|
|
return;
|
|
|
|
|
m_cachedEnvironment = env;
|
2013-08-16 17:45:16 +02:00
|
|
|
emit environmentChanged(); // might trigger buildDirectoryChanged signal!
|
2012-10-17 15:55:20 +02:00
|
|
|
}
|
|
|
|
|
|
2012-10-17 15:43:18 +02:00
|
|
|
void BuildConfiguration::handleKitUpdate()
|
2011-03-24 14:35:03 +01:00
|
|
|
{
|
2017-10-18 16:21:39 +02:00
|
|
|
updateCacheAndEmitEnvironmentChanged();
|
2011-03-24 14:35:03 +01:00
|
|
|
}
|
|
|
|
|
|
2013-08-16 17:45:16 +02:00
|
|
|
void BuildConfiguration::emitBuildDirectoryChanged()
|
|
|
|
|
{
|
|
|
|
|
if (buildDirectory() != m_lastEmmitedBuildDirectory) {
|
|
|
|
|
m_lastEmmitedBuildDirectory = buildDirectory();
|
|
|
|
|
emit buildDirectoryChanged();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
Target *BuildConfiguration::target() const
|
2009-11-23 13:29:45 +01:00
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
return static_cast<Target *>(parent());
|
2009-11-23 13:29:45 +01:00
|
|
|
}
|
|
|
|
|
|
2017-07-31 14:57:21 +02:00
|
|
|
Project *BuildConfiguration::project() const
|
|
|
|
|
{
|
|
|
|
|
return target()->project();
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-23 10:35:23 +02:00
|
|
|
Utils::Environment BuildConfiguration::baseEnvironment() const
|
2010-03-11 17:47:09 +01:00
|
|
|
{
|
2010-09-23 10:35:23 +02:00
|
|
|
Utils::Environment result;
|
2013-11-29 16:29:13 +01:00
|
|
|
if (useSystemEnvironment())
|
2012-04-30 19:01:26 +02:00
|
|
|
result = Utils::Environment::systemEnvironment();
|
2015-01-27 18:46:40 +01:00
|
|
|
addToEnvironment(result);
|
2017-10-17 12:27:37 +02:00
|
|
|
target()->kit()->addToEnvironment(result);
|
2010-09-22 15:14:07 +02:00
|
|
|
return result;
|
2010-03-11 17:47:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BuildConfiguration::baseEnvironmentText() const
|
|
|
|
|
{
|
|
|
|
|
if (useSystemEnvironment())
|
|
|
|
|
return tr("System Environment");
|
|
|
|
|
else
|
|
|
|
|
return tr("Clean Environment");
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-23 10:35:23 +02:00
|
|
|
Utils::Environment BuildConfiguration::environment() const
|
2010-03-11 17:47:09 +01:00
|
|
|
{
|
2013-04-19 13:19:46 +02:00
|
|
|
return m_cachedEnvironment;
|
2010-03-11 17:47:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BuildConfiguration::setUseSystemEnvironment(bool b)
|
|
|
|
|
{
|
|
|
|
|
if (useSystemEnvironment() == b)
|
|
|
|
|
return;
|
|
|
|
|
m_clearSystemEnvironment = !b;
|
2017-10-18 16:21:39 +02:00
|
|
|
updateCacheAndEmitEnvironmentChanged();
|
2010-03-11 17:47:09 +01:00
|
|
|
}
|
|
|
|
|
|
2015-01-27 18:46:40 +01:00
|
|
|
void BuildConfiguration::addToEnvironment(Utils::Environment &env) const
|
|
|
|
|
{
|
|
|
|
|
Q_UNUSED(env);
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-11 17:47:09 +01:00
|
|
|
bool BuildConfiguration::useSystemEnvironment() const
|
|
|
|
|
{
|
|
|
|
|
return !m_clearSystemEnvironment;
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-23 10:35:23 +02:00
|
|
|
QList<Utils::EnvironmentItem> BuildConfiguration::userEnvironmentChanges() const
|
2010-03-11 17:47:09 +01:00
|
|
|
{
|
|
|
|
|
return m_userEnvironmentChanges;
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-23 10:35:23 +02:00
|
|
|
void BuildConfiguration::setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff)
|
2010-03-11 17:47:09 +01:00
|
|
|
{
|
|
|
|
|
if (m_userEnvironmentChanges == diff)
|
|
|
|
|
return;
|
|
|
|
|
m_userEnvironmentChanges = diff;
|
2017-10-18 16:21:39 +02:00
|
|
|
updateCacheAndEmitEnvironmentChanged();
|
2010-03-11 17:47:09 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
void BuildConfiguration::cloneSteps(BuildConfiguration *source)
|
|
|
|
|
{
|
2012-09-12 17:28:05 +02:00
|
|
|
if (source == this)
|
|
|
|
|
return;
|
2010-07-16 14:00:41 +02:00
|
|
|
qDeleteAll(m_stepLists);
|
|
|
|
|
m_stepLists.clear();
|
|
|
|
|
foreach (BuildStepList *bsl, source->m_stepLists) {
|
2016-04-13 15:52:14 +02:00
|
|
|
auto newBsl = new BuildStepList(this, bsl);
|
2010-08-30 12:25:27 +02:00
|
|
|
newBsl->cloneSteps(bsl);
|
2010-07-16 14:00:41 +02:00
|
|
|
m_stepLists.append(newBsl);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-19 15:46:01 +01:00
|
|
|
bool BuildConfiguration::isEnabled() const
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-26 15:56:36 +02:00
|
|
|
QString BuildConfiguration::disabledReason() const
|
|
|
|
|
{
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-22 16:45:52 +02:00
|
|
|
QString BuildConfiguration::buildTypeName(BuildConfiguration::BuildType type)
|
|
|
|
|
{
|
|
|
|
|
switch (type) {
|
|
|
|
|
case ProjectExplorer::BuildConfiguration::Debug:
|
|
|
|
|
return QLatin1String("debug");
|
|
|
|
|
case ProjectExplorer::BuildConfiguration::Profile:
|
|
|
|
|
return QLatin1String("profile");
|
|
|
|
|
case ProjectExplorer::BuildConfiguration::Release:
|
|
|
|
|
return QLatin1String("release");
|
|
|
|
|
case ProjectExplorer::BuildConfiguration::Unknown: // fallthrough
|
|
|
|
|
default:
|
|
|
|
|
return QLatin1String("unknown");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-02 16:04:45 +02:00
|
|
|
bool BuildConfiguration::isActive() const
|
|
|
|
|
{
|
|
|
|
|
return target()->isActive() && target()->activeBuildConfiguration() == this;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-17 12:27:37 +02:00
|
|
|
/*!
|
|
|
|
|
* Helper function that prepends the directory containing the C++ toolchain to
|
|
|
|
|
* PATH. This is used to in build configurations targeting broken build systems
|
|
|
|
|
* to provide hints about which compiler to use.
|
|
|
|
|
*/
|
|
|
|
|
void BuildConfiguration::prependCompilerPathToEnvironment(Utils::Environment &env) const
|
|
|
|
|
{
|
|
|
|
|
const ToolChain *tc
|
|
|
|
|
= ToolChainKitInformation::toolChain(target()->kit(),
|
|
|
|
|
ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
|
|
|
|
|
|
|
|
|
if (!tc)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
const Utils::FileName compilerDir = tc->compilerCommand().parentDir();
|
|
|
|
|
if (!compilerDir.isEmpty())
|
|
|
|
|
env.prependOrSetPath(compilerDir.toString());
|
|
|
|
|
}
|
|
|
|
|
|
2009-10-27 14:16:28 +01:00
|
|
|
///
|
|
|
|
|
// IBuildConfigurationFactory
|
|
|
|
|
///
|
2009-09-24 16:02:02 +02:00
|
|
|
|
2010-01-18 12:11:04 +01:00
|
|
|
IBuildConfigurationFactory::IBuildConfigurationFactory(QObject *parent) :
|
|
|
|
|
QObject(parent)
|
2010-07-16 14:00:41 +02:00
|
|
|
{ }
|
2009-09-24 16:02:02 +02:00
|
|
|
|
|
|
|
|
IBuildConfigurationFactory::~IBuildConfigurationFactory()
|
2010-07-16 14:00:41 +02:00
|
|
|
{ }
|
2011-08-18 13:46:52 +02:00
|
|
|
|
2012-09-20 14:42:57 +02:00
|
|
|
// restore
|
2012-04-24 15:49:09 +02:00
|
|
|
IBuildConfigurationFactory *IBuildConfigurationFactory::find(Target *parent, const QVariantMap &map)
|
|
|
|
|
{
|
2015-01-27 18:46:40 +01:00
|
|
|
QList<IBuildConfigurationFactory *> factories
|
|
|
|
|
= ExtensionSystem::PluginManager::getObjects<IBuildConfigurationFactory>(
|
|
|
|
|
[&parent, map](IBuildConfigurationFactory *factory) {
|
|
|
|
|
return factory->canRestore(parent, map);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
IBuildConfigurationFactory *factory = 0;
|
|
|
|
|
int priority = -1;
|
|
|
|
|
foreach (IBuildConfigurationFactory *i, factories) {
|
|
|
|
|
int iPriority = i->priority(parent);
|
|
|
|
|
if (iPriority > priority) {
|
|
|
|
|
factory = i;
|
|
|
|
|
priority = iPriority;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return factory;
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
2013-08-13 10:52:57 +02:00
|
|
|
// setup
|
2016-08-25 13:21:50 +02:00
|
|
|
IBuildConfigurationFactory *IBuildConfigurationFactory::find(const Kit *k, const QString &projectPath)
|
2013-08-13 10:52:57 +02:00
|
|
|
{
|
|
|
|
|
QList<IBuildConfigurationFactory *> factories
|
|
|
|
|
= ExtensionSystem::PluginManager::instance()->getObjects<IBuildConfigurationFactory>();
|
2014-06-19 14:05:40 +02:00
|
|
|
IBuildConfigurationFactory *factory = 0;
|
|
|
|
|
int priority = -1;
|
|
|
|
|
foreach (IBuildConfigurationFactory *i, factories) {
|
|
|
|
|
int iPriority = i->priority(k, projectPath);
|
|
|
|
|
if (iPriority > priority) {
|
|
|
|
|
factory = i;
|
|
|
|
|
priority = iPriority;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return factory;
|
2013-08-13 10:52:57 +02:00
|
|
|
}
|
|
|
|
|
|
2012-09-20 14:42:57 +02:00
|
|
|
// create
|
2012-04-24 15:49:09 +02:00
|
|
|
IBuildConfigurationFactory * IBuildConfigurationFactory::find(Target *parent)
|
|
|
|
|
{
|
|
|
|
|
QList<IBuildConfigurationFactory *> factories
|
2014-06-19 14:05:40 +02:00
|
|
|
= ExtensionSystem::PluginManager::instance()->getObjects<IBuildConfigurationFactory>();
|
|
|
|
|
IBuildConfigurationFactory *factory = 0;
|
|
|
|
|
int priority = -1;
|
|
|
|
|
foreach (IBuildConfigurationFactory *i, factories) {
|
|
|
|
|
int iPriority = i->priority(parent);
|
|
|
|
|
if (iPriority > priority) {
|
|
|
|
|
factory = i;
|
|
|
|
|
priority = iPriority;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return factory;
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
2012-09-20 14:42:57 +02:00
|
|
|
// clone
|
|
|
|
|
IBuildConfigurationFactory *IBuildConfigurationFactory::find(Target *parent, BuildConfiguration *bc)
|
|
|
|
|
{
|
2015-01-27 18:46:40 +01:00
|
|
|
QList<IBuildConfigurationFactory *> factories
|
|
|
|
|
= ExtensionSystem::PluginManager::getObjects<IBuildConfigurationFactory>(
|
|
|
|
|
[&parent, &bc](IBuildConfigurationFactory *factory) {
|
|
|
|
|
return factory->canClone(parent, bc);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
IBuildConfigurationFactory *factory = 0;
|
|
|
|
|
int priority = -1;
|
|
|
|
|
foreach (IBuildConfigurationFactory *i, factories) {
|
|
|
|
|
int iPriority = i->priority(parent);
|
|
|
|
|
if (iPriority > priority) {
|
|
|
|
|
factory = i;
|
|
|
|
|
priority = iPriority;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return factory;
|
2012-09-20 14:42:57 +02:00
|
|
|
}
|
2011-08-18 13:46:52 +02:00
|
|
|
} // namespace ProjectExplorer
|