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 "buildstep.h"
|
2008-12-09 15:25:01 +01:00
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
#include "buildconfiguration.h"
|
|
|
|
|
#include "buildsteplist.h"
|
2011-02-21 17:38:12 +01:00
|
|
|
#include "deployconfiguration.h"
|
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
|
|
|
#include "kitinformation.h"
|
|
|
|
|
#include "project.h"
|
2010-07-16 14:00:41 +02:00
|
|
|
#include "target.h"
|
|
|
|
|
|
2016-05-18 12:37:29 +02:00
|
|
|
#include <utils/algorithm.h>
|
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
|
|
|
#include <utils/qtcassert.h>
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
#include <utils/runextensions.h>
|
2016-05-18 12:37:29 +02:00
|
|
|
|
2018-09-14 12:41:47 +02:00
|
|
|
#include <QFormLayout>
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
#include <QFutureWatcher>
|
|
|
|
|
#include <QPointer>
|
2018-09-14 12:41:47 +02:00
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
|
|
|
|
\class ProjectExplorer::BuildStep
|
|
|
|
|
|
2013-06-05 14:29:24 +02:00
|
|
|
\brief The BuildStep class provides build steps for projects.
|
2011-04-14 12:58:14 +02:00
|
|
|
|
2013-06-05 14:29:24 +02:00
|
|
|
Build steps are the primary way plugin developers can customize
|
|
|
|
|
how their projects (or projects from other plugins) are built.
|
2011-04-14 12:58:14 +02:00
|
|
|
|
2013-06-05 14:29:24 +02:00
|
|
|
Projects are built by taking the list of build steps
|
|
|
|
|
from the project and calling first \c init() and then \c run() on them.
|
2011-04-14 12:58:14 +02:00
|
|
|
|
2013-06-05 14:29:24 +02:00
|
|
|
To change the way your project is built, reimplement
|
|
|
|
|
this class and add your build step to the build step list of the project.
|
2011-04-14 12:58:14 +02:00
|
|
|
|
2013-06-05 14:29:24 +02:00
|
|
|
\note The projects own the build step. Do not delete them yourself.
|
|
|
|
|
|
|
|
|
|
\c init() is called in the GUI thread and can be used to query the
|
2011-04-14 12:58:14 +02:00
|
|
|
project for any information you need.
|
|
|
|
|
|
2016-02-09 14:17:29 +01:00
|
|
|
\c run() is run via Utils::runAsync in a separate thread. If you need an
|
2013-06-05 14:29:24 +02:00
|
|
|
event loop, you need to create it yourself.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn bool ProjectExplorer::BuildStep::init()
|
|
|
|
|
|
2013-09-10 17:16:10 +02:00
|
|
|
This function is run in the GUI thread. Use it to retrieve any information
|
|
|
|
|
that you need in the run() function.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn void ProjectExplorer::BuildStep::run(QFutureInterface<bool> &fi)
|
|
|
|
|
|
2013-09-10 17:16:10 +02:00
|
|
|
Reimplement this function. It is called when the target is built.
|
|
|
|
|
By default, this function is NOT run in the GUI thread, but runs in its
|
2011-07-07 15:15:43 +02:00
|
|
|
own thread. If you need an event loop, you need to create one.
|
|
|
|
|
This function should block until the task is done
|
2011-04-14 12:58:14 +02:00
|
|
|
|
|
|
|
|
The absolute minimal implementation is:
|
|
|
|
|
\code
|
|
|
|
|
fi.reportResult(true);
|
|
|
|
|
\endcode
|
2011-07-07 15:15:43 +02:00
|
|
|
|
2013-09-10 17:16:10 +02:00
|
|
|
By returning \c true from runInGuiThread(), this function is called in
|
|
|
|
|
the GUI thread. Then the function should not block and instead the
|
2011-07-07 15:15:43 +02:00
|
|
|
finished() signal should be emitted.
|
2011-04-14 12:58:14 +02:00
|
|
|
|
2013-09-10 17:16:10 +02:00
|
|
|
\sa runInGuiThread()
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
2013-09-10 17:16:10 +02:00
|
|
|
\fn BuildStepConfigWidget *ProjectExplorer::BuildStep::createConfigWidget()
|
2011-04-14 12:58:14 +02:00
|
|
|
|
2013-09-10 17:16:10 +02:00
|
|
|
Returns the Widget shown in the target settings dialog for this build step.
|
|
|
|
|
Ownership is transferred to the caller.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn void ProjectExplorer::BuildStep::addTask(const ProjectExplorer::Task &task)
|
2013-09-10 17:16:10 +02:00
|
|
|
Adds \a task.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
2013-05-23 16:13:55 +02:00
|
|
|
\fn void ProjectExplorer::BuildStep::addOutput(const QString &string, ProjectExplorer::BuildStep::OutputFormat format,
|
|
|
|
|
ProjectExplorer::BuildStep::OutputNewlineSetting newlineSetting = DoAppendNewline) const
|
2011-04-14 12:58:14 +02:00
|
|
|
|
2013-09-10 17:16:10 +02:00
|
|
|
The \a string is added to the generated output, usually in the output pane.
|
2011-04-14 12:58:14 +02:00
|
|
|
It should be in plain text, with the format in the parameter.
|
|
|
|
|
*/
|
|
|
|
|
|
2011-07-07 15:15:43 +02:00
|
|
|
/*!
|
|
|
|
|
\fn void ProjectExplorer::BuildStep::finished()
|
2013-09-10 17:16:10 +02:00
|
|
|
This signal needs to be emitted if the build step runs in the GUI thread.
|
2011-07-07 15:15:43 +02:00
|
|
|
*/
|
|
|
|
|
|
2012-01-23 14:55:58 +01:00
|
|
|
static const char buildStepEnabledKey[] = "ProjectExplorer.BuildStep.Enabled";
|
|
|
|
|
|
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
|
|
|
namespace ProjectExplorer {
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2017-12-08 17:20:48 +01:00
|
|
|
static QList<BuildStepFactory *> g_buildStepFactories;
|
|
|
|
|
|
2014-07-01 11:08:26 +02:00
|
|
|
BuildStep::BuildStep(BuildStepList *bsl, Core::Id id) :
|
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(bsl, id)
|
2017-03-17 00:27:13 +02:00
|
|
|
{
|
|
|
|
|
Utils::MacroExpander *expander = macroExpander();
|
|
|
|
|
expander->setDisplayName(tr("Build Step"));
|
|
|
|
|
expander->setAccumulating(true);
|
|
|
|
|
expander->registerSubProvider([this] { return projectConfiguration()->macroExpander(); });
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
void BuildStep::run()
|
|
|
|
|
{
|
|
|
|
|
m_cancelFlag = false;
|
|
|
|
|
doRun();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BuildStep::cancel()
|
|
|
|
|
{
|
|
|
|
|
m_cancelFlag = true;
|
|
|
|
|
doCancel();
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-14 12:41:47 +02:00
|
|
|
BuildStepConfigWidget *BuildStep::createConfigWidget()
|
|
|
|
|
{
|
2018-10-19 17:40:33 +02:00
|
|
|
auto widget = new BuildStepConfigWidget(this);
|
2018-09-14 12:41:47 +02:00
|
|
|
|
|
|
|
|
auto formLayout = new QFormLayout(widget);
|
|
|
|
|
formLayout->setMargin(0);
|
|
|
|
|
formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
|
|
|
|
|
|
|
|
|
for (ProjectConfigurationAspect *aspect : m_aspects) {
|
|
|
|
|
if (aspect->isVisible())
|
|
|
|
|
aspect->addToConfigurationLayout(formLayout);
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-25 10:10:06 +02:00
|
|
|
connect(buildConfiguration(), &BuildConfiguration::buildDirectoryChanged,
|
|
|
|
|
widget, &BuildStepConfigWidget::recreateSummary);
|
|
|
|
|
|
|
|
|
|
widget->setSummaryUpdater(m_summaryUpdater);
|
|
|
|
|
|
2018-09-14 12:41:47 +02:00
|
|
|
return widget;
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-23 14:55:58 +01:00
|
|
|
bool BuildStep::fromMap(const QVariantMap &map)
|
|
|
|
|
{
|
2017-06-12 14:23:34 +02:00
|
|
|
m_enabled = map.value(buildStepEnabledKey, true).toBool();
|
2012-01-23 14:55:58 +01:00
|
|
|
return ProjectConfiguration::fromMap(map);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap BuildStep::toMap() const
|
|
|
|
|
{
|
|
|
|
|
QVariantMap map = ProjectConfiguration::toMap();
|
2017-06-12 14:23:34 +02:00
|
|
|
map.insert(buildStepEnabledKey, m_enabled);
|
2012-01-23 14:55:58 +01:00
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
2009-10-27 14:16:28 +01:00
|
|
|
BuildConfiguration *BuildStep::buildConfiguration() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2018-05-17 10:26:10 +02:00
|
|
|
auto config = qobject_cast<BuildConfiguration *>(parent()->parent());
|
|
|
|
|
if (config)
|
|
|
|
|
return config;
|
|
|
|
|
// step is not part of a build configuration, use active build configuration of step's target
|
|
|
|
|
return target()->activeBuildConfiguration();
|
2010-07-16 14:00:41 +02:00
|
|
|
}
|
|
|
|
|
|
2011-02-21 17:38:12 +01:00
|
|
|
DeployConfiguration *BuildStep::deployConfiguration() const
|
|
|
|
|
{
|
2018-05-17 10:26:10 +02:00
|
|
|
auto config = qobject_cast<DeployConfiguration *>(parent()->parent());
|
|
|
|
|
if (config)
|
|
|
|
|
return config;
|
|
|
|
|
// step is not part of a deploy configuration, use active deploy configuration of step's target
|
|
|
|
|
return target()->activeDeployConfiguration();
|
2011-02-21 17:38:12 +01:00
|
|
|
}
|
|
|
|
|
|
2011-10-24 13:10:38 +00:00
|
|
|
ProjectConfiguration *BuildStep::projectConfiguration() const
|
|
|
|
|
{
|
|
|
|
|
return static_cast<ProjectConfiguration *>(parent()->parent());
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
Target *BuildStep::target() const
|
|
|
|
|
{
|
|
|
|
|
return qobject_cast<Target *>(parent()->parent()->parent());
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2011-10-21 13:06:26 +00:00
|
|
|
Project *BuildStep::project() const
|
|
|
|
|
{
|
|
|
|
|
return target()->project();
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-20 12:49:25 +02:00
|
|
|
void BuildStep::reportRunResult(QFutureInterface<bool> &fi, bool success)
|
|
|
|
|
{
|
|
|
|
|
fi.reportResult(success);
|
|
|
|
|
fi.reportFinished();
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-02 16:04:45 +02:00
|
|
|
bool BuildStep::isActive() const
|
|
|
|
|
{
|
|
|
|
|
return projectConfiguration()->isActive();
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-19 17:40:33 +02:00
|
|
|
bool BuildStep::widgetExpandedByDefault() const
|
|
|
|
|
{
|
|
|
|
|
return m_widgetExpandedByDefault;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BuildStep::setWidgetExpandedByDefault(bool widgetExpandedByDefault)
|
|
|
|
|
{
|
|
|
|
|
m_widgetExpandedByDefault = widgetExpandedByDefault;
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-06 14:17:17 +02:00
|
|
|
QVariant BuildStep::data(Core::Id id) const
|
|
|
|
|
{
|
|
|
|
|
Q_UNUSED(id);
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-10 17:16:10 +02:00
|
|
|
/*!
|
2018-10-22 17:56:04 +02:00
|
|
|
\fn BuildStep::isImmutable()
|
|
|
|
|
|
2013-09-10 17:16:10 +02:00
|
|
|
If this function returns \c true, the user cannot delete this build step for
|
|
|
|
|
this target and the user is prevented from changing the order in which
|
|
|
|
|
immutable steps are run. The default implementation returns \c false.
|
|
|
|
|
*/
|
|
|
|
|
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
void BuildStep::runInThread(const std::function<bool()> &syncImpl)
|
2011-07-07 15:15:43 +02:00
|
|
|
{
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
m_runInGuiThread = false;
|
|
|
|
|
m_cancelFlag = false;
|
|
|
|
|
auto * const watcher = new QFutureWatcher<bool>(this);
|
|
|
|
|
connect(watcher, &QFutureWatcher<bool>::finished, this, [this, watcher] {
|
|
|
|
|
emit finished(watcher->result());
|
|
|
|
|
watcher->deleteLater();
|
|
|
|
|
});
|
|
|
|
|
watcher->setFuture(Utils::runAsync(syncImpl));
|
2018-10-22 19:11:59 +02:00
|
|
|
}
|
|
|
|
|
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
std::function<bool ()> BuildStep::cancelChecker() const
|
2018-10-22 19:11:59 +02:00
|
|
|
{
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
return [step = QPointer<const BuildStep>(this)] { return step && step->isCanceled(); };
|
2011-07-07 15:15:43 +02:00
|
|
|
}
|
|
|
|
|
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
bool BuildStep::isCanceled() const
|
|
|
|
|
{
|
|
|
|
|
return m_cancelFlag;
|
|
|
|
|
}
|
2013-09-10 17:16:10 +02:00
|
|
|
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
void BuildStep::doCancel()
|
2011-07-07 15:15:43 +02:00
|
|
|
{
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
QTC_ASSERT(!m_runInGuiThread, qWarning() << "Build step" << displayName()
|
|
|
|
|
<< "neeeds to implement the doCancel() function");
|
2011-07-07 15:15:43 +02:00
|
|
|
}
|
|
|
|
|
|
2019-06-25 10:10:06 +02:00
|
|
|
void BuildStep::setSummaryUpdater(const std::function<QString ()> &summaryUpdater)
|
|
|
|
|
{
|
|
|
|
|
m_summaryUpdater = summaryUpdater;
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-23 14:55:58 +01:00
|
|
|
void BuildStep::setEnabled(bool b)
|
|
|
|
|
{
|
|
|
|
|
if (m_enabled == b)
|
|
|
|
|
return;
|
|
|
|
|
m_enabled = b;
|
|
|
|
|
emit enabledChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool BuildStep::enabled() const
|
|
|
|
|
{
|
|
|
|
|
return m_enabled;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
BuildStepFactory::BuildStepFactory()
|
2017-12-08 17:20:48 +01:00
|
|
|
{
|
|
|
|
|
g_buildStepFactories.append(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BuildStepFactory::~BuildStepFactory()
|
|
|
|
|
{
|
|
|
|
|
g_buildStepFactories.removeOne(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QList<BuildStepFactory *> BuildStepFactory::allBuildStepFactories()
|
|
|
|
|
{
|
|
|
|
|
return g_buildStepFactories;
|
|
|
|
|
}
|
2016-05-18 12:37:29 +02: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
|
|
|
bool BuildStepFactory::canHandle(BuildStepList *bsl) const
|
|
|
|
|
{
|
|
|
|
|
if (!m_supportedStepLists.isEmpty() && !m_supportedStepLists.contains(bsl->id()))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
auto config = qobject_cast<ProjectConfiguration *>(bsl->parent());
|
|
|
|
|
|
|
|
|
|
if (!m_supportedDeviceTypes.isEmpty()) {
|
|
|
|
|
Target *target = bsl->target();
|
|
|
|
|
QTC_ASSERT(target, return false);
|
2019-02-06 12:50:51 +01:00
|
|
|
Core::Id deviceType = DeviceTypeKitAspect::deviceTypeId(target->kit());
|
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 (!m_supportedDeviceTypes.contains(deviceType))
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m_supportedProjectType.isValid()) {
|
|
|
|
|
if (!config)
|
|
|
|
|
return false;
|
|
|
|
|
Core::Id projectId = config->project()->id();
|
|
|
|
|
if (projectId != m_supportedProjectType)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!m_isRepeatable && bsl->contains(m_info.id))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (m_supportedConfiguration.isValid()) {
|
|
|
|
|
if (!config)
|
|
|
|
|
return false;
|
|
|
|
|
Core::Id configId = config->id();
|
|
|
|
|
if (configId != m_supportedConfiguration)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BuildStepFactory::setDisplayName(const QString &displayName)
|
|
|
|
|
{
|
|
|
|
|
m_info.displayName = displayName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BuildStepFactory::setFlags(BuildStepInfo::Flags flags)
|
|
|
|
|
{
|
|
|
|
|
m_info.flags = flags;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BuildStepFactory::setSupportedStepList(Core::Id id)
|
|
|
|
|
{
|
|
|
|
|
m_supportedStepLists = {id};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BuildStepFactory::setSupportedStepLists(const QList<Core::Id> &ids)
|
|
|
|
|
{
|
|
|
|
|
m_supportedStepLists = ids;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BuildStepFactory::setSupportedConfiguration(Core::Id id)
|
|
|
|
|
{
|
|
|
|
|
m_supportedConfiguration = id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BuildStepFactory::setSupportedProjectType(Core::Id id)
|
|
|
|
|
{
|
|
|
|
|
m_supportedProjectType = id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BuildStepFactory::setSupportedDeviceType(Core::Id id)
|
|
|
|
|
{
|
|
|
|
|
m_supportedDeviceTypes = {id};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BuildStepFactory::setSupportedDeviceTypes(const QList<Core::Id> &ids)
|
|
|
|
|
{
|
|
|
|
|
m_supportedDeviceTypes = ids;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BuildStepInfo BuildStepFactory::stepInfo() const
|
|
|
|
|
{
|
|
|
|
|
return m_info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Core::Id BuildStepFactory::stepId() const
|
|
|
|
|
{
|
|
|
|
|
return m_info.id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BuildStep *BuildStepFactory::create(BuildStepList *parent, Core::Id id)
|
|
|
|
|
{
|
|
|
|
|
BuildStep *bs = nullptr;
|
|
|
|
|
if (id == m_info.id)
|
|
|
|
|
bs = m_info.creator(parent);
|
|
|
|
|
return bs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BuildStep *BuildStepFactory::restore(BuildStepList *parent, const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
BuildStep *bs = m_info.creator(parent);
|
|
|
|
|
if (!bs)
|
|
|
|
|
return nullptr;
|
|
|
|
|
if (!bs->fromMap(map)) {
|
|
|
|
|
QTC_CHECK(false);
|
|
|
|
|
delete bs;
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
return bs;
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-20 11:19:41 +02:00
|
|
|
// BuildStepConfigWidget
|
|
|
|
|
|
2018-10-19 17:40:33 +02:00
|
|
|
BuildStepConfigWidget::BuildStepConfigWidget(BuildStep *step)
|
|
|
|
|
: m_step(step)
|
2018-09-20 11:19:41 +02:00
|
|
|
{
|
2018-10-12 17:52:09 +02:00
|
|
|
m_displayName = step->displayName();
|
2018-10-15 17:52:15 +02:00
|
|
|
m_summaryText = "<b>" + m_displayName + "</b>";
|
2018-09-20 11:19:41 +02:00
|
|
|
connect(m_step, &ProjectConfiguration::displayNameChanged,
|
|
|
|
|
this, &BuildStepConfigWidget::updateSummary);
|
2019-06-25 10:10:06 +02:00
|
|
|
for (auto aspect : step->aspects()) {
|
|
|
|
|
connect(aspect, &ProjectConfigurationAspect::changed,
|
|
|
|
|
this, &BuildStepConfigWidget::recreateSummary);
|
|
|
|
|
}
|
2018-09-20 11:19:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BuildStepConfigWidget::summaryText() const
|
|
|
|
|
{
|
2018-10-15 17:52:15 +02:00
|
|
|
return m_summaryText;
|
2018-09-20 11:19:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BuildStepConfigWidget::displayName() const
|
|
|
|
|
{
|
2018-10-15 17:52:15 +02:00
|
|
|
return m_displayName;
|
2018-09-20 11:19:41 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-12 17:52:09 +02:00
|
|
|
void BuildStepConfigWidget::setDisplayName(const QString &displayName)
|
|
|
|
|
{
|
|
|
|
|
m_displayName = displayName;
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-15 17:52:15 +02:00
|
|
|
void BuildStepConfigWidget::setSummaryText(const QString &summaryText)
|
|
|
|
|
{
|
|
|
|
|
if (summaryText != m_summaryText) {
|
|
|
|
|
m_summaryText = summaryText;
|
2019-01-16 18:06:21 +01:00
|
|
|
emit updateSummary();
|
2018-10-15 17:52:15 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-25 10:10:06 +02:00
|
|
|
void BuildStepConfigWidget::setSummaryUpdater(const std::function<QString()> &summaryUpdater)
|
|
|
|
|
{
|
|
|
|
|
m_summaryUpdater = summaryUpdater;
|
|
|
|
|
recreateSummary();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BuildStepConfigWidget::recreateSummary()
|
|
|
|
|
{
|
|
|
|
|
if (m_summaryUpdater)
|
|
|
|
|
setSummaryText(m_summaryUpdater());
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
} // ProjectExplorer
|