2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-04 13:06:02 +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-04 13:06:02 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-04 13:06:02 +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-04 13:06:02 +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-01-14 17:41:29 +01:00
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
#include "cmakebuildstep.h"
|
2010-01-14 17:41:29 +01:00
|
|
|
|
2013-07-10 21:43:49 +03:00
|
|
|
#include "cmakebuildconfiguration.h"
|
2016-01-07 13:15:29 +01:00
|
|
|
#include "cmakekitinformation.h"
|
2013-07-10 21:43:49 +03:00
|
|
|
#include "cmakeparser.h"
|
2008-12-04 13:06:02 +01:00
|
|
|
#include "cmakeprojectconstants.h"
|
|
|
|
|
#include "cmakeproject.h"
|
2015-11-26 19:50:39 +01:00
|
|
|
#include "cmakerunconfiguration.h"
|
2016-01-07 13:15:29 +01:00
|
|
|
#include "cmaketool.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>
|
2016-02-12 12:34:35 +01:00
|
|
|
#include <projectexplorer/gnumakeparser.h>
|
2012-09-03 18:31:44 +02:00
|
|
|
#include <projectexplorer/kitinformation.h>
|
2011-11-24 12:42:52 +01:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2013-07-10 21:43:49 +03:00
|
|
|
#include <projectexplorer/projectexplorer.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
|
|
|
|
2012-09-26 17:53:25 +02:00
|
|
|
#include <qtsupport/qtkitinformation.h>
|
|
|
|
|
#include <qtsupport/qtparser.h>
|
|
|
|
|
|
2014-08-04 12:16:04 +02:00
|
|
|
#include <coreplugin/find/itemviewfind.h>
|
|
|
|
|
|
2016-01-07 12:39:48 +01:00
|
|
|
#include <utils/algorithm.h>
|
2010-10-19 11:14:03 +02:00
|
|
|
#include <utils/qtcprocess.h>
|
2014-10-02 17:51:02 +02:00
|
|
|
#include <utils/pathchooser.h>
|
2010-10-19 11:14:03 +02:00
|
|
|
|
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 {
|
2016-01-07 12:09:59 +01:00
|
|
|
const char CLEAN_KEY[] = "CMakeProjectManager.MakeStep.Clean"; // Obsolete since QtC 3.7
|
2012-08-03 15:24:33 +02:00
|
|
|
const char BUILD_TARGETS_KEY[] = "CMakeProjectManager.MakeStep.BuildTargets";
|
2016-01-07 13:15:29 +01:00
|
|
|
const char TOOL_ARGUMENTS_KEY[] = "CMakeProjectManager.MakeStep.AdditionalArguments";
|
2015-11-26 19:50:39 +01:00
|
|
|
const char ADD_RUNCONFIGURATION_ARGUMENT_KEY[] = "CMakeProjectManager.MakeStep.AddRunConfigurationArgument";
|
|
|
|
|
const char ADD_RUNCONFIGURATION_TEXT[] = "Current executable";
|
2010-01-14 17:41:29 +01:00
|
|
|
}
|
|
|
|
|
|
2016-04-22 15:54:16 +02:00
|
|
|
static bool isCurrentExecutableTarget(const QString &target)
|
|
|
|
|
{
|
2017-06-12 14:23:34 +02:00
|
|
|
return target == ADD_RUNCONFIGURATION_TEXT;
|
2016-04-22 15:54:16 +02:00
|
|
|
}
|
|
|
|
|
|
2016-11-14 15:18:25 +01:00
|
|
|
CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl) :
|
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
|
|
|
AbstractProcessStep(bsl, Constants::CMAKE_BUILD_STEP_ID)
|
2010-01-14 17:41:29 +01:00
|
|
|
{
|
2017-06-12 14:23:34 +02:00
|
|
|
m_percentProgress = QRegExp("^\\[\\s*(\\d*)%\\]");
|
|
|
|
|
m_ninjaProgress = QRegExp("^\\[\\s*(\\d*)/\\s*(\\d*)");
|
|
|
|
|
m_ninjaProgressString = "[%f/%t "; // ninja: [33/100
|
2010-08-19 12:26:21 +02:00
|
|
|
//: Default display name for the cmake make step.
|
2016-11-14 15:18:25 +01:00
|
|
|
setDefaultDisplayName(tr("CMake Build"));
|
2012-10-02 17:46:12 +02:00
|
|
|
|
2016-02-24 18:00:24 +01:00
|
|
|
auto bc = qobject_cast<CMakeBuildConfiguration *>(bsl->parent());
|
|
|
|
|
if (!bc) {
|
|
|
|
|
auto t = qobject_cast<Target *>(bsl->parent()->parent());
|
|
|
|
|
QTC_ASSERT(t, return);
|
|
|
|
|
bc = qobject_cast<CMakeBuildConfiguration *>(t->activeBuildConfiguration());
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-26 15:34:04 +02:00
|
|
|
// Set a good default build target:
|
|
|
|
|
if (m_buildTarget.isEmpty()) {
|
|
|
|
|
if (bsl->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN)
|
|
|
|
|
setBuildTarget(cleanTarget());
|
|
|
|
|
else if (bsl->id() == ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
|
|
|
|
|
setBuildTarget(installTarget());
|
|
|
|
|
else
|
|
|
|
|
setBuildTarget(allTarget());
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-07 13:15:29 +01:00
|
|
|
connect(target(), &Target::kitChanged, this, &CMakeBuildStep::cmakeCommandChanged);
|
2017-07-18 16:48:02 +02:00
|
|
|
connect(project(), &Project::parsingFinished,
|
|
|
|
|
this, &CMakeBuildStep::handleBuildTargetChanges);
|
2009-10-27 14:16:28 +01:00
|
|
|
}
|
|
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
CMakeBuildConfiguration *CMakeBuildStep::cmakeBuildConfiguration() const
|
2009-11-26 14:43:27 +01:00
|
|
|
{
|
|
|
|
|
return static_cast<CMakeBuildConfiguration *>(buildConfiguration());
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
CMakeBuildConfiguration *CMakeBuildStep::targetsActiveBuildConfiguration() const
|
2012-10-02 17:46:12 +02:00
|
|
|
{
|
|
|
|
|
return static_cast<CMakeBuildConfiguration *>(target()->activeBuildConfiguration());
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
CMakeRunConfiguration *CMakeBuildStep::targetsActiveRunConfiguration() const
|
2015-11-26 19:50:39 +01:00
|
|
|
{
|
|
|
|
|
return qobject_cast<CMakeRunConfiguration *>(target()->activeRunConfiguration());
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-24 18:00:24 +01:00
|
|
|
void CMakeBuildStep::handleBuildTargetChanges()
|
2013-08-26 16:01:24 +02:00
|
|
|
{
|
2016-04-22 15:54:16 +02:00
|
|
|
if (isCurrentExecutableTarget(m_buildTarget))
|
|
|
|
|
return; // Do not change just because a different set of build targets is there...
|
|
|
|
|
if (!static_cast<CMakeProject *>(project())->buildTargetTitles().contains(m_buildTarget))
|
2017-04-26 15:27:01 +02:00
|
|
|
setBuildTarget(allTarget());
|
2016-02-24 18:00:24 +01:00
|
|
|
emit buildTargetsChanged();
|
2013-08-26 16:01:24 +02:00
|
|
|
}
|
|
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
QVariantMap CMakeBuildStep::toMap() const
|
2009-10-15 19:06:51 +02:00
|
|
|
{
|
2010-01-14 17:41:29 +01:00
|
|
|
QVariantMap map(AbstractProcessStep::toMap());
|
2016-03-30 13:06:21 +02:00
|
|
|
// Use QStringList for compatibility with old files
|
2017-06-12 14:23:34 +02:00
|
|
|
map.insert(BUILD_TARGETS_KEY, QStringList(m_buildTarget));
|
|
|
|
|
map.insert(TOOL_ARGUMENTS_KEY, m_toolArguments);
|
2010-01-14 17:41:29 +01:00
|
|
|
return map;
|
2009-10-15 19:06:51 +02:00
|
|
|
}
|
|
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
bool CMakeBuildStep::fromMap(const QVariantMap &map)
|
2009-10-15 19:06:51 +02:00
|
|
|
{
|
2017-06-12 14:23:34 +02:00
|
|
|
if (map.value(CLEAN_KEY, false).toBool()) {
|
2016-03-30 13:06:21 +02:00
|
|
|
m_buildTarget = CMakeBuildStep::cleanTarget();
|
2016-01-07 12:09:59 +01:00
|
|
|
} else {
|
2017-06-12 14:23:34 +02:00
|
|
|
const QStringList targetList = map.value(BUILD_TARGETS_KEY).toStringList();
|
2016-03-30 13:06:21 +02:00
|
|
|
if (!targetList.isEmpty())
|
|
|
|
|
m_buildTarget = targetList.last();
|
2017-06-12 14:23:34 +02:00
|
|
|
m_toolArguments = map.value(TOOL_ARGUMENTS_KEY).toString();
|
2016-01-07 12:09:59 +01:00
|
|
|
}
|
2017-06-12 14:23:34 +02:00
|
|
|
if (map.value(ADD_RUNCONFIGURATION_ARGUMENT_KEY, false).toBool())
|
|
|
|
|
m_buildTarget = ADD_RUNCONFIGURATION_TEXT;
|
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
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
bool CMakeBuildStep::init(QList<const BuildStep *> &earlierSteps)
|
2008-12-04 13:06:02 +01:00
|
|
|
{
|
2016-01-07 13:15:29 +01:00
|
|
|
bool canInit = true;
|
2009-11-26 14:43:27 +01:00
|
|
|
CMakeBuildConfiguration *bc = cmakeBuildConfiguration();
|
2012-05-14 14:07:34 +02:00
|
|
|
if (!bc)
|
2014-04-03 16:29:37 +02:00
|
|
|
bc = targetsActiveBuildConfiguration();
|
2016-01-07 13:15:29 +01:00
|
|
|
if (!bc) {
|
2014-06-20 14:32:40 +02:00
|
|
|
emit addTask(Task::buildConfigurationMissingTask());
|
2016-01-07 13:15:29 +01:00
|
|
|
canInit = false;
|
|
|
|
|
}
|
2017-05-02 16:29:56 +02:00
|
|
|
if (bc && !bc->isEnabled()) {
|
2017-04-24 13:37:55 +02:00
|
|
|
emit addTask(Task(Task::Error,
|
|
|
|
|
QCoreApplication::translate("CMakeProjectManager::CMakeBuildStep",
|
|
|
|
|
"The build configuration is currently disabled."),
|
|
|
|
|
Utils::FileName(), -1, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
|
|
|
|
canInit = false;
|
|
|
|
|
}
|
2016-01-07 13:15:29 +01:00
|
|
|
|
|
|
|
|
CMakeTool *tool = CMakeKitInformation::cmakeTool(target()->kit());
|
|
|
|
|
if (!tool || !tool->isValid()) {
|
|
|
|
|
emit addTask(Task(Task::Error,
|
2017-08-29 11:48:48 +02:00
|
|
|
tr("A CMake tool must be set up for building. "
|
|
|
|
|
"Configure a CMake tool in the kit options."),
|
2016-01-07 13:15:29 +01:00
|
|
|
Utils::FileName(), -1,
|
|
|
|
|
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
|
|
|
|
canInit = false;
|
|
|
|
|
}
|
2009-02-16 13:12:12 +01:00
|
|
|
|
2016-01-07 13:15:29 +01:00
|
|
|
CMakeRunConfiguration *rc = targetsActiveRunConfiguration();
|
2017-04-24 13:25:01 +02:00
|
|
|
if (isCurrentExecutableTarget(m_buildTarget) && (!rc || rc->buildSystemTarget().isEmpty())) {
|
2016-01-07 13:15:29 +01:00
|
|
|
emit addTask(Task(Task::Error,
|
|
|
|
|
QCoreApplication::translate("ProjectExplorer::Task",
|
2016-01-11 11:40:24 +01:00
|
|
|
"You asked to build the current Run Configuration's build target only, "
|
|
|
|
|
"but it is not associated with a build target. "
|
|
|
|
|
"Update the Make Step in your build settings."),
|
2016-01-07 13:15:29 +01:00
|
|
|
Utils::FileName(), -1,
|
|
|
|
|
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
|
|
|
|
canInit = false;
|
|
|
|
|
}
|
2014-04-03 16:29:37 +02:00
|
|
|
|
2016-01-07 13:15:29 +01:00
|
|
|
if (!canInit) {
|
2014-06-20 14:32:40 +02:00
|
|
|
emitFaultyConfigurationMessage();
|
2014-04-03 15:37:02 +02:00
|
|
|
return false;
|
2012-09-06 13:13:12 +02:00
|
|
|
}
|
|
|
|
|
|
2017-06-22 13:53:48 +02:00
|
|
|
// Warn if doing out-of-source builds with a CMakeCache.txt is the source directory
|
|
|
|
|
const Utils::FileName projectDirectory = bc->target()->project()->projectDirectory();
|
|
|
|
|
if (bc->buildDirectory() != projectDirectory) {
|
|
|
|
|
Utils::FileName cmc = projectDirectory;
|
|
|
|
|
cmc.appendPath("CMakeCache.txt");
|
|
|
|
|
if (cmc.exists()) {
|
|
|
|
|
emit addTask(Task(Task::Warning,
|
|
|
|
|
tr("There is a CMakeCache.txt file in \"%1\", which suggest an "
|
|
|
|
|
"in-source build was done before. You are now building in \"%2\", "
|
|
|
|
|
"and the CMakeCache.txt file might confuse CMake.")
|
|
|
|
|
.arg(projectDirectory.toUserOutput(), bc->buildDirectory().toUserOutput()),
|
|
|
|
|
Utils::FileName(), -1,
|
|
|
|
|
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-07 13:15:29 +01:00
|
|
|
QString arguments = allArguments(rc);
|
2010-11-12 17:23:55 +01:00
|
|
|
|
2016-03-30 13:06:21 +02:00
|
|
|
setIgnoreReturnValue(m_buildTarget == CMakeBuildStep::cleanTarget());
|
2009-06-22 16:11:45 +02:00
|
|
|
|
2010-11-12 17:23:55 +01:00
|
|
|
ProcessParameters *pp = processParameters();
|
|
|
|
|
pp->setMacroExpander(bc->macroExpander());
|
2012-11-21 12:04:39 +01:00
|
|
|
Utils::Environment env = bc->environment();
|
2016-04-07 13:06:01 +02:00
|
|
|
Utils::Environment::setupEnglishOutput(&env);
|
2017-06-12 14:23:34 +02:00
|
|
|
if (!env.value("NINJA_STATUS").startsWith(m_ninjaProgressString))
|
|
|
|
|
env.set("NINJA_STATUS", m_ninjaProgressString + "%o/sec] ");
|
2012-11-21 12:04:39 +01:00
|
|
|
pp->setEnvironment(env);
|
2013-08-16 17:45:16 +02:00
|
|
|
pp->setWorkingDirectory(bc->buildDirectory().toString());
|
2016-01-07 13:15:29 +01:00
|
|
|
pp->setCommand(cmakeCommand());
|
2010-11-12 17:23:55 +01:00
|
|
|
pp->setArguments(arguments);
|
2012-11-28 15:29:55 +01:00
|
|
|
pp->resolveAll();
|
2010-11-12 17:23:55 +01:00
|
|
|
|
2016-02-12 12:34:35 +01:00
|
|
|
setOutputParser(new CMakeParser);
|
|
|
|
|
appendOutputParser(new GnuMakeParser);
|
2012-11-02 12:45:09 +01:00
|
|
|
IOutputParser *parser = target()->kit()->createOutputParser();
|
|
|
|
|
if (parser)
|
|
|
|
|
appendOutputParser(parser);
|
2010-12-06 12:18:38 +01:00
|
|
|
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
|
2009-12-09 13:54:46 +01:00
|
|
|
|
2015-11-13 12:19:35 +01:00
|
|
|
return AbstractProcessStep::init(earlierSteps);
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2016-02-25 14:18:05 +01:00
|
|
|
void CMakeBuildStep::run(QFutureInterface<bool> &fi)
|
|
|
|
|
{
|
|
|
|
|
// Make sure CMake state was written to disk before trying to build:
|
|
|
|
|
CMakeBuildConfiguration *bc = cmakeBuildConfiguration();
|
|
|
|
|
if (!bc)
|
2017-04-24 13:26:58 +02:00
|
|
|
bc = targetsActiveBuildConfiguration();
|
2016-02-25 14:18:05 +01:00
|
|
|
QTC_ASSERT(bc, return);
|
|
|
|
|
|
2016-10-06 15:55:55 +02:00
|
|
|
bool mustDelay = false;
|
2017-09-28 11:32:39 +02:00
|
|
|
auto p = static_cast<CMakeProject *>(bc->project());
|
|
|
|
|
if (p->persistCMakeState()) {
|
2017-01-12 10:59:12 +01:00
|
|
|
emit addOutput(tr("Persisting CMake state..."), BuildStep::OutputFormat::NormalMessage);
|
2016-10-06 15:55:55 +02:00
|
|
|
mustDelay = true;
|
2017-09-28 11:32:39 +02:00
|
|
|
} else if (p->mustUpdateCMakeStateBeforeBuild()) {
|
2017-01-12 10:59:12 +01:00
|
|
|
emit addOutput(tr("Running CMake in preparation to build..."), BuildStep::OutputFormat::NormalMessage);
|
2016-10-06 15:55:55 +02:00
|
|
|
mustDelay = true;
|
|
|
|
|
} else {
|
|
|
|
|
mustDelay = false;
|
|
|
|
|
}
|
2016-02-25 14:18:05 +01:00
|
|
|
|
2016-10-06 15:55:55 +02:00
|
|
|
if (mustDelay) {
|
2017-07-18 16:48:02 +02:00
|
|
|
m_runTrigger = connect(project(), &Project::parsingFinished,
|
|
|
|
|
this, [this, &fi](bool success) { handleProjectWasParsed(fi, success); });
|
2016-02-25 14:18:05 +01:00
|
|
|
} else {
|
|
|
|
|
runImpl(fi);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CMakeBuildStep::runImpl(QFutureInterface<bool> &fi)
|
|
|
|
|
{
|
|
|
|
|
// Do the actual build:
|
2017-06-19 17:29:35 +02:00
|
|
|
AbstractProcessStep::run(fi);
|
|
|
|
|
}
|
|
|
|
|
|
2017-07-18 16:48:02 +02:00
|
|
|
void CMakeBuildStep::handleProjectWasParsed(QFutureInterface<bool> &fi, bool success)
|
2017-06-19 17:29:35 +02:00
|
|
|
{
|
2016-02-25 14:18:05 +01:00
|
|
|
disconnect(m_runTrigger);
|
2017-07-18 16:48:02 +02:00
|
|
|
if (success) {
|
|
|
|
|
runImpl(fi);
|
|
|
|
|
} else {
|
2017-10-20 14:58:40 +02:00
|
|
|
AbstractProcessStep::stdError(tr("Project did not parse successfully, cannot build."));
|
2017-07-18 16:48:02 +02:00
|
|
|
reportRunResult(fi, false);
|
|
|
|
|
}
|
2016-02-25 14:18:05 +01:00
|
|
|
}
|
|
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
BuildStepConfigWidget *CMakeBuildStep::createConfigWidget()
|
2008-12-04 13:06:02 +01:00
|
|
|
{
|
2016-01-07 12:33:52 +01:00
|
|
|
return new CMakeBuildStepConfigWidget(this);
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
bool CMakeBuildStep::immutable() const
|
2008-12-04 13:06:02 +01:00
|
|
|
{
|
2010-04-22 17:25:28 +02:00
|
|
|
return false;
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
void CMakeBuildStep::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) {
|
2016-03-20 12:15:04 +02:00
|
|
|
AbstractProcessStep::stdOutput(line);
|
2009-04-07 13:52:28 +02:00
|
|
|
bool ok = false;
|
2013-09-03 18:48:02 +02:00
|
|
|
int percent = m_percentProgress.cap(1).toInt(&ok);
|
2009-04-07 13:52:28 +02:00
|
|
|
if (ok)
|
2013-02-15 16:18:49 +01:00
|
|
|
futureInterface()->setProgressValue(percent);
|
2016-03-11 11:02:43 +01:00
|
|
|
return;
|
2012-10-02 17:46:12 +02:00
|
|
|
} else if (m_ninjaProgress.indexIn(line) != -1) {
|
2016-03-20 12:15:04 +02:00
|
|
|
AbstractProcessStep::stdOutput(line);
|
2016-01-07 13:15:29 +01:00
|
|
|
m_useNinja = true;
|
2012-10-02 17:46:12 +02:00
|
|
|
bool ok = false;
|
|
|
|
|
int done = m_ninjaProgress.cap(1).toInt(&ok);
|
|
|
|
|
if (ok) {
|
|
|
|
|
int all = m_ninjaProgress.cap(2).toInt(&ok);
|
|
|
|
|
if (ok && all != 0) {
|
2016-10-07 09:26:41 +02:00
|
|
|
const int percent = static_cast<int>(100.0 * done/all);
|
2013-02-15 16:18:49 +01:00
|
|
|
futureInterface()->setProgressValue(percent);
|
2012-10-02 17:46:12 +02:00
|
|
|
}
|
|
|
|
|
}
|
2016-03-11 11:02:43 +01:00
|
|
|
return;
|
2009-04-07 13:52:28 +02:00
|
|
|
}
|
2012-10-02 17:46:12 +02:00
|
|
|
if (m_useNinja)
|
|
|
|
|
AbstractProcessStep::stdError(line);
|
|
|
|
|
else
|
|
|
|
|
AbstractProcessStep::stdOutput(line);
|
2009-02-16 13:12:12 +01:00
|
|
|
}
|
|
|
|
|
|
2016-03-30 13:06:21 +02:00
|
|
|
QString CMakeBuildStep::buildTarget() const
|
2011-10-21 23:17:58 +02:00
|
|
|
{
|
2016-03-30 13:06:21 +02:00
|
|
|
return m_buildTarget;
|
2011-10-21 23:17:58 +02:00
|
|
|
}
|
|
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
bool CMakeBuildStep::buildsBuildTarget(const QString &target) const
|
2009-01-12 15:10:33 +01:00
|
|
|
{
|
2016-03-30 13:06:21 +02:00
|
|
|
return target == m_buildTarget;
|
2009-01-12 15:10:33 +01:00
|
|
|
}
|
|
|
|
|
|
2016-03-30 13:06:21 +02:00
|
|
|
void CMakeBuildStep::setBuildTarget(const QString &buildTarget)
|
2011-10-21 23:17:58 +02:00
|
|
|
{
|
2016-03-30 13:06:21 +02:00
|
|
|
if (m_buildTarget == buildTarget)
|
|
|
|
|
return;
|
|
|
|
|
m_buildTarget = buildTarget;
|
|
|
|
|
emit targetToBuildChanged();
|
2011-10-21 23:17:58 +02:00
|
|
|
}
|
|
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
void CMakeBuildStep::clearBuildTargets()
|
2011-10-21 23:17:58 +02:00
|
|
|
{
|
2016-03-30 13:06:21 +02:00
|
|
|
m_buildTarget.clear();
|
2011-10-21 23:17:58 +02:00
|
|
|
}
|
|
|
|
|
|
2016-01-07 13:15:29 +01:00
|
|
|
QString CMakeBuildStep::toolArguments() const
|
2009-03-12 15:51:44 +01:00
|
|
|
{
|
2016-01-07 13:15:29 +01:00
|
|
|
return m_toolArguments;
|
2009-03-12 15:51:44 +01:00
|
|
|
}
|
|
|
|
|
|
2016-01-07 13:15:29 +01:00
|
|
|
void CMakeBuildStep::setToolArguments(const QString &list)
|
2009-03-12 15:51:44 +01:00
|
|
|
{
|
2016-01-07 13:15:29 +01:00
|
|
|
m_toolArguments = list;
|
2009-03-12 15:51:44 +01:00
|
|
|
}
|
|
|
|
|
|
2016-01-07 13:15:29 +01:00
|
|
|
QString CMakeBuildStep::allArguments(const CMakeRunConfiguration *rc) const
|
2015-11-26 19:50:39 +01:00
|
|
|
{
|
2016-01-07 13:15:29 +01:00
|
|
|
QString arguments;
|
2015-11-26 19:50:39 +01:00
|
|
|
|
2017-06-12 14:23:34 +02:00
|
|
|
Utils::QtcProcess::addArg(&arguments, "--build");
|
|
|
|
|
Utils::QtcProcess::addArg(&arguments, ".");
|
2015-11-26 19:50:39 +01:00
|
|
|
|
2016-03-30 13:06:21 +02:00
|
|
|
QString target;
|
|
|
|
|
|
2016-04-22 15:54:16 +02:00
|
|
|
if (isCurrentExecutableTarget(m_buildTarget)) {
|
2016-01-07 13:15:29 +01:00
|
|
|
if (rc)
|
2017-04-24 13:25:01 +02:00
|
|
|
target = rc->buildSystemTarget();
|
2016-01-07 13:15:29 +01:00
|
|
|
else
|
2017-06-12 14:23:34 +02:00
|
|
|
target = "<i><" + tr(ADD_RUNCONFIGURATION_TEXT) + "></i>";
|
2016-03-30 13:06:21 +02:00
|
|
|
} else {
|
|
|
|
|
target = m_buildTarget;
|
2016-01-07 13:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
2017-06-12 14:23:34 +02:00
|
|
|
Utils::QtcProcess::addArg(&arguments, "--target");
|
2016-03-30 13:06:21 +02:00
|
|
|
Utils::QtcProcess::addArg(&arguments, target);
|
|
|
|
|
|
2016-01-07 13:15:29 +01:00
|
|
|
if (!m_toolArguments.isEmpty()) {
|
2017-06-12 14:23:34 +02:00
|
|
|
Utils::QtcProcess::addArg(&arguments, "--");
|
|
|
|
|
arguments += ' ' + m_toolArguments;
|
2016-01-07 13:15:29 +01:00
|
|
|
}
|
2014-04-03 16:33:04 +02:00
|
|
|
|
2016-01-07 13:15:29 +01:00
|
|
|
return arguments;
|
|
|
|
|
}
|
2012-10-02 17:46:12 +02:00
|
|
|
|
2016-01-07 13:15:29 +01:00
|
|
|
QString CMakeBuildStep::cmakeCommand() const
|
2014-10-02 17:51:02 +02:00
|
|
|
{
|
2016-01-07 13:15:29 +01:00
|
|
|
CMakeTool *tool = CMakeKitInformation::cmakeTool(target()->kit());
|
|
|
|
|
return tool ? tool->cmakeExecutable().toString() : QString();
|
2014-10-02 17:51:02 +02:00
|
|
|
}
|
|
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
QString CMakeBuildStep::cleanTarget()
|
2016-01-07 12:09:59 +01:00
|
|
|
{
|
2017-04-28 08:23:57 +02:00
|
|
|
return QString("clean");
|
2016-01-07 12:09:59 +01:00
|
|
|
}
|
|
|
|
|
|
2016-03-30 13:06:21 +02:00
|
|
|
QString CMakeBuildStep::allTarget()
|
|
|
|
|
{
|
2017-04-28 08:23:57 +02:00
|
|
|
return QString("all");
|
2017-04-26 15:27:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString CMakeBuildStep::installTarget()
|
|
|
|
|
{
|
2017-04-28 08:23:57 +02:00
|
|
|
return QString("install");
|
2017-04-26 15:27:01 +02:00
|
|
|
}
|
|
|
|
|
|
2017-06-02 09:11:39 +02:00
|
|
|
QString CMakeBuildStep::testTarget()
|
|
|
|
|
{
|
|
|
|
|
return QString("test");
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-26 15:27:01 +02:00
|
|
|
QStringList CMakeBuildStep::specialTargets()
|
|
|
|
|
{
|
2017-06-02 09:11:39 +02:00
|
|
|
return { allTarget(), cleanTarget(), installTarget(), testTarget() };
|
2016-03-30 13:06:21 +02:00
|
|
|
}
|
|
|
|
|
|
2008-12-04 13:06:02 +01:00
|
|
|
//
|
2016-01-07 12:33:52 +01:00
|
|
|
// CMakeBuildStepConfigWidget
|
2008-12-04 13:06:02 +01:00
|
|
|
//
|
2009-03-12 15:51:44 +01:00
|
|
|
|
2016-01-07 15:22:53 +01:00
|
|
|
CMakeBuildStepConfigWidget::CMakeBuildStepConfigWidget(CMakeBuildStep *buildStep) :
|
|
|
|
|
m_buildStep(buildStep),
|
|
|
|
|
m_toolArguments(new QLineEdit),
|
|
|
|
|
m_buildTargetsList(new QListWidget)
|
2009-01-12 15:10:33 +01:00
|
|
|
{
|
2016-01-07 15:22:53 +01:00
|
|
|
auto 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);
|
|
|
|
|
|
2016-01-07 13:15:29 +01:00
|
|
|
fl->addRow(tr("Tool arguments:"), m_toolArguments);
|
|
|
|
|
m_toolArguments->setText(m_buildStep->toolArguments());
|
2009-03-12 15:51:44 +01:00
|
|
|
|
2014-08-04 12:16:04 +02:00
|
|
|
m_buildTargetsList->setFrameStyle(QFrame::NoFrame);
|
2010-02-02 12:01:11 +01:00
|
|
|
m_buildTargetsList->setMinimumHeight(200);
|
2014-08-04 12:16:04 +02:00
|
|
|
|
2016-01-07 15:22:53 +01:00
|
|
|
auto frame = new QFrame(this);
|
2014-08-04 12:16:04 +02:00
|
|
|
frame->setFrameStyle(QFrame::StyledPanel);
|
2016-01-07 15:22:53 +01:00
|
|
|
auto frameLayout = new QVBoxLayout(frame);
|
2014-08-04 12:16:04 +02:00
|
|
|
frameLayout->setMargin(0);
|
2014-08-11 17:31:27 +02:00
|
|
|
frameLayout->addWidget(Core::ItemViewFind::createSearchableWrapper(m_buildTargetsList,
|
|
|
|
|
Core::ItemViewFind::LightColored));
|
2014-08-04 12:16:04 +02:00
|
|
|
|
|
|
|
|
fl->addRow(tr("Targets:"), frame);
|
2009-01-12 15:10:33 +01:00
|
|
|
|
2016-03-30 13:06:21 +02:00
|
|
|
buildTargetsChanged();
|
2011-05-30 13:30:10 +02:00
|
|
|
updateDetails();
|
|
|
|
|
|
2016-01-07 13:15:29 +01:00
|
|
|
connect(m_toolArguments, &QLineEdit::textEdited, this, &CMakeBuildStepConfigWidget::toolArgumentsEdited);
|
2016-01-07 12:33:52 +01:00
|
|
|
connect(m_buildTargetsList, &QListWidget::itemChanged, this, &CMakeBuildStepConfigWidget::itemChanged);
|
|
|
|
|
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::settingsChanged,
|
|
|
|
|
this, &CMakeBuildStepConfigWidget::updateDetails);
|
2011-05-30 13:30:10 +02:00
|
|
|
|
2016-02-24 18:00:24 +01:00
|
|
|
connect(m_buildStep, &CMakeBuildStep::buildTargetsChanged, this, &CMakeBuildStepConfigWidget::buildTargetsChanged);
|
2016-03-30 13:06:21 +02:00
|
|
|
connect(m_buildStep, &CMakeBuildStep::targetToBuildChanged, this, &CMakeBuildStepConfigWidget::selectedBuildTargetsChanged);
|
2017-07-29 23:34:56 +02:00
|
|
|
m_buildStep->project()->subscribeSignal(&BuildConfiguration::environmentChanged, this, [this]() {
|
|
|
|
|
if (static_cast<BuildConfiguration *>(sender())->isActive())
|
|
|
|
|
updateDetails();
|
|
|
|
|
});
|
|
|
|
|
connect(m_buildStep->project(), &Project::activeProjectConfigurationChanged,
|
|
|
|
|
this, [this](ProjectConfiguration *pc) {
|
2017-09-07 10:28:47 -04:00
|
|
|
if (pc && pc->isActive())
|
2017-07-29 23:34:56 +02:00
|
|
|
updateDetails();
|
|
|
|
|
});
|
2014-10-02 17:51:02 +02:00
|
|
|
}
|
|
|
|
|
|
2016-01-07 13:15:29 +01:00
|
|
|
void CMakeBuildStepConfigWidget::toolArgumentsEdited()
|
2009-03-12 15:51:44 +01:00
|
|
|
{
|
2016-01-07 13:15:29 +01:00
|
|
|
m_buildStep->setToolArguments(m_toolArguments->text());
|
2009-08-06 17:26:38 +02:00
|
|
|
updateDetails();
|
2009-03-12 15:51:44 +01:00
|
|
|
}
|
|
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
void CMakeBuildStepConfigWidget::itemChanged(QListWidgetItem *item)
|
2009-01-12 15:10:33 +01:00
|
|
|
{
|
2016-03-30 13:06:21 +02:00
|
|
|
const QString target =
|
|
|
|
|
(item->checkState() == Qt::Checked) ? item->data(Qt::UserRole).toString() : CMakeBuildStep::allTarget();
|
|
|
|
|
m_buildStep->setBuildTarget(target);
|
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
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
QString CMakeBuildStepConfigWidget::displayName() const
|
2008-12-04 13:06:02 +01:00
|
|
|
{
|
2016-01-07 13:15:29 +01:00
|
|
|
return tr("Build", "CMakeProjectManager::CMakeBuildStepConfigWidget display name.");
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-31 17:17:20 +02:00
|
|
|
void CMakeBuildStepConfigWidget::buildTargetsChanged()
|
|
|
|
|
{
|
2017-09-30 07:12:57 +02:00
|
|
|
{
|
|
|
|
|
QSignalBlocker blocker(m_buildTargetsList);
|
|
|
|
|
m_buildTargetsList->clear();
|
2017-03-31 17:17:20 +02:00
|
|
|
|
2017-09-30 07:12:57 +02:00
|
|
|
auto pro = static_cast<CMakeProject *>(m_buildStep->project());
|
|
|
|
|
QStringList targetList = pro->buildTargetTitles();
|
|
|
|
|
targetList.sort();
|
2016-03-30 13:06:21 +02:00
|
|
|
|
2017-09-30 07:12:57 +02:00
|
|
|
QFont italics;
|
|
|
|
|
italics.setItalic(true);
|
2017-04-26 15:29:54 +02:00
|
|
|
|
2017-09-30 07:12:57 +02:00
|
|
|
auto exeItem = new QListWidgetItem(tr(ADD_RUNCONFIGURATION_TEXT), m_buildTargetsList);
|
|
|
|
|
exeItem->setData(Qt::UserRole, ADD_RUNCONFIGURATION_TEXT);
|
2017-04-26 15:29:54 +02:00
|
|
|
|
2017-09-30 07:12:57 +02:00
|
|
|
foreach (const QString &buildTarget, targetList) {
|
|
|
|
|
auto item = new QListWidgetItem(buildTarget, m_buildTargetsList);
|
|
|
|
|
item->setData(Qt::UserRole, buildTarget);
|
|
|
|
|
}
|
2016-03-30 13:06:21 +02:00
|
|
|
|
2017-09-30 07:12:57 +02:00
|
|
|
for (int i = 0; i < m_buildTargetsList->count(); ++i) {
|
|
|
|
|
QListWidgetItem *item = m_buildTargetsList->item(i);
|
|
|
|
|
const QString title = item->data(Qt::UserRole).toString();
|
2017-04-26 15:29:54 +02:00
|
|
|
|
2017-09-30 07:12:57 +02:00
|
|
|
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
|
|
|
|
item->setCheckState(m_buildStep->buildsBuildTarget(title) ? Qt::Checked : Qt::Unchecked);
|
2017-04-26 15:29:54 +02:00
|
|
|
|
2017-09-30 07:12:57 +02:00
|
|
|
// Print utility targets in italics:
|
|
|
|
|
if (CMakeBuildStep::specialTargets().contains(title) || title == ADD_RUNCONFIGURATION_TEXT)
|
|
|
|
|
item->setFont(italics);
|
|
|
|
|
}
|
2009-12-03 19:45:09 +01:00
|
|
|
}
|
2017-04-26 15:32:44 +02:00
|
|
|
updateDetails();
|
2009-08-06 17:26:38 +02:00
|
|
|
}
|
|
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
void CMakeBuildStepConfigWidget::selectedBuildTargetsChanged()
|
2013-08-26 16:01:24 +02:00
|
|
|
{
|
2017-09-30 07:12:57 +02:00
|
|
|
{
|
|
|
|
|
QSignalBlocker blocker(m_buildTargetsList);
|
|
|
|
|
for (int y = 0; y < m_buildTargetsList->count(); ++y) {
|
|
|
|
|
QListWidgetItem *item = m_buildTargetsList->item(y);
|
|
|
|
|
item->setCheckState(m_buildStep->buildsBuildTarget(item->data(Qt::UserRole).toString())
|
|
|
|
|
? Qt::Checked : Qt::Unchecked);
|
|
|
|
|
}
|
2013-08-26 16:01:24 +02:00
|
|
|
}
|
2017-04-26 15:32:44 +02:00
|
|
|
updateDetails();
|
2013-08-26 16:01:24 +02:00
|
|
|
}
|
|
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
void CMakeBuildStepConfigWidget::updateDetails()
|
2009-08-06 17:26:38 +02:00
|
|
|
{
|
2016-01-07 12:33:52 +01:00
|
|
|
BuildConfiguration *bc = m_buildStep->buildConfiguration();
|
2012-03-28 13:18:25 +02:00
|
|
|
if (!bc)
|
2016-01-07 13:15:29 +01:00
|
|
|
bc = m_buildStep->targetsActiveBuildConfiguration();
|
2012-04-24 15:49:09 +02:00
|
|
|
if (!bc) {
|
2012-10-19 17:07:26 +02:00
|
|
|
m_summaryText = tr("<b>No build configuration found on this kit.</b>");
|
2017-04-26 15:32:44 +02:00
|
|
|
emit updateSummary();
|
2012-04-24 15:49:09 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-07 13:15:29 +01:00
|
|
|
ProcessParameters param;
|
|
|
|
|
param.setMacroExpander(bc->macroExpander());
|
|
|
|
|
param.setEnvironment(bc->environment());
|
|
|
|
|
param.setWorkingDirectory(bc->buildDirectory().toString());
|
|
|
|
|
param.setCommand(m_buildStep->cmakeCommand());
|
|
|
|
|
param.setArguments(m_buildStep->allArguments(0));
|
|
|
|
|
m_summaryText = param.summary(displayName());
|
|
|
|
|
|
2009-08-06 17:26:38 +02:00
|
|
|
emit updateSummary();
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
QString CMakeBuildStepConfigWidget::summaryText() const
|
2009-08-06 15:31:32 +02:00
|
|
|
{
|
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
|
|
|
//
|
2016-01-07 12:33:52 +01:00
|
|
|
// CMakeBuildStepFactory
|
2008-12-04 13:06:02 +01:00
|
|
|
//
|
|
|
|
|
|
ProjectExplorer/all: Re-organize BuildSteps/{Deploy,Build}Config setup
This follow the rough pattern of recent *RunConfigurationFactory changes
for build and deploy configurations.
- Collapse the two lines of constructors similar to what
890c1906e6fb2ec did for RunConfigurations
* Deploy* was purely mechanical
* Build* ctors are split in connects() in the ctor body
to create "empty shell for clone" etc
and build step additions in initialize() functions which
are only used in the create() case.
-- Allows to collapse the shared 'ctor()' functions, too.
- Move FooBuildConfigurationFactory::create() implementations
to FooBuildConfiguration() constructor. That was a strange
and unneeded ping-pong between factories and objects, and
furthermore allows one level less of indirection (and for a
later, left out here, some reduction of the
FooBuildConfiguration interfaces that were only used to
accommodate the *Factory::create() functions.
- Most {Build,Deploy}Configuration{,Factory} classes had a canHandle(),
but there wasn't one in the base classses. Have one there.
- Most canHandle() functions were checking simple restrictions on
e.g. project or target types, specify those by setters in the
constructors instead and check them in the base canHandle()
- clone() is generally replaced by a creation of a "shell object"
and a fromMap(source->toMap()), implemented in the base, there
are two cases left for Android and Qbs that needed(?) some extra
polish
- generally use canHandle() in base implementation, instead
of doing that in all Derived::canFoo()
- as a result, canCreate/create/canClone/clone reimplementations
are not needed anymore, keep the base implementation for
now (could be inlined into their only users later), but
de-virtualize them.
- Combine Ios{Preset,DSym}BuildStepFactory. There was only one
'dsym' build step they could create.
- Split the 'mangled' id into the ProjectConfiguration subtype
specific constant identifier, and a QString extraId() bit.
Only maintain the mangled id in saved settings.
- Make ProjectConfiguration::m_id a constant member, adapt
all constructors of derived classe.
Not done in this patch:
- Finish possible cosmetic changes on top
- Add a way to specify restrictions to supported Qt versions
(used in Android/Ios), as the base implementation does not
depend on the qtsupport plugin
- Combine the QList<X> availableFoo() + createFoo(X) function
pairs to somthing like a direct
QList<struct { X; std::function<X()>; }> fooCreators()
to avoid e.g. the baseId.withSuffix() <-> id.suffixAfter(base)
pingpong
- Remove the *Factories from the global object pool
- Do something about priority(). Falling back to plain
qmake in android+qmake setup is not helpful.
Change-Id: I2be7d88d554c5aa8b7db8edf5b93278e1ae0112a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-11-29 12:28:40 +01:00
|
|
|
CMakeBuildStepFactory::CMakeBuildStepFactory()
|
2010-01-14 17:41:29 +01:00
|
|
|
{
|
ProjectExplorer/all: Re-organize BuildSteps/{Deploy,Build}Config setup
This follow the rough pattern of recent *RunConfigurationFactory changes
for build and deploy configurations.
- Collapse the two lines of constructors similar to what
890c1906e6fb2ec did for RunConfigurations
* Deploy* was purely mechanical
* Build* ctors are split in connects() in the ctor body
to create "empty shell for clone" etc
and build step additions in initialize() functions which
are only used in the create() case.
-- Allows to collapse the shared 'ctor()' functions, too.
- Move FooBuildConfigurationFactory::create() implementations
to FooBuildConfiguration() constructor. That was a strange
and unneeded ping-pong between factories and objects, and
furthermore allows one level less of indirection (and for a
later, left out here, some reduction of the
FooBuildConfiguration interfaces that were only used to
accommodate the *Factory::create() functions.
- Most {Build,Deploy}Configuration{,Factory} classes had a canHandle(),
but there wasn't one in the base classses. Have one there.
- Most canHandle() functions were checking simple restrictions on
e.g. project or target types, specify those by setters in the
constructors instead and check them in the base canHandle()
- clone() is generally replaced by a creation of a "shell object"
and a fromMap(source->toMap()), implemented in the base, there
are two cases left for Android and Qbs that needed(?) some extra
polish
- generally use canHandle() in base implementation, instead
of doing that in all Derived::canFoo()
- as a result, canCreate/create/canClone/clone reimplementations
are not needed anymore, keep the base implementation for
now (could be inlined into their only users later), but
de-virtualize them.
- Combine Ios{Preset,DSym}BuildStepFactory. There was only one
'dsym' build step they could create.
- Split the 'mangled' id into the ProjectConfiguration subtype
specific constant identifier, and a QString extraId() bit.
Only maintain the mangled id in saved settings.
- Make ProjectConfiguration::m_id a constant member, adapt
all constructors of derived classe.
Not done in this patch:
- Finish possible cosmetic changes on top
- Add a way to specify restrictions to supported Qt versions
(used in Android/Ios), as the base implementation does not
depend on the qtsupport plugin
- Combine the QList<X> availableFoo() + createFoo(X) function
pairs to somthing like a direct
QList<struct { X; std::function<X()>; }> fooCreators()
to avoid e.g. the baseId.withSuffix() <-> id.suffixAfter(base)
pingpong
- Remove the *Factories from the global object pool
- Do something about priority(). Falling back to plain
qmake in android+qmake setup is not helpful.
Change-Id: I2be7d88d554c5aa8b7db8edf5b93278e1ae0112a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-11-29 12:28:40 +01:00
|
|
|
registerStep<CMakeBuildStep>(Constants::CMAKE_BUILD_STEP_ID);
|
|
|
|
|
setDisplayName(tr("Build", "Display name for CMakeProjectManager::CMakeBuildStep id."));
|
|
|
|
|
setSupportedProjectType(Constants::CMAKEPROJECT_ID);
|
|
|
|
|
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
2010-01-14 17:41:29 +01:00
|
|
|
}
|
|
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
void CMakeBuildStep::processStarted()
|
2013-02-18 11:14:41 +01:00
|
|
|
{
|
2016-01-07 13:15:29 +01:00
|
|
|
m_useNinja = false;
|
2013-02-18 11:14:41 +01:00
|
|
|
futureInterface()->setProgressRange(0, 100);
|
|
|
|
|
AbstractProcessStep::processStarted();
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
void CMakeBuildStep::processFinished(int exitCode, QProcess::ExitStatus status)
|
2013-02-18 11:14:41 +01:00
|
|
|
{
|
2013-02-20 13:11:34 +01:00
|
|
|
AbstractProcessStep::processFinished(exitCode, status);
|
2013-02-18 11:14:41 +01:00
|
|
|
futureInterface()->setProgressValue(100);
|
|
|
|
|
}
|