2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-04 13:06:02 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2012-01-26 18:33:46 +01:00
|
|
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-04 13:06:02 +01:00
|
|
|
**
|
2012-07-19 12:26:56 +02:00
|
|
|
** Contact: http://www.qt-project.org/
|
2008-12-04 13:06:02 +01:00
|
|
|
**
|
|
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2008-12-04 13:06:02 +01:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2008-12-04 13:06:02 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2008-12-04 13:06:02 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
**************************************************************************/
|
2010-01-14 17:41:29 +01:00
|
|
|
|
2008-12-04 13:06:02 +01:00
|
|
|
#include "makestep.h"
|
2010-01-14 17:41:29 +01:00
|
|
|
|
2008-12-04 13:06:02 +01:00
|
|
|
#include "cmakeprojectconstants.h"
|
|
|
|
|
#include "cmakeproject.h"
|
2009-11-25 18:50:20 +01:00
|
|
|
#include "cmakebuildconfiguration.h"
|
2008-12-04 13:06:02 +01:00
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
#include <projectexplorer/buildsteplist.h>
|
2012-04-24 15:49:09 +02:00
|
|
|
#include <projectexplorer/deployconfiguration.h>
|
2009-12-09 13:54:46 +01:00
|
|
|
#include <projectexplorer/gnumakeparser.h>
|
2012-09-03 18:31:44 +02:00
|
|
|
#include <projectexplorer/kitinformation.h>
|
2012-04-24 15:49:09 +02:00
|
|
|
#include <projectexplorer/projectexplorer.h>
|
2011-11-24 12:42:52 +01:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2012-04-24 15:49:09 +02:00
|
|
|
#include <projectexplorer/target.h>
|
|
|
|
|
#include <projectexplorer/toolchain.h>
|
2009-09-29 11:39:55 +02:00
|
|
|
|
2010-10-19 11:14:03 +02:00
|
|
|
#include <utils/qtcprocess.h>
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QFormLayout>
|
|
|
|
|
#include <QGroupBox>
|
|
|
|
|
#include <QCheckBox>
|
|
|
|
|
#include <QLineEdit>
|
|
|
|
|
#include <QListWidget>
|
2008-12-09 15:25:01 +01:00
|
|
|
|
2008-12-04 13:06:02 +01:00
|
|
|
using namespace CMakeProjectManager;
|
|
|
|
|
using namespace CMakeProjectManager::Internal;
|
2009-10-27 14:16:28 +01:00
|
|
|
using namespace ProjectExplorer;
|
2008-12-04 13:06:02 +01:00
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
namespace {
|
2012-08-03 15:24:33 +02:00
|
|
|
const char MS_ID[] = "CMakeProjectManager.MakeStep";
|
|
|
|
|
const char CLEAN_KEY[] = "CMakeProjectManager.MakeStep.Clean";
|
|
|
|
|
const char BUILD_TARGETS_KEY[] = "CMakeProjectManager.MakeStep.BuildTargets";
|
|
|
|
|
const char ADDITIONAL_ARGUMENTS_KEY[] = "CMakeProjectManager.MakeStep.AdditionalArguments";
|
2010-01-14 17:41:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
MakeStep::MakeStep(BuildStepList *bsl) :
|
2012-03-15 17:17:40 +01:00
|
|
|
AbstractProcessStep(bsl, Core::Id(MS_ID)), m_clean(false),
|
2010-01-14 17:41:29 +01:00
|
|
|
m_futureInterface(0)
|
2008-12-04 13:06:02 +01:00
|
|
|
{
|
2010-01-14 17:41:29 +01:00
|
|
|
ctor();
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-15 17:17:40 +01:00
|
|
|
MakeStep::MakeStep(BuildStepList *bsl, const Core::Id id) :
|
2010-07-16 14:00:41 +02:00
|
|
|
AbstractProcessStep(bsl, id), m_clean(false),
|
2010-01-14 17:41:29 +01:00
|
|
|
m_futureInterface(0)
|
|
|
|
|
{
|
|
|
|
|
ctor();
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
MakeStep::MakeStep(BuildStepList *bsl, MakeStep *bs) :
|
|
|
|
|
AbstractProcessStep(bsl, bs),
|
2009-10-27 14:16:28 +01:00
|
|
|
m_clean(bs->m_clean),
|
|
|
|
|
m_futureInterface(0),
|
|
|
|
|
m_buildTargets(bs->m_buildTargets),
|
2010-10-19 11:14:03 +02:00
|
|
|
m_additionalArguments(Utils::QtcProcess::joinArgs(bs->m_buildTargets))
|
2009-10-27 14:16:28 +01:00
|
|
|
{
|
2010-01-14 17:41:29 +01:00
|
|
|
ctor();
|
|
|
|
|
}
|
2009-10-27 14:16:28 +01:00
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
void MakeStep::ctor()
|
|
|
|
|
{
|
|
|
|
|
m_percentProgress = QRegExp("^\\[\\s*(\\d*)%\\]");
|
2010-08-19 12:26:21 +02:00
|
|
|
//: Default display name for the cmake make step.
|
|
|
|
|
setDefaultDisplayName(tr("Make"));
|
2009-10-27 14:16:28 +01:00
|
|
|
}
|
|
|
|
|
|
2008-12-04 13:06:02 +01:00
|
|
|
MakeStep::~MakeStep()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2009-11-26 14:43:27 +01:00
|
|
|
CMakeBuildConfiguration *MakeStep::cmakeBuildConfiguration() const
|
|
|
|
|
{
|
|
|
|
|
return static_cast<CMakeBuildConfiguration *>(buildConfiguration());
|
|
|
|
|
}
|
|
|
|
|
|
2009-10-15 19:06:51 +02:00
|
|
|
void MakeStep::setClean(bool clean)
|
|
|
|
|
{
|
|
|
|
|
m_clean = clean;
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
QVariantMap MakeStep::toMap() const
|
2009-10-15 19:06:51 +02:00
|
|
|
{
|
2010-01-14 17:41:29 +01:00
|
|
|
QVariantMap map(AbstractProcessStep::toMap());
|
|
|
|
|
map.insert(QLatin1String(CLEAN_KEY), m_clean);
|
|
|
|
|
map.insert(QLatin1String(BUILD_TARGETS_KEY), m_buildTargets);
|
|
|
|
|
map.insert(QLatin1String(ADDITIONAL_ARGUMENTS_KEY), m_additionalArguments);
|
|
|
|
|
return map;
|
2009-10-15 19:06:51 +02:00
|
|
|
}
|
|
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
bool MakeStep::fromMap(const QVariantMap &map)
|
2009-10-15 19:06:51 +02:00
|
|
|
{
|
2010-01-14 17:41:29 +01:00
|
|
|
m_clean = map.value(QLatin1String(CLEAN_KEY)).toBool();
|
|
|
|
|
m_buildTargets = map.value(QLatin1String(BUILD_TARGETS_KEY)).toStringList();
|
2010-10-19 11:14:03 +02:00
|
|
|
m_additionalArguments = map.value(QLatin1String(ADDITIONAL_ARGUMENTS_KEY)).toString();
|
2009-10-15 19:06:51 +02:00
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
return BuildStep::fromMap(map);
|
2009-10-15 19:06:51 +02:00
|
|
|
}
|
|
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
|
2009-10-27 14:16:28 +01:00
|
|
|
bool MakeStep::init()
|
2008-12-04 13:06:02 +01:00
|
|
|
{
|
2009-11-26 14:43:27 +01:00
|
|
|
CMakeBuildConfiguration *bc = cmakeBuildConfiguration();
|
2012-05-14 14:07:34 +02:00
|
|
|
if (!bc)
|
|
|
|
|
bc = static_cast<CMakeBuildConfiguration *>(target()->activeBuildConfiguration());
|
2009-02-16 13:12:12 +01:00
|
|
|
|
2010-10-19 11:14:03 +02:00
|
|
|
QString arguments = Utils::QtcProcess::joinArgs(m_buildTargets);
|
|
|
|
|
Utils::QtcProcess::addArgs(&arguments, additionalArguments());
|
2010-11-12 17:23:55 +01:00
|
|
|
|
2009-10-15 19:06:51 +02:00
|
|
|
setIgnoreReturnValue(m_clean);
|
2009-06-22 16:11:45 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
|
2010-11-12 17:23:55 +01:00
|
|
|
ProcessParameters *pp = processParameters();
|
|
|
|
|
pp->setMacroExpander(bc->macroExpander());
|
|
|
|
|
pp->setEnvironment(bc->environment());
|
|
|
|
|
pp->setWorkingDirectory(bc->buildDirectory());
|
2012-04-24 15:49:09 +02:00
|
|
|
if (tc)
|
|
|
|
|
pp->setCommand(tc->makeCommand());
|
2011-10-10 13:31:54 +02:00
|
|
|
else
|
|
|
|
|
pp->setCommand(QLatin1String("make"));
|
2010-11-12 17:23:55 +01:00
|
|
|
pp->setArguments(arguments);
|
|
|
|
|
|
2010-12-06 12:18:38 +01:00
|
|
|
setOutputParser(new ProjectExplorer::GnuMakeParser());
|
2012-04-24 15:49:09 +02:00
|
|
|
if (tc)
|
|
|
|
|
appendOutputParser(tc->outputParser());
|
2010-12-06 12:18:38 +01:00
|
|
|
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
|
2009-12-09 13:54:46 +01:00
|
|
|
|
|
|
|
|
return AbstractProcessStep::init();
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MakeStep::run(QFutureInterface<bool> &fi)
|
|
|
|
|
{
|
2009-04-07 13:52:28 +02:00
|
|
|
m_futureInterface = &fi;
|
|
|
|
|
m_futureInterface->setProgressRange(0, 100);
|
2009-12-09 13:54:46 +01:00
|
|
|
AbstractProcessStep::run(fi);
|
2009-05-25 17:09:38 +02:00
|
|
|
m_futureInterface->setProgressValue(100);
|
|
|
|
|
m_futureInterface->reportFinished();
|
2009-04-07 13:52:28 +02:00
|
|
|
m_futureInterface = 0;
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2009-10-27 14:16:28 +01:00
|
|
|
BuildStepConfigWidget *MakeStep::createConfigWidget()
|
2008-12-04 13:06:02 +01:00
|
|
|
{
|
2009-03-18 13:33:00 +01:00
|
|
|
return new MakeStepConfigWidget(this);
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MakeStep::immutable() const
|
|
|
|
|
{
|
2010-04-22 17:25:28 +02:00
|
|
|
return false;
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2010-04-01 15:14:38 +02:00
|
|
|
void MakeStep::stdOutput(const QString &line)
|
2009-02-16 13:12:12 +01:00
|
|
|
{
|
2009-04-07 13:52:28 +02:00
|
|
|
if (m_percentProgress.indexIn(line) != -1) {
|
|
|
|
|
bool ok = false;
|
|
|
|
|
int percent = m_percentProgress.cap(1).toInt(&ok);;
|
|
|
|
|
if (ok)
|
|
|
|
|
m_futureInterface->setProgressValue(percent);
|
|
|
|
|
}
|
2009-12-09 13:54:46 +01:00
|
|
|
AbstractProcessStep::stdOutput(line);
|
2009-02-16 13:12:12 +01:00
|
|
|
}
|
|
|
|
|
|
2011-10-21 23:17:58 +02:00
|
|
|
QStringList MakeStep::buildTargets() const
|
|
|
|
|
{
|
|
|
|
|
return m_buildTargets;
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-02 12:01:11 +01:00
|
|
|
bool MakeStep::buildsBuildTarget(const QString &target) const
|
2009-01-12 15:10:33 +01:00
|
|
|
{
|
2009-10-27 14:16:28 +01:00
|
|
|
return m_buildTargets.contains(target);
|
2009-01-12 15:10:33 +01:00
|
|
|
}
|
|
|
|
|
|
2010-02-02 12:01:11 +01:00
|
|
|
void MakeStep::setBuildTarget(const QString &buildTarget, bool on)
|
2009-01-12 15:10:33 +01:00
|
|
|
{
|
2009-10-27 14:16:28 +01:00
|
|
|
QStringList old = m_buildTargets;
|
2010-02-02 12:01:11 +01:00
|
|
|
if (on && !old.contains(buildTarget))
|
|
|
|
|
old << buildTarget;
|
2011-12-01 14:03:15 +01:00
|
|
|
else if (!on && old.contains(buildTarget))
|
2010-02-02 12:01:11 +01:00
|
|
|
old.removeOne(buildTarget);
|
2009-10-27 14:16:28 +01:00
|
|
|
m_buildTargets = old;
|
2009-01-12 15:10:33 +01:00
|
|
|
}
|
|
|
|
|
|
2011-10-21 23:17:58 +02:00
|
|
|
void MakeStep::setBuildTargets(const QStringList &targets)
|
|
|
|
|
{
|
|
|
|
|
m_buildTargets = targets;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MakeStep::clearBuildTargets()
|
|
|
|
|
{
|
|
|
|
|
m_buildTargets.clear();
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-19 11:14:03 +02:00
|
|
|
QString MakeStep::additionalArguments() const
|
2009-03-12 15:51:44 +01:00
|
|
|
{
|
2009-10-27 14:16:28 +01:00
|
|
|
return m_additionalArguments;
|
2009-03-12 15:51:44 +01:00
|
|
|
}
|
|
|
|
|
|
2010-10-19 11:14:03 +02:00
|
|
|
void MakeStep::setAdditionalArguments(const QString &list)
|
2009-03-12 15:51:44 +01:00
|
|
|
{
|
2009-10-27 14:16:28 +01:00
|
|
|
m_additionalArguments = list;
|
2009-03-12 15:51:44 +01:00
|
|
|
}
|
|
|
|
|
|
2008-12-04 13:06:02 +01:00
|
|
|
//
|
2009-03-18 13:33:00 +01:00
|
|
|
// MakeStepConfigWidget
|
2008-12-04 13:06:02 +01:00
|
|
|
//
|
2009-03-12 15:51:44 +01:00
|
|
|
|
2009-03-18 13:33:00 +01:00
|
|
|
MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
|
2009-01-12 15:10:33 +01:00
|
|
|
: m_makeStep(makeStep)
|
|
|
|
|
{
|
|
|
|
|
QFormLayout *fl = new QFormLayout(this);
|
2009-07-23 17:00:38 +02:00
|
|
|
fl->setMargin(0);
|
|
|
|
|
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
2009-01-12 15:10:33 +01:00
|
|
|
setLayout(fl);
|
|
|
|
|
|
2009-03-12 15:51:44 +01:00
|
|
|
m_additionalArguments = new QLineEdit(this);
|
2009-04-17 21:11:52 +02:00
|
|
|
fl->addRow(tr("Additional arguments:"), m_additionalArguments);
|
2011-05-30 13:30:10 +02:00
|
|
|
m_additionalArguments->setText(m_makeStep->additionalArguments());
|
2009-03-12 15:51:44 +01:00
|
|
|
|
2010-02-02 12:01:11 +01:00
|
|
|
m_buildTargetsList = new QListWidget;
|
|
|
|
|
m_buildTargetsList->setMinimumHeight(200);
|
|
|
|
|
fl->addRow(tr("Targets:"), m_buildTargetsList);
|
2009-01-12 15:10:33 +01:00
|
|
|
|
|
|
|
|
// TODO update this list also on rescans of the CMakeLists.txt
|
2012-03-28 13:18:25 +02:00
|
|
|
CMakeProject *pro = static_cast<CMakeProject *>(m_makeStep->target()->project());
|
2011-12-01 14:03:15 +01:00
|
|
|
foreach (const QString& buildTarget, pro->buildTargetTitles()) {
|
2010-02-02 12:01:11 +01:00
|
|
|
QListWidgetItem *item = new QListWidgetItem(buildTarget, m_buildTargetsList);
|
2009-01-12 15:10:33 +01:00
|
|
|
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
2011-05-30 13:30:10 +02:00
|
|
|
item->setCheckState(m_makeStep->buildsBuildTarget(item->text()) ? Qt::Checked : Qt::Unchecked);
|
2009-01-12 15:10:33 +01:00
|
|
|
}
|
2009-03-12 15:51:44 +01:00
|
|
|
|
2011-05-30 13:30:10 +02:00
|
|
|
updateDetails();
|
|
|
|
|
|
2012-03-05 22:30:59 +01:00
|
|
|
connect(m_additionalArguments, SIGNAL(textEdited(QString)), this, SLOT(additionalArgumentsEdited()));
|
2010-02-02 12:01:11 +01:00
|
|
|
connect(m_buildTargetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
|
2009-08-12 17:02:28 +02:00
|
|
|
connect(ProjectExplorer::ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
|
|
|
|
|
this, SLOT(updateDetails()));
|
2011-05-30 13:30:10 +02:00
|
|
|
|
|
|
|
|
connect(pro, SIGNAL(buildTargetsChanged()),
|
|
|
|
|
this, SLOT(buildTargetsChanged()));
|
2009-01-12 15:10:33 +01:00
|
|
|
}
|
|
|
|
|
|
2009-03-18 13:33:00 +01:00
|
|
|
void MakeStepConfigWidget::additionalArgumentsEdited()
|
2009-03-12 15:51:44 +01:00
|
|
|
{
|
2010-10-19 11:14:03 +02:00
|
|
|
m_makeStep->setAdditionalArguments(m_additionalArguments->text());
|
2009-08-06 17:26:38 +02:00
|
|
|
updateDetails();
|
2009-03-12 15:51:44 +01:00
|
|
|
}
|
|
|
|
|
|
2009-03-18 13:33:00 +01:00
|
|
|
void MakeStepConfigWidget::itemChanged(QListWidgetItem *item)
|
2009-01-12 15:10:33 +01:00
|
|
|
{
|
2009-10-27 14:16:28 +01:00
|
|
|
m_makeStep->setBuildTarget(item->text(), item->checkState() & Qt::Checked);
|
2009-08-06 17:26:38 +02:00
|
|
|
updateDetails();
|
2009-01-12 15:10:33 +01:00
|
|
|
}
|
2008-12-04 13:06:02 +01:00
|
|
|
|
2009-03-18 13:33:00 +01:00
|
|
|
QString MakeStepConfigWidget::displayName() const
|
2008-12-04 13:06:02 +01:00
|
|
|
{
|
2010-01-14 17:41:29 +01:00
|
|
|
return tr("Make", "CMakeProjectManager::MakeStepConfigWidget display name.");
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2010-02-02 12:01:11 +01:00
|
|
|
void MakeStepConfigWidget::buildTargetsChanged()
|
2009-12-03 19:45:09 +01:00
|
|
|
{
|
2010-02-02 12:01:11 +01:00
|
|
|
disconnect(m_buildTargetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
|
|
|
|
|
m_buildTargetsList->clear();
|
2012-03-28 13:18:25 +02:00
|
|
|
CMakeProject *pro = static_cast<CMakeProject *>(m_makeStep->target()->project());
|
2011-12-01 14:03:15 +01:00
|
|
|
foreach (const QString& buildTarget, pro->buildTargetTitles()) {
|
2010-02-02 12:01:11 +01:00
|
|
|
QListWidgetItem *item = new QListWidgetItem(buildTarget, m_buildTargetsList);
|
2009-12-03 19:45:09 +01:00
|
|
|
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
2010-02-02 12:01:11 +01:00
|
|
|
item->setCheckState(m_makeStep->buildsBuildTarget(item->text()) ? Qt::Checked : Qt::Unchecked);
|
2009-12-03 19:45:09 +01:00
|
|
|
}
|
2010-02-02 12:01:11 +01:00
|
|
|
connect(m_buildTargetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
|
2009-12-03 19:45:09 +01:00
|
|
|
updateSummary();
|
2009-08-06 17:26:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MakeStepConfigWidget::updateDetails()
|
|
|
|
|
{
|
2009-11-26 14:43:27 +01:00
|
|
|
CMakeBuildConfiguration *bc = m_makeStep->cmakeBuildConfiguration();
|
2012-03-28 13:18:25 +02:00
|
|
|
if (!bc)
|
|
|
|
|
bc = static_cast<CMakeBuildConfiguration *>(m_makeStep->target()->activeBuildConfiguration());
|
2012-04-24 15:49:09 +02:00
|
|
|
if (!bc) {
|
|
|
|
|
m_summaryText = tr("<b>No build configuration found on this target.</b>");
|
|
|
|
|
updateSummary();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(m_makeStep->target()->kit());
|
2010-11-12 17:23:55 +01:00
|
|
|
if (tc) {
|
2012-05-03 16:05:03 +02:00
|
|
|
QString arguments = Utils::QtcProcess::joinArgs(m_makeStep->buildTargets());
|
2010-11-12 17:23:55 +01:00
|
|
|
Utils::QtcProcess::addArgs(&arguments, m_makeStep->additionalArguments());
|
|
|
|
|
|
|
|
|
|
ProcessParameters param;
|
|
|
|
|
param.setMacroExpander(bc->macroExpander());
|
|
|
|
|
param.setEnvironment(bc->environment());
|
|
|
|
|
param.setWorkingDirectory(bc->buildDirectory());
|
|
|
|
|
param.setCommand(tc->makeCommand());
|
|
|
|
|
param.setArguments(arguments);
|
|
|
|
|
m_summaryText = param.summary(displayName());
|
|
|
|
|
} else {
|
2012-09-03 18:31:44 +02:00
|
|
|
m_summaryText = QLatin1String("<b>") + ProjectExplorer::ToolChainKitInformation::msgNoToolChainInTarget() + QLatin1String("</b>");
|
2010-11-12 17:23:55 +01:00
|
|
|
}
|
2009-08-06 17:26:38 +02:00
|
|
|
emit updateSummary();
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2009-08-06 15:31:32 +02:00
|
|
|
QString MakeStepConfigWidget::summaryText() const
|
|
|
|
|
{
|
2009-08-06 17:26:38 +02:00
|
|
|
return m_summaryText;
|
2009-08-06 15:31:32 +02:00
|
|
|
}
|
|
|
|
|
|
2008-12-04 13:06:02 +01:00
|
|
|
//
|
2009-03-18 13:33:00 +01:00
|
|
|
// MakeStepFactory
|
2008-12-04 13:06:02 +01:00
|
|
|
//
|
|
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
MakeStepFactory::MakeStepFactory(QObject *parent) :
|
|
|
|
|
ProjectExplorer::IBuildStepFactory(parent)
|
2008-12-04 13:06:02 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
MakeStepFactory::~MakeStepFactory()
|
2008-12-04 13:06:02 +01:00
|
|
|
{
|
2009-10-27 14:16:28 +01:00
|
|
|
}
|
|
|
|
|
|
2012-03-15 17:17:40 +01:00
|
|
|
bool MakeStepFactory::canCreate(BuildStepList *parent, const Core::Id id) const
|
2009-10-27 14:16:28 +01:00
|
|
|
{
|
2012-08-03 15:24:33 +02:00
|
|
|
if (parent->target()->project()->id() == Constants::CMAKEPROJECT_ID)
|
|
|
|
|
return id == MS_ID;
|
|
|
|
|
return false;
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2012-03-15 17:17:40 +01:00
|
|
|
BuildStep *MakeStepFactory::create(BuildStepList *parent, const Core::Id id)
|
2008-12-04 13:06:02 +01:00
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
if (!canCreate(parent, id))
|
2010-01-14 17:41:29 +01:00
|
|
|
return 0;
|
2011-11-24 12:42:52 +01:00
|
|
|
MakeStep *step = new MakeStep(parent);
|
2012-08-03 15:24:33 +02:00
|
|
|
if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) {
|
2011-11-24 12:42:52 +01:00
|
|
|
step->setClean(true);
|
|
|
|
|
step->setAdditionalArguments("clean");
|
|
|
|
|
}
|
|
|
|
|
return step;
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
bool MakeStepFactory::canClone(BuildStepList *parent, BuildStep *source) const
|
2010-01-14 17:41:29 +01:00
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
return canCreate(parent, source->id());
|
2010-01-14 17:41:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
BuildStep *MakeStepFactory::clone(BuildStepList *parent, BuildStep *source)
|
2010-01-14 17:41:29 +01:00
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
if (!canClone(parent, source))
|
2010-01-14 17:41:29 +01:00
|
|
|
return 0;
|
|
|
|
|
return new MakeStep(parent, static_cast<MakeStep *>(source));
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
bool MakeStepFactory::canRestore(BuildStepList *parent, const QVariantMap &map) const
|
2008-12-04 13:06:02 +01:00
|
|
|
{
|
2012-03-15 17:17:40 +01:00
|
|
|
return canCreate(parent, idFromMap(map));
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
BuildStep *MakeStepFactory::restore(BuildStepList *parent, const QVariantMap &map)
|
2010-01-14 17:41:29 +01:00
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
if (!canRestore(parent, map))
|
2010-01-14 17:41:29 +01:00
|
|
|
return 0;
|
|
|
|
|
MakeStep *bs(new MakeStep(parent));
|
|
|
|
|
if (bs->fromMap(map))
|
|
|
|
|
return bs;
|
|
|
|
|
delete bs;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-15 17:17:40 +01:00
|
|
|
QList<Core::Id> MakeStepFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const
|
2010-01-14 17:41:29 +01:00
|
|
|
{
|
2012-08-03 15:24:33 +02:00
|
|
|
if (parent->target()->project()->id() == Constants::CMAKEPROJECT_ID)
|
2012-03-15 17:17:40 +01:00
|
|
|
return QList<Core::Id>() << Core::Id(MS_ID);
|
|
|
|
|
return QList<Core::Id>();
|
2010-01-14 17:41:29 +01:00
|
|
|
}
|
|
|
|
|
|
2012-03-15 17:17:40 +01:00
|
|
|
QString MakeStepFactory::displayNameForId(const Core::Id id) const
|
2010-01-14 17:41:29 +01:00
|
|
|
{
|
2012-08-03 15:24:33 +02:00
|
|
|
if (id == MS_ID)
|
2010-01-14 17:41:29 +01:00
|
|
|
return tr("Make", "Display name for CMakeProjectManager::MakeStep id.");
|
|
|
|
|
return QString();
|
|
|
|
|
}
|