2013-01-30 18:19:31 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2013-01-30 18:19:31 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** 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.
|
2013-01-30 18:19:31 +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.
|
2013-01-30 18:19:31 +01:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "qbsbuildconfiguration.h"
|
|
|
|
|
|
|
|
|
|
#include "qbsbuildstep.h"
|
|
|
|
|
#include "qbscleanstep.h"
|
2017-05-04 12:16:38 +02:00
|
|
|
#include "qbsinstallstep.h"
|
2013-01-30 18:19:31 +01:00
|
|
|
#include "qbsproject.h"
|
|
|
|
|
#include "qbsprojectmanagerconstants.h"
|
2016-02-22 17:49:02 +01:00
|
|
|
#include "qbsprojectmanagersettings.h"
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2014-10-22 09:16:55 +02:00
|
|
|
#include <coreplugin/documentmanager.h>
|
2019-01-29 16:51:17 +01:00
|
|
|
|
|
|
|
|
#include <projectexplorer/buildinfo.h>
|
2013-01-30 18:19:31 +01:00
|
|
|
#include <projectexplorer/buildsteplist.h>
|
2017-05-04 12:16:38 +02:00
|
|
|
#include <projectexplorer/deployconfiguration.h>
|
2013-01-30 18:19:31 +01:00
|
|
|
#include <projectexplorer/kit.h>
|
|
|
|
|
#include <projectexplorer/kitinformation.h>
|
2018-10-10 12:52:41 +02:00
|
|
|
#include <projectexplorer/projectexplorer.h>
|
2013-01-30 18:19:31 +01:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2014-10-22 09:16:55 +02:00
|
|
|
#include <projectexplorer/projectmacroexpander.h>
|
2013-01-30 18:19:31 +01:00
|
|
|
#include <projectexplorer/target.h>
|
|
|
|
|
#include <projectexplorer/toolchain.h>
|
2019-01-29 16:51:17 +01:00
|
|
|
|
|
|
|
|
#include <qtsupport/qtkitinformation.h>
|
|
|
|
|
|
2015-02-04 09:32:46 +01:00
|
|
|
#include <utils/mimetypes/mimedatabase.h>
|
2019-01-29 16:51:17 +01:00
|
|
|
#include <utils/qtcassert.h>
|
2015-01-30 13:52:46 +01:00
|
|
|
#include <utils/qtcprocess.h>
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2015-01-30 13:52:46 +01:00
|
|
|
#include <QCoreApplication>
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
using namespace ProjectExplorer;
|
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
|
|
|
using namespace Utils;
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
|
namespace QbsProjectManager {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
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
|
|
|
static FileName defaultBuildDirectory(const QString &projectFilePath, const Kit *k,
|
|
|
|
|
const QString &bcName,
|
|
|
|
|
BuildConfiguration::BuildType buildType)
|
|
|
|
|
{
|
|
|
|
|
const QString projectName = QFileInfo(projectFilePath).completeBaseName();
|
|
|
|
|
ProjectMacroExpander expander(projectFilePath, projectName, k, bcName, buildType);
|
|
|
|
|
QString projectDir = Project::projectDirectory(FileName::fromString(projectFilePath)).toString();
|
2019-03-15 13:11:57 +01:00
|
|
|
QString buildPath = expander.expand(ProjectExplorerPlugin::buildDirectoryTemplate());
|
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
|
|
|
return FileName::fromString(FileUtils::resolvePath(projectDir, buildPath));
|
|
|
|
|
}
|
2014-10-21 18:10:39 +02:00
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
// QbsBuildConfiguration:
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
2018-05-04 16:52:21 +02:00
|
|
|
QbsBuildConfiguration::QbsBuildConfiguration(Target *target, Core::Id id)
|
|
|
|
|
: BuildConfiguration(target, id)
|
2013-01-30 18:19:31 +01:00
|
|
|
{
|
2019-04-26 18:25:28 +02:00
|
|
|
setConfigWidgetHasFrame(true);
|
|
|
|
|
|
|
|
|
|
m_configurationName = addAspect<BaseStringAspect>();
|
|
|
|
|
m_configurationName->setLabelText(tr("Configuration name:"));
|
|
|
|
|
m_configurationName->setSettingsKey("Qbs.configName");
|
|
|
|
|
m_configurationName->setDisplayStyle(BaseStringAspect::LineEditDisplay);
|
|
|
|
|
connect(m_configurationName, &BaseStringAspect::changed,
|
|
|
|
|
this, &BuildConfiguration::buildDirectoryChanged);
|
|
|
|
|
|
2017-07-13 10:51:15 +02:00
|
|
|
connect(project(), &Project::parsingStarted, this, &BuildConfiguration::enabledChanged);
|
|
|
|
|
connect(project(), &Project::parsingFinished, this, &BuildConfiguration::enabledChanged);
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
|
2019-01-29 16:51:17 +01:00
|
|
|
void QbsBuildConfiguration::initialize(const BuildInfo &info)
|
2013-01-30 18:19:31 +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
|
|
|
BuildConfiguration::initialize(info);
|
|
|
|
|
|
2019-01-29 16:51:17 +01:00
|
|
|
QVariantMap configData = info.extraInfo.value<QVariantMap>();
|
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
|
|
|
configData.insert(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY),
|
2019-01-29 16:51:17 +01:00
|
|
|
(info.buildType == BuildConfiguration::Debug)
|
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
|
|
|
? QLatin1String(Constants::QBS_VARIANT_DEBUG)
|
|
|
|
|
: QLatin1String(Constants::QBS_VARIANT_RELEASE));
|
|
|
|
|
|
2019-01-29 16:51:17 +01:00
|
|
|
Utils::FileName buildDir = info.buildDirectory;
|
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 (buildDir.isEmpty())
|
2018-01-10 11:04:36 +01:00
|
|
|
buildDir = defaultBuildDirectory(target()->project()->projectFilePath().toString(),
|
2019-01-29 16:51:17 +01:00
|
|
|
target()->kit(), info.displayName, info.buildType);
|
2018-01-10 11:04:36 +01:00
|
|
|
setBuildDirectory(buildDir);
|
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
|
|
|
|
|
|
|
|
// Add the build configuration.
|
|
|
|
|
QVariantMap bd = configData;
|
|
|
|
|
QString configName = bd.take("configName").toString();
|
|
|
|
|
if (configName.isEmpty()) {
|
|
|
|
|
configName = "qtc_" + target()->kit()->fileSystemFriendlyName() + '_'
|
2019-01-29 16:51:17 +01:00
|
|
|
+ Utils::FileUtils::fileSystemFriendlyName(info.displayName);
|
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
|
|
|
}
|
2019-04-26 18:25:28 +02:00
|
|
|
|
|
|
|
|
m_configurationName->setValue(configName);
|
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 *buildSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
|
|
|
|
auto bs = new QbsBuildStep(buildSteps);
|
2019-01-29 16:51:17 +01:00
|
|
|
if (info.buildType == Release)
|
2018-05-11 16:02:36 +02:00
|
|
|
bs->setQmlDebuggingEnabled(false);
|
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
|
|
|
bs->setQbsConfiguration(bd);
|
|
|
|
|
buildSteps->appendStep(bs);
|
|
|
|
|
|
|
|
|
|
BuildStepList *cleanSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
|
|
|
|
cleanSteps->appendStep(new QbsCleanStep(cleanSteps));
|
|
|
|
|
|
|
|
|
|
emit qbsConfigurationChanged();
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool QbsBuildConfiguration::fromMap(const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
if (!BuildConfiguration::fromMap(map))
|
|
|
|
|
return false;
|
|
|
|
|
|
2019-04-26 18:25:28 +02:00
|
|
|
if (m_configurationName->value().isEmpty()) { // pre-4.4 backwards compatibility
|
2018-02-01 17:25:14 +01:00
|
|
|
const QString profileName = QbsManager::profileForKit(target()->kit());
|
2017-06-12 14:59:48 +02:00
|
|
|
const QString buildVariant = qbsConfiguration()
|
|
|
|
|
.value(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY)).toString();
|
2019-04-26 18:25:28 +02:00
|
|
|
m_configurationName->setValue(profileName + '-' + buildVariant);
|
2017-06-12 14:59:48 +02:00
|
|
|
}
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QbsBuildStep *QbsBuildConfiguration::qbsStep() const
|
|
|
|
|
{
|
2016-04-19 12:36:11 +02:00
|
|
|
return stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD)->firstOfType<QbsBuildStep>();
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap QbsBuildConfiguration::qbsConfiguration() const
|
|
|
|
|
{
|
|
|
|
|
QVariantMap config;
|
|
|
|
|
QbsBuildStep *qbsBs = qbsStep();
|
|
|
|
|
if (qbsBs)
|
2016-10-23 06:01:41 +03:00
|
|
|
config = qbsBs->qbsConfiguration(QbsBuildStep::ExpandVariables);
|
2013-01-30 18:19:31 +01:00
|
|
|
return config;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Internal::QbsProject *QbsBuildConfiguration::project() const
|
|
|
|
|
{
|
2017-07-31 14:57:21 +02:00
|
|
|
return qobject_cast<Internal::QbsProject *>(BuildConfiguration::project());
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool QbsBuildConfiguration::isEnabled() const
|
|
|
|
|
{
|
|
|
|
|
return !project()->isParsing() && project()->hasParseResult();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString QbsBuildConfiguration::disabledReason() const
|
|
|
|
|
{
|
|
|
|
|
if (project()->isParsing())
|
|
|
|
|
return tr("Parsing the Qbs project.");
|
|
|
|
|
if (!project()->hasParseResult())
|
|
|
|
|
return tr("Parsing of Qbs project has failed.");
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
BuildConfiguration::BuildType QbsBuildConfiguration::buildType() const
|
2013-01-30 18:19:31 +01:00
|
|
|
{
|
|
|
|
|
QString variant;
|
|
|
|
|
if (qbsStep())
|
|
|
|
|
variant = qbsStep()->buildVariant();
|
|
|
|
|
|
|
|
|
|
if (variant == QLatin1String(Constants::QBS_VARIANT_DEBUG))
|
|
|
|
|
return Debug;
|
|
|
|
|
if (variant == QLatin1String(Constants::QBS_VARIANT_RELEASE))
|
|
|
|
|
return Release;
|
|
|
|
|
return Unknown;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QbsBuildConfiguration::setChangedFiles(const QStringList &files)
|
|
|
|
|
{
|
|
|
|
|
m_changedFiles = files;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QStringList QbsBuildConfiguration::changedFiles() const
|
|
|
|
|
{
|
|
|
|
|
return m_changedFiles;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-24 16:47:02 +02:00
|
|
|
void QbsBuildConfiguration::setActiveFileTags(const QStringList &fileTags)
|
|
|
|
|
{
|
|
|
|
|
m_activeFileTags = fileTags;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QStringList QbsBuildConfiguration::activeFileTags() const
|
|
|
|
|
{
|
|
|
|
|
return m_activeFileTags;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-10 15:40:18 +02:00
|
|
|
void QbsBuildConfiguration::setProducts(const QStringList &products)
|
|
|
|
|
{
|
|
|
|
|
m_products = products;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QStringList QbsBuildConfiguration::products() const
|
|
|
|
|
{
|
|
|
|
|
return m_products;
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-13 15:40:59 +01:00
|
|
|
QString QbsBuildConfiguration::configurationName() const
|
|
|
|
|
{
|
2019-04-26 18:25:28 +02:00
|
|
|
return m_configurationName->value();
|
2017-02-13 15:40:59 +01:00
|
|
|
}
|
|
|
|
|
|
2015-01-30 13:52:46 +01:00
|
|
|
class StepProxy
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
StepProxy(const BuildStep *buildStep)
|
|
|
|
|
: m_qbsBuildStep(qobject_cast<const QbsBuildStep *>(buildStep))
|
|
|
|
|
, m_qbsCleanStep(qobject_cast<const QbsCleanStep *>(buildStep))
|
2017-05-04 12:16:38 +02:00
|
|
|
, m_qbsInstallStep(qobject_cast<const QbsInstallStep *>(buildStep))
|
2015-01-30 13:52:46 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString command() const {
|
|
|
|
|
if (m_qbsBuildStep)
|
|
|
|
|
return QLatin1String("build");
|
2017-05-04 12:16:38 +02:00
|
|
|
if (m_qbsInstallStep)
|
|
|
|
|
return QLatin1String("install");
|
2017-02-13 15:40:59 +01:00
|
|
|
return QLatin1String("clean");
|
2015-01-30 13:52:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool dryRun() const {
|
|
|
|
|
if (m_qbsBuildStep)
|
2016-01-22 11:56:23 +01:00
|
|
|
return false;
|
2017-05-04 12:16:38 +02:00
|
|
|
if (m_qbsInstallStep)
|
|
|
|
|
return m_qbsInstallStep->dryRun();
|
2017-02-13 15:40:59 +01:00
|
|
|
return m_qbsCleanStep->dryRun();
|
2015-01-30 13:52:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool keepGoing() const {
|
|
|
|
|
if (m_qbsBuildStep)
|
|
|
|
|
return m_qbsBuildStep->keepGoing();
|
2017-05-04 12:16:38 +02:00
|
|
|
if (m_qbsInstallStep)
|
|
|
|
|
return m_qbsInstallStep->keepGoing();
|
2017-02-13 15:40:59 +01:00
|
|
|
return m_qbsCleanStep->keepGoing();
|
2015-01-30 13:52:46 +01:00
|
|
|
}
|
|
|
|
|
|
2017-10-20 14:15:57 +02:00
|
|
|
bool forceProbeExecution() const { return m_qbsBuildStep && m_qbsBuildStep->forceProbes(); }
|
|
|
|
|
|
2015-01-30 13:52:46 +01:00
|
|
|
bool showCommandLines() const {
|
|
|
|
|
return m_qbsBuildStep ? m_qbsBuildStep->showCommandLines() : false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool noInstall() const {
|
|
|
|
|
return m_qbsBuildStep ? !m_qbsBuildStep->install() : false;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-04 12:16:38 +02:00
|
|
|
bool noBuild() const { return m_qbsInstallStep; }
|
|
|
|
|
|
2015-01-30 13:52:46 +01:00
|
|
|
bool cleanInstallRoot() const {
|
|
|
|
|
if (m_qbsBuildStep)
|
|
|
|
|
return m_qbsBuildStep->cleanInstallRoot();
|
2017-05-04 12:16:38 +02:00
|
|
|
if (m_qbsInstallStep)
|
|
|
|
|
return m_qbsInstallStep->removeFirst();
|
2015-01-30 13:52:46 +01:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int jobCount() const {
|
|
|
|
|
return m_qbsBuildStep ? m_qbsBuildStep->maxJobs() : 0;
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-13 15:40:59 +01:00
|
|
|
Utils::FileName installRoot() const {
|
2017-05-04 12:16:38 +02:00
|
|
|
const QbsBuildStep *bs = nullptr;
|
|
|
|
|
if (m_qbsBuildStep) {
|
|
|
|
|
bs = m_qbsBuildStep;
|
|
|
|
|
} else if (m_qbsInstallStep) {
|
|
|
|
|
bs = static_cast<QbsBuildConfiguration *>(m_qbsInstallStep->deployConfiguration()
|
|
|
|
|
->target()->activeBuildConfiguration())->qbsStep();
|
|
|
|
|
}
|
|
|
|
|
if (bs && bs->hasCustomInstallRoot())
|
|
|
|
|
return bs->installRoot();
|
2017-02-13 15:40:59 +01:00
|
|
|
return Utils::FileName();
|
2015-01-30 13:52:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
const QbsBuildStep * const m_qbsBuildStep;
|
|
|
|
|
const QbsCleanStep * const m_qbsCleanStep;
|
2017-05-04 12:16:38 +02:00
|
|
|
const QbsInstallStep * const m_qbsInstallStep;
|
2015-01-30 13:52:46 +01:00
|
|
|
};
|
|
|
|
|
|
2017-02-13 15:40:59 +01:00
|
|
|
QString QbsBuildConfiguration::equivalentCommandLine(const BuildStep *buildStep) const
|
2015-01-30 13:52:46 +01:00
|
|
|
{
|
|
|
|
|
QString commandLine;
|
|
|
|
|
const QString qbsInstallDir = QString::fromLocal8Bit(qgetenv("QBS_INSTALL_DIR"));
|
|
|
|
|
const QString qbsFilePath = Utils::HostOsInfo::withExecutableSuffix(!qbsInstallDir.isEmpty()
|
|
|
|
|
? qbsInstallDir + QLatin1String("/bin/qbs")
|
|
|
|
|
: QCoreApplication::applicationDirPath() + QLatin1String("/qbs"));
|
2015-04-28 20:27:19 -07:00
|
|
|
Utils::QtcProcess::addArg(&commandLine, QDir::toNativeSeparators(qbsFilePath));
|
2015-01-30 13:52:46 +01:00
|
|
|
const StepProxy stepProxy(buildStep);
|
|
|
|
|
Utils::QtcProcess::addArg(&commandLine, stepProxy.command());
|
2017-02-13 15:40:59 +01:00
|
|
|
const QString buildDir = buildDirectory().toUserOutput();
|
2017-02-22 15:09:35 +01:00
|
|
|
Utils::QtcProcess::addArgs(&commandLine, QStringList({"-d", buildDir}));
|
2017-02-09 14:00:07 +01:00
|
|
|
Utils::QtcProcess::addArgs(&commandLine, QStringList("-f")
|
2015-01-30 13:52:46 +01:00
|
|
|
<< buildStep->project()->projectFilePath().toUserOutput());
|
2016-02-22 17:49:02 +01:00
|
|
|
if (QbsProjectManagerSettings::useCreatorSettingsDirForQbs()) {
|
2017-02-22 15:09:35 +01:00
|
|
|
Utils::QtcProcess::addArgs(&commandLine, QStringList({"--settings-dir",
|
|
|
|
|
QDir::toNativeSeparators(QbsProjectManagerSettings::qbsSettingsBaseDir())}));
|
2016-02-22 17:49:02 +01:00
|
|
|
}
|
2015-01-30 13:52:46 +01:00
|
|
|
if (stepProxy.dryRun())
|
|
|
|
|
Utils::QtcProcess::addArg(&commandLine, QLatin1String("--dry-run"));
|
|
|
|
|
if (stepProxy.keepGoing())
|
|
|
|
|
Utils::QtcProcess::addArg(&commandLine, QLatin1String("--keep-going"));
|
2017-10-20 14:15:57 +02:00
|
|
|
if (stepProxy.forceProbeExecution())
|
|
|
|
|
Utils::QtcProcess::addArg(&commandLine, QLatin1String("--force-probe-execution"));
|
2015-01-30 13:52:46 +01:00
|
|
|
if (stepProxy.showCommandLines())
|
2017-02-22 15:09:35 +01:00
|
|
|
Utils::QtcProcess::addArgs(&commandLine, QStringList({"--command-echo-mode",
|
|
|
|
|
"command-line"}));
|
2015-01-30 13:52:46 +01:00
|
|
|
if (stepProxy.noInstall())
|
|
|
|
|
Utils::QtcProcess::addArg(&commandLine, QLatin1String("--no-install"));
|
2017-05-04 12:16:38 +02:00
|
|
|
if (stepProxy.noBuild())
|
|
|
|
|
Utils::QtcProcess::addArg(&commandLine, QLatin1String("--no-build"));
|
2015-01-30 13:52:46 +01:00
|
|
|
if (stepProxy.cleanInstallRoot())
|
|
|
|
|
Utils::QtcProcess::addArg(&commandLine, QLatin1String("--clean-install-root"));
|
|
|
|
|
const int jobCount = stepProxy.jobCount();
|
|
|
|
|
if (jobCount > 0) {
|
2017-02-22 15:09:35 +01:00
|
|
|
Utils::QtcProcess::addArgs(&commandLine, QStringList({"--jobs",
|
|
|
|
|
QString::number(jobCount)}));
|
2015-01-30 13:52:46 +01:00
|
|
|
}
|
2018-02-01 17:25:14 +01:00
|
|
|
const QString profileName = QbsManager::profileForKit(buildStep->target()->kit());
|
2017-02-13 15:40:59 +01:00
|
|
|
const QString buildVariant = qbsConfiguration()
|
|
|
|
|
.value(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY)).toString();
|
2018-03-09 17:12:52 +01:00
|
|
|
Utils::QtcProcess::addArg(&commandLine, QLatin1String("config:") + configurationName());
|
2017-02-13 15:40:59 +01:00
|
|
|
Utils::QtcProcess::addArg(&commandLine, QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY)
|
2016-06-27 16:16:47 +02:00
|
|
|
+ QLatin1Char(':') + buildVariant);
|
2017-02-13 15:40:59 +01:00
|
|
|
const Utils::FileName installRoot = stepProxy.installRoot();
|
|
|
|
|
if (!installRoot.isEmpty()) {
|
|
|
|
|
Utils::QtcProcess::addArg(&commandLine, QLatin1String(Constants::QBS_INSTALL_ROOT_KEY)
|
|
|
|
|
+ QLatin1Char(':') + installRoot.toUserOutput());
|
2017-05-04 12:16:38 +02:00
|
|
|
if (qobject_cast<const QbsInstallStep *>(buildStep)) {
|
|
|
|
|
Utils::QtcProcess::addArgs(&commandLine, QStringList({ QLatin1String("--installRoot"),
|
|
|
|
|
installRoot.toUserOutput() } ));
|
|
|
|
|
}
|
2015-01-30 13:52:46 +01:00
|
|
|
}
|
2016-06-27 16:16:47 +02:00
|
|
|
Utils::QtcProcess::addArg(&commandLine, QLatin1String("profile:") + profileName);
|
2015-01-30 13:52:46 +01:00
|
|
|
|
|
|
|
|
return commandLine;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
// QbsBuildConfigurationFactory:
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
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
|
|
|
QbsBuildConfigurationFactory::QbsBuildConfigurationFactory()
|
2013-01-30 18:19:31 +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
|
|
|
registerBuildConfiguration<QbsBuildConfiguration>(Constants::QBS_BC_ID);
|
|
|
|
|
setSupportedProjectType(Constants::PROJECT_ID);
|
|
|
|
|
setSupportedProjectMimeTypeName(Constants::MIME_TYPE);
|
2019-05-27 16:09:44 +02:00
|
|
|
setIssueReporter([](Kit *k, const QString &projectPath, const QString &buildDir) -> Tasks {
|
2019-02-06 12:50:51 +01:00
|
|
|
const QtSupport::BaseQtVersion * const version = QtSupport::QtKitAspect::qtVersion(k);
|
2019-01-29 16:51:17 +01:00
|
|
|
return version ? version->reportIssues(projectPath, buildDir)
|
2019-05-27 16:09:44 +02:00
|
|
|
: Tasks();
|
2019-01-29 16:51:17 +01:00
|
|
|
});
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
|
2019-01-29 16:51:17 +01:00
|
|
|
BuildInfo QbsBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
|
|
|
|
BuildConfiguration::BuildType type) const
|
2013-01-30 18:19:31 +01:00
|
|
|
{
|
2019-01-29 16:51:17 +01:00
|
|
|
BuildInfo info(this);
|
|
|
|
|
info.kitId = k->id();
|
|
|
|
|
info.buildType = type;
|
|
|
|
|
info.typeName = tr("Build");
|
|
|
|
|
QVariantMap config;
|
|
|
|
|
config.insert("configName", type == BuildConfiguration::Debug ? "Debug" : "Release");
|
|
|
|
|
info.extraInfo = config;
|
2013-07-22 15:53:57 +02:00
|
|
|
return info;
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
|
2019-01-29 16:51:17 +01:00
|
|
|
QList<BuildInfo> QbsBuildConfigurationFactory::availableBuilds(const Target *parent) const
|
2013-01-30 18:19:31 +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
|
|
|
return {createBuildInfo(parent->kit(), BuildConfiguration::Debug)};
|
2014-10-22 09:16:55 +02:00
|
|
|
}
|
|
|
|
|
|
2019-01-29 16:51:17 +01:00
|
|
|
QList<BuildInfo> QbsBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
2013-08-13 10:52:57 +02:00
|
|
|
{
|
2019-01-29 16:51:17 +01:00
|
|
|
QList<BuildInfo> result;
|
2013-08-13 10:52:57 +02:00
|
|
|
|
2019-01-29 16:51:17 +01:00
|
|
|
BuildInfo info = createBuildInfo(k, BuildConfiguration::Debug);
|
2013-08-13 10:52:57 +02:00
|
|
|
//: The name of the debug build configuration created by default for a qbs project.
|
2019-01-29 16:51:17 +01:00
|
|
|
info.displayName = tr("Debug");
|
2015-04-15 22:50:32 +03:00
|
|
|
//: Non-ASCII characters in directory suffix may cause build issues.
|
2019-01-29 16:51:17 +01:00
|
|
|
info.buildDirectory
|
2015-10-22 17:26:33 +02:00
|
|
|
= defaultBuildDirectory(projectPath, k, tr("Debug", "Shadow build directory suffix"),
|
2019-01-29 16:51:17 +01:00
|
|
|
info.buildType);
|
2013-08-13 10:52:57 +02:00
|
|
|
result << info;
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
info = createBuildInfo(k, BuildConfiguration::Release);
|
2013-08-13 10:52:57 +02:00
|
|
|
//: The name of the release build configuration created by default for a qbs project.
|
2019-01-29 16:51:17 +01:00
|
|
|
info.displayName = tr("Release");
|
2015-04-15 22:50:32 +03:00
|
|
|
//: Non-ASCII characters in directory suffix may cause build issues.
|
2019-01-29 16:51:17 +01:00
|
|
|
info.buildDirectory
|
2015-10-22 17:26:33 +02:00
|
|
|
= defaultBuildDirectory(projectPath, k, tr("Release", "Shadow build directory suffix"),
|
2019-01-29 16:51:17 +01:00
|
|
|
info.buildType);
|
2013-08-13 10:52:57 +02:00
|
|
|
result << info;
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace QbsProjectManager
|