2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2010-07-16 14:00:41 +02:00
|
|
|
|
|
|
|
|
#include "buildsteplist.h"
|
|
|
|
|
|
|
|
|
|
#include "buildmanager.h"
|
|
|
|
|
#include "buildstep.h"
|
2022-06-22 15:43:33 +02:00
|
|
|
#include "projectexplorerconstants.h"
|
2023-01-13 12:38:22 +01:00
|
|
|
#include "projectexplorertr.h"
|
2010-07-16 14:00:41 +02:00
|
|
|
#include "target.h"
|
|
|
|
|
|
2014-07-07 19:02:26 +02:00
|
|
|
#include <utils/algorithm.h>
|
2022-07-05 14:09:49 +02:00
|
|
|
#include <utils/qtcassert.h>
|
|
|
|
|
|
|
|
|
|
#include <QDebug>
|
2010-07-16 14:00:41 +02:00
|
|
|
|
2023-08-23 16:11:48 +02:00
|
|
|
using namespace Utils;
|
|
|
|
|
|
2019-07-30 11:29:49 +02:00
|
|
|
namespace ProjectExplorer {
|
2010-07-16 14:00:41 +02:00
|
|
|
|
2013-09-26 13:01:29 +02:00
|
|
|
const char STEPS_COUNT_KEY[] = "ProjectExplorer.BuildStepList.StepsCount";
|
|
|
|
|
const char STEPS_PREFIX[] = "ProjectExplorer.BuildStepList.Step.";
|
2010-07-16 14:00:41 +02:00
|
|
|
|
2023-07-10 10:02:37 +02:00
|
|
|
BuildStepList::BuildStepList(ProjectConfiguration *config, Utils::Id id)
|
2023-07-27 17:21:11 +02:00
|
|
|
: m_projectConfiguration(config), m_id(id)
|
2010-07-16 14:00:41 +02:00
|
|
|
{
|
2023-07-10 10:02:37 +02:00
|
|
|
QTC_CHECK(config);
|
2010-07-16 14:00:41 +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
|
|
|
BuildStepList::~BuildStepList()
|
2010-07-16 14:00:41 +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
|
|
|
clear();
|
2010-07-16 14:00:41 +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
|
|
|
void BuildStepList::clear()
|
2010-07-16 14:00:41 +02:00
|
|
|
{
|
|
|
|
|
qDeleteAll(m_steps);
|
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
|
|
|
m_steps.clear();
|
2010-07-16 14:00:41 +02:00
|
|
|
}
|
|
|
|
|
|
2023-07-10 10:02:37 +02:00
|
|
|
Target *BuildStepList::target() const
|
|
|
|
|
{
|
|
|
|
|
return m_projectConfiguration->target();
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-23 16:53:06 +02:00
|
|
|
Store BuildStepList::toMap() const
|
2010-07-16 14:00:41 +02:00
|
|
|
{
|
2023-08-23 16:53:06 +02:00
|
|
|
Store map;
|
2019-07-30 11:29:49 +02:00
|
|
|
|
|
|
|
|
{
|
|
|
|
|
// Only written for compatibility reasons within the 4.11 cycle
|
|
|
|
|
const char CONFIGURATION_ID_KEY[] = "ProjectExplorer.ProjectConfiguration.Id";
|
|
|
|
|
const char DISPLAY_NAME_KEY[] = "ProjectExplorer.ProjectConfiguration.DisplayName";
|
|
|
|
|
const char DEFAULT_DISPLAY_NAME_KEY[] = "ProjectExplorer.ProjectConfiguration.DefaultDisplayName";
|
2023-08-23 18:18:46 +02:00
|
|
|
map.insert(CONFIGURATION_ID_KEY, m_id.toSetting());
|
|
|
|
|
map.insert(DISPLAY_NAME_KEY, displayName());
|
|
|
|
|
map.insert(DEFAULT_DISPLAY_NAME_KEY, displayName());
|
2019-07-30 11:29:49 +02:00
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
// Save build steps
|
2023-08-23 18:18:46 +02:00
|
|
|
map.insert(STEPS_COUNT_KEY, m_steps.count());
|
2023-07-21 17:44:01 +02:00
|
|
|
for (int i = 0; i < m_steps.count(); ++i) {
|
2023-08-23 16:53:06 +02:00
|
|
|
Store data;
|
2023-07-21 17:44:01 +02:00
|
|
|
m_steps.at(i)->toMap(data);
|
2023-08-30 09:18:19 +02:00
|
|
|
map.insert(numberedKey(STEPS_PREFIX, i), variantFromStore(data));
|
2023-07-21 17:44:01 +02:00
|
|
|
}
|
2010-07-16 14:00:41 +02:00
|
|
|
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int BuildStepList::count() const
|
|
|
|
|
{
|
|
|
|
|
return m_steps.count();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool BuildStepList::isEmpty() const
|
|
|
|
|
{
|
|
|
|
|
return m_steps.isEmpty();
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
bool BuildStepList::contains(Utils::Id id) const
|
2010-07-16 14:00:41 +02:00
|
|
|
{
|
2014-07-07 19:02:26 +02:00
|
|
|
return Utils::anyOf(steps(), [id](BuildStep *bs){
|
|
|
|
|
return bs->id() == id;
|
|
|
|
|
});
|
2010-07-16 14:00:41 +02:00
|
|
|
}
|
|
|
|
|
|
2019-07-30 11:29:49 +02:00
|
|
|
QString BuildStepList::displayName() const
|
2016-05-02 16:04:45 +02:00
|
|
|
{
|
2019-07-30 11:29:49 +02:00
|
|
|
if (m_id == Constants::BUILDSTEPS_BUILD) {
|
|
|
|
|
//: Display name of the build build step list. Used as part of the labels in the project window.
|
2023-01-13 12:38:22 +01:00
|
|
|
return Tr::tr("Build");
|
2019-07-30 11:29:49 +02:00
|
|
|
}
|
|
|
|
|
if (m_id == Constants::BUILDSTEPS_CLEAN) {
|
|
|
|
|
//: Display name of the clean build step list. Used as part of the labels in the project window.
|
2023-01-13 12:38:22 +01:00
|
|
|
return Tr::tr("Clean");
|
2019-07-30 11:29:49 +02:00
|
|
|
}
|
|
|
|
|
if (m_id == Constants::BUILDSTEPS_DEPLOY) {
|
|
|
|
|
//: Display name of the deploy build step list. Used as part of the labels in the project window.
|
2023-01-13 12:38:22 +01:00
|
|
|
return Tr::tr("Deploy");
|
2019-07-30 11:29:49 +02:00
|
|
|
}
|
|
|
|
|
QTC_CHECK(false);
|
|
|
|
|
return {};
|
2016-05-02 16:04:45 +02:00
|
|
|
}
|
|
|
|
|
|
2023-08-23 16:53:06 +02:00
|
|
|
bool BuildStepList::fromMap(const Store &map)
|
2010-07-16 14:00:41 +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
|
|
|
clear();
|
|
|
|
|
|
2017-12-08 17:20:48 +01:00
|
|
|
const QList<BuildStepFactory *> factories = BuildStepFactory::allBuildStepFactories();
|
2016-05-18 12:37:29 +02:00
|
|
|
|
2023-08-23 18:18:46 +02:00
|
|
|
int maxSteps = map.value(STEPS_COUNT_KEY, 0).toInt();
|
2010-07-16 14:00:41 +02:00
|
|
|
for (int i = 0; i < maxSteps; ++i) {
|
2023-08-30 09:18:19 +02:00
|
|
|
Store bsData = storeFromVariant(map.value(numberedKey(STEPS_PREFIX, i)));
|
2010-07-16 14:00:41 +02:00
|
|
|
if (bsData.isEmpty()) {
|
|
|
|
|
qWarning() << "No step data found for" << i << "(continuing).";
|
|
|
|
|
continue;
|
|
|
|
|
}
|
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 handled = false;
|
2020-06-26 13:59:38 +02:00
|
|
|
Utils::Id stepId = idFromMap(bsData);
|
2022-06-15 15:50:44 +02:00
|
|
|
|
|
|
|
|
// pre-8.0 compat
|
|
|
|
|
if (stepId == "RemoteLinux.CheckForFreeDiskSpaceStep")
|
|
|
|
|
continue;
|
|
|
|
|
|
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
|
|
|
for (BuildStepFactory *factory : factories) {
|
|
|
|
|
if (factory->stepId() == stepId) {
|
|
|
|
|
if (factory->canHandle(this)) {
|
|
|
|
|
if (BuildStep *bs = factory->restore(this, bsData)) {
|
|
|
|
|
appendStep(bs);
|
|
|
|
|
handled = true;
|
|
|
|
|
} else {
|
|
|
|
|
qWarning() << "Restoration of step" << i << "failed (continuing).";
|
|
|
|
|
}
|
2016-05-18 12:37:29 +02:00
|
|
|
}
|
|
|
|
|
}
|
2010-07-16 14:00:41 +02:00
|
|
|
}
|
2018-02-08 14:10:52 +01:00
|
|
|
QTC_ASSERT(handled, qDebug() << "No factory for build step" << stepId.toString() << "found.");
|
2010-07-16 14:00:41 +02:00
|
|
|
}
|
2010-08-25 13:09:55 +02:00
|
|
|
return true;
|
2010-07-16 14:00:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QList<BuildStep *> BuildStepList::steps() const
|
|
|
|
|
{
|
|
|
|
|
return m_steps;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
BuildStep *BuildStepList::firstStepWithId(Utils::Id id) const
|
2019-08-09 10:39:41 +02:00
|
|
|
{
|
|
|
|
|
return Utils::findOrDefault(m_steps, Utils::equal(&BuildStep::id, id));
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
void BuildStepList::insertStep(int position, BuildStep *step)
|
|
|
|
|
{
|
|
|
|
|
m_steps.insert(position, step);
|
|
|
|
|
emit stepInserted(position);
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
void BuildStepList::insertStep(int position, Utils::Id stepId)
|
2019-01-09 14:46:15 +01:00
|
|
|
{
|
|
|
|
|
for (BuildStepFactory *factory : BuildStepFactory::allBuildStepFactories()) {
|
2020-08-18 11:28:40 +02:00
|
|
|
if (factory->stepId() == stepId) {
|
|
|
|
|
BuildStep *step = factory->create(this);
|
|
|
|
|
QTC_ASSERT(step, break);
|
2019-01-09 14:46:15 +01:00
|
|
|
insertStep(position, step);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
QTC_ASSERT(false, qDebug() << "No factory for build step" << stepId.toString() << "found.");
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
bool BuildStepList::removeStep(int position)
|
|
|
|
|
{
|
|
|
|
|
BuildStep *bs = at(position);
|
2013-09-05 14:36:20 +02:00
|
|
|
if (BuildManager::isBuilding(bs))
|
2010-07-16 14:00:41 +02:00
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
emit aboutToRemoveStep(position);
|
|
|
|
|
m_steps.removeAt(position);
|
|
|
|
|
delete bs;
|
|
|
|
|
emit stepRemoved(position);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BuildStepList::moveStepUp(int position)
|
|
|
|
|
{
|
2019-02-11 10:17:53 +01:00
|
|
|
m_steps.swapItemsAt(position - 1, position);
|
2010-07-16 14:00:41 +02:00
|
|
|
emit stepMoved(position, position - 1);
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-10 16:41:27 +02:00
|
|
|
BuildStep *BuildStepList::at(int position) const
|
2010-07-16 14:00:41 +02:00
|
|
|
{
|
|
|
|
|
return m_steps.at(position);
|
|
|
|
|
}
|
2019-07-30 11:29:49 +02:00
|
|
|
|
|
|
|
|
} // ProjectExplorer
|