2013-05-15 13:39:00 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2013-05-15 13:39:00 +02: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-05-15 13:39:00 +02: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-05-15 13:39:00 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "qbsrunconfiguration.h"
|
|
|
|
|
|
|
|
|
|
#include "qbsdeployconfigurationfactory.h"
|
2017-05-04 12:16:38 +02:00
|
|
|
#include "qbsinstallstep.h"
|
2013-05-15 13:39:00 +02:00
|
|
|
#include "qbsproject.h"
|
|
|
|
|
|
2016-04-07 11:08:12 +02:00
|
|
|
#include <coreplugin/messagemanager.h>
|
2017-09-10 16:27:54 +03:00
|
|
|
#include <coreplugin/variablechooser.h>
|
2015-08-21 14:35:28 +02:00
|
|
|
#include <projectexplorer/buildmanager.h>
|
2013-05-15 13:39:00 +02:00
|
|
|
#include <projectexplorer/buildstep.h>
|
|
|
|
|
#include <projectexplorer/buildsteplist.h>
|
|
|
|
|
#include <projectexplorer/deployconfiguration.h>
|
|
|
|
|
#include <projectexplorer/localenvironmentaspect.h>
|
2015-05-05 09:48:50 +02:00
|
|
|
#include <projectexplorer/runconfigurationaspects.h>
|
2013-05-15 13:39:00 +02:00
|
|
|
#include <projectexplorer/target.h>
|
2015-04-30 08:33:38 +02:00
|
|
|
#include <projectexplorer/runconfigurationaspects.h>
|
2016-04-26 23:01:12 +03:00
|
|
|
#include <utils/algorithm.h>
|
2013-05-15 13:39:00 +02:00
|
|
|
#include <utils/qtcprocess.h>
|
|
|
|
|
#include <utils/pathchooser.h>
|
|
|
|
|
#include <utils/detailswidget.h>
|
|
|
|
|
#include <utils/stringutils.h>
|
|
|
|
|
#include <utils/persistentsettings.h>
|
2017-07-17 14:34:05 +02:00
|
|
|
#include <utils/utilsicons.h>
|
2013-05-15 13:39:00 +02:00
|
|
|
#include <qtsupport/qtoutputformatter.h>
|
|
|
|
|
#include <qtsupport/qtsupportconstants.h>
|
|
|
|
|
#include <qtsupport/qtkitinformation.h>
|
|
|
|
|
#include <utils/hostosinfo.h>
|
|
|
|
|
|
2014-06-04 19:03:55 +02:00
|
|
|
#include "api/runenvironment.h"
|
|
|
|
|
|
2013-05-15 13:39:00 +02:00
|
|
|
#include <QFileInfo>
|
|
|
|
|
#include <QFormLayout>
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QLineEdit>
|
|
|
|
|
#include <QCheckBox>
|
|
|
|
|
#include <QToolButton>
|
|
|
|
|
#include <QComboBox>
|
|
|
|
|
#include <QDir>
|
|
|
|
|
|
2014-05-26 22:13:14 +03:00
|
|
|
using namespace ProjectExplorer;
|
2016-01-25 15:00:20 +01:00
|
|
|
using namespace Utils;
|
2014-05-26 22:13:14 +03:00
|
|
|
|
2014-09-05 12:08:15 +02:00
|
|
|
namespace QbsProjectManager {
|
|
|
|
|
namespace Internal {
|
2013-05-15 13:39:00 +02:00
|
|
|
|
|
|
|
|
const char QBS_RC_PREFIX[] = "Qbs.RunConfiguration:";
|
|
|
|
|
|
2014-09-05 12:08:15 +02:00
|
|
|
static QString rcNameSeparator() { return QLatin1String("---Qbs.RC.NameSeparator---"); }
|
|
|
|
|
|
|
|
|
|
const qbs::ProductData findProduct(const qbs::ProjectData &pro, const QString &uniqeName)
|
2013-05-15 13:39:00 +02:00
|
|
|
{
|
2013-06-21 15:09:01 +02:00
|
|
|
foreach (const qbs::ProductData &product, pro.allProducts()) {
|
2014-09-05 12:08:15 +02:00
|
|
|
if (QbsProject::uniqueProductName(product) == uniqeName)
|
2013-06-21 15:09:01 +02:00
|
|
|
return product;
|
2013-05-15 13:39:00 +02:00
|
|
|
}
|
2013-06-21 15:09:01 +02:00
|
|
|
return qbs::ProductData();
|
2013-05-15 13:39:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
// QbsRunConfiguration:
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
2017-09-01 13:23:02 +02:00
|
|
|
QbsRunConfiguration::QbsRunConfiguration(Target *target)
|
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
|
|
|
: RunConfiguration(target, QBS_RC_PREFIX)
|
2013-05-15 13:39:00 +02:00
|
|
|
{
|
2017-09-01 13:23:02 +02:00
|
|
|
auto envAspect = new LocalEnvironmentAspect(this,
|
2017-02-28 11:31:09 +01:00
|
|
|
[](RunConfiguration *rc, Environment &env) {
|
|
|
|
|
static_cast<QbsRunConfiguration *>(rc)->addToBaseEnvironment(env);
|
2017-09-01 13:23:02 +02:00
|
|
|
});
|
2017-02-28 11:31:09 +01:00
|
|
|
addExtraAspect(envAspect);
|
2017-09-01 13:23:02 +02:00
|
|
|
connect(static_cast<QbsProject *>(target->project()), &Project::parsingFinished, this,
|
2017-02-28 11:31:09 +01:00
|
|
|
[envAspect]() { envAspect->buildEnvironmentHasChanged(); });
|
2017-09-01 13:23:02 +02:00
|
|
|
addExtraAspect(new ArgumentsAspect(this, "Qbs.RunConfiguration.CommandLineArguments"));
|
|
|
|
|
addExtraAspect(new WorkingDirectoryAspect(this, "Qbs.RunConfiguration.WorkingDirectory"));
|
2013-05-15 13:39:00 +02:00
|
|
|
|
2017-09-01 13:23:02 +02:00
|
|
|
addExtraAspect(new TerminalAspect(this, "Qbs.RunConfiguration.UseTerminal", isConsoleApplication()));
|
2013-05-15 13:39:00 +02:00
|
|
|
|
2017-09-01 13:23:02 +02:00
|
|
|
QbsProject *project = static_cast<QbsProject *>(target->project());
|
2017-07-13 10:51:15 +02:00
|
|
|
connect(project, &Project::parsingFinished, this, [this](bool success) {
|
2015-05-12 13:05:14 +02:00
|
|
|
auto terminalAspect = extraAspect<TerminalAspect>();
|
|
|
|
|
if (success && !terminalAspect->isUserSet())
|
|
|
|
|
terminalAspect->setUseTerminal(isConsoleApplication());
|
2014-11-07 11:53:08 +01:00
|
|
|
});
|
2015-08-21 14:35:28 +02:00
|
|
|
connect(BuildManager::instance(), &BuildManager::buildStateChanged, this,
|
|
|
|
|
[this, project](Project *p) {
|
2017-11-28 16:31:13 +01:00
|
|
|
if (p == project && !BuildManager::isBuilding(p)) {
|
|
|
|
|
const QString defaultWorkingDir = baseWorkingDirectory();
|
|
|
|
|
if (!defaultWorkingDir.isEmpty()) {
|
|
|
|
|
extraAspect<WorkingDirectoryAspect>()->setDefaultWorkingDirectory(
|
|
|
|
|
Utils::FileName::fromString(defaultWorkingDir));
|
|
|
|
|
}
|
2015-08-21 14:35:28 +02:00
|
|
|
emit enabledChanged();
|
2017-11-28 16:31:13 +01:00
|
|
|
}
|
2015-08-21 14:35:28 +02:00
|
|
|
}
|
|
|
|
|
);
|
2014-11-07 11:53:08 +01:00
|
|
|
|
2017-09-01 13:23:02 +02:00
|
|
|
connect(target, &Target::activeDeployConfigurationChanged,
|
2014-11-07 11:53:08 +01:00
|
|
|
this, &QbsRunConfiguration::installStepChanged);
|
2017-09-01 13:23:02 +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 QbsRunConfiguration::fromMap(const QVariantMap &map)
|
2017-09-01 13:23:02 +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
|
|
|
if (!RunConfiguration::fromMap(map))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
QString extraId = ProjectExplorer::idFromMap(map).suffixAfter(id());
|
|
|
|
|
if (!extraId.isEmpty()) {
|
|
|
|
|
const int sepPos = extraId.indexOf(rcNameSeparator());
|
|
|
|
|
m_uniqueProductName = extraId.left(sepPos);
|
|
|
|
|
m_productDisplayName = sepPos == -1 ? QString() : extraId.mid(sepPos + rcNameSeparator().size());
|
|
|
|
|
}
|
2017-09-01 13:23:02 +02:00
|
|
|
|
|
|
|
|
setDefaultDisplayName(defaultDisplayName());
|
2013-05-15 13:39:00 +02:00
|
|
|
installStepChanged();
|
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 true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString QbsRunConfiguration::extraId() const
|
|
|
|
|
{
|
|
|
|
|
return m_uniqueProductName + rcNameSeparator() + m_productDisplayName;
|
2013-05-15 13:39:00 +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
|
|
|
|
2013-05-15 13:39:00 +02:00
|
|
|
QWidget *QbsRunConfiguration::createConfigurationWidget()
|
|
|
|
|
{
|
2016-01-06 17:58:59 +01:00
|
|
|
return new QbsRunConfigurationWidget(this);
|
2013-05-15 13:39:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QbsRunConfiguration::installStepChanged()
|
|
|
|
|
{
|
2017-05-04 12:16:38 +02:00
|
|
|
if (m_currentInstallStep) {
|
|
|
|
|
disconnect(m_currentInstallStep, &QbsInstallStep::changed,
|
|
|
|
|
this, &QbsRunConfiguration::targetInformationChanged);
|
|
|
|
|
}
|
2013-05-15 13:39:00 +02:00
|
|
|
if (m_currentBuildStepList) {
|
2016-01-06 17:58:59 +01:00
|
|
|
disconnect(m_currentBuildStepList, &BuildStepList::stepInserted,
|
|
|
|
|
this, &QbsRunConfiguration::installStepChanged);
|
|
|
|
|
disconnect(m_currentBuildStepList, &BuildStepList::stepRemoved,
|
|
|
|
|
this, &QbsRunConfiguration::installStepChanged);
|
|
|
|
|
disconnect(m_currentBuildStepList, &BuildStepList::stepMoved,
|
|
|
|
|
this, &QbsRunConfiguration::installStepChanged);
|
2013-05-15 13:39:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QbsDeployConfiguration *activeDc = qobject_cast<QbsDeployConfiguration *>(target()->activeDeployConfiguration());
|
|
|
|
|
m_currentBuildStepList = activeDc ? activeDc->stepList() : 0;
|
2017-05-04 12:16:38 +02:00
|
|
|
if (m_currentInstallStep) {
|
|
|
|
|
connect(m_currentInstallStep, &QbsInstallStep::changed,
|
|
|
|
|
this, &QbsRunConfiguration::targetInformationChanged);
|
|
|
|
|
}
|
2013-05-15 13:39:00 +02:00
|
|
|
if (m_currentBuildStepList) {
|
2016-01-06 17:58:59 +01:00
|
|
|
connect(m_currentBuildStepList, &BuildStepList::stepInserted,
|
|
|
|
|
this, &QbsRunConfiguration::installStepChanged);
|
2017-05-04 12:16:38 +02:00
|
|
|
connect(m_currentBuildStepList, &BuildStepList::aboutToRemoveStep, this,
|
|
|
|
|
&QbsRunConfiguration::installStepToBeRemoved);
|
2016-01-06 17:58:59 +01:00
|
|
|
connect(m_currentBuildStepList, &BuildStepList::stepRemoved,
|
|
|
|
|
this, &QbsRunConfiguration::installStepChanged);
|
|
|
|
|
connect(m_currentBuildStepList, &BuildStepList::stepMoved,
|
|
|
|
|
this, &QbsRunConfiguration::installStepChanged);
|
2013-05-15 13:39:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
emit targetInformationChanged();
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-04 12:16:38 +02:00
|
|
|
void QbsRunConfiguration::installStepToBeRemoved(int pos)
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(m_currentBuildStepList, return);
|
|
|
|
|
// TODO: Our logic is rather broken. Users can create as many qbs install steps as they want,
|
|
|
|
|
// but we ignore all but the first one.
|
|
|
|
|
if (m_currentBuildStepList->steps().at(pos) != m_currentInstallStep)
|
|
|
|
|
return;
|
|
|
|
|
disconnect(m_currentInstallStep, &QbsInstallStep::changed,
|
|
|
|
|
this, &QbsRunConfiguration::targetInformationChanged);
|
|
|
|
|
m_currentInstallStep = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-25 15:00:20 +01:00
|
|
|
Runnable QbsRunConfiguration::runnable() const
|
|
|
|
|
{
|
|
|
|
|
StandardRunnable r;
|
|
|
|
|
r.executable = executable();
|
|
|
|
|
r.workingDirectory = extraAspect<WorkingDirectoryAspect>()->workingDirectory().toString();
|
|
|
|
|
r.commandLineArguments = extraAspect<ArgumentsAspect>()->arguments();
|
|
|
|
|
r.runMode = extraAspect<TerminalAspect>()->runMode();
|
|
|
|
|
r.environment = extraAspect<LocalEnvironmentAspect>()->environment();
|
|
|
|
|
return r;
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-15 13:39:00 +02:00
|
|
|
QString QbsRunConfiguration::executable() const
|
|
|
|
|
{
|
|
|
|
|
QbsProject *pro = static_cast<QbsProject *>(target()->project());
|
2017-11-22 16:36:21 +01:00
|
|
|
const qbs::ProductData product = findProduct(pro->qbsProjectData(), uniqueProductName());
|
2013-05-15 13:39:00 +02:00
|
|
|
|
2013-09-06 18:02:46 +02:00
|
|
|
if (!product.isValid() || !pro->qbsProject().isValid())
|
2013-05-15 13:39:00 +02:00
|
|
|
return QString();
|
|
|
|
|
|
2016-08-10 10:54:15 +02:00
|
|
|
return product.targetExecutable();
|
2013-05-15 13:39:00 +02:00
|
|
|
}
|
|
|
|
|
|
2013-11-19 11:30:00 +01:00
|
|
|
bool QbsRunConfiguration::isConsoleApplication() const
|
2013-05-15 13:39:00 +02:00
|
|
|
{
|
2013-08-07 14:18:19 +02:00
|
|
|
QbsProject *pro = static_cast<QbsProject *>(target()->project());
|
2017-11-22 16:36:21 +01:00
|
|
|
const qbs::ProductData product = findProduct(pro->qbsProjectData(), uniqueProductName());
|
2014-11-07 11:53:08 +01:00
|
|
|
return product.properties().value(QLatin1String("consoleApplication"), false).toBool();
|
2013-05-15 13:39:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString QbsRunConfiguration::baseWorkingDirectory() const
|
|
|
|
|
{
|
|
|
|
|
const QString exe = executable();
|
|
|
|
|
if (!exe.isEmpty())
|
2016-01-05 15:50:17 +02:00
|
|
|
return QFileInfo(exe).absolutePath();
|
2013-05-15 13:39:00 +02:00
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QbsRunConfiguration::addToBaseEnvironment(Utils::Environment &env) const
|
|
|
|
|
{
|
2014-06-04 19:03:55 +02:00
|
|
|
QbsProject *project = static_cast<QbsProject *>(target()->project());
|
2016-07-01 16:55:02 +02:00
|
|
|
if (project && project->qbsProject().isValid()) {
|
2017-11-22 16:36:21 +01:00
|
|
|
const qbs::ProductData product = findProduct(project->qbsProjectData(), uniqueProductName());
|
2014-06-04 19:03:55 +02:00
|
|
|
if (product.isValid()) {
|
2014-09-27 21:44:37 -04:00
|
|
|
QProcessEnvironment procEnv = env.toProcessEnvironment();
|
|
|
|
|
procEnv.insert(QLatin1String("QBS_RUN_FILE_PATH"), executable());
|
2017-02-13 15:40:59 +01:00
|
|
|
qbs::RunEnvironment qbsRunEnv = project->qbsProject().getRunEnvironment(product,
|
|
|
|
|
qbs::InstallOptions(), procEnv, QbsManager::settings());
|
2016-04-07 11:08:12 +02:00
|
|
|
qbs::ErrorInfo error;
|
|
|
|
|
procEnv = qbsRunEnv.runEnvironment(&error);
|
|
|
|
|
if (error.hasError()) {
|
|
|
|
|
Core::MessageManager::write(tr("Error retrieving run environment: %1")
|
|
|
|
|
.arg(error.toString()));
|
|
|
|
|
}
|
2014-06-04 19:03:55 +02:00
|
|
|
if (!procEnv.isEmpty()) {
|
|
|
|
|
env = Utils::Environment();
|
|
|
|
|
foreach (const QString &key, procEnv.keys())
|
|
|
|
|
env.set(key, procEnv.value(key));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-05-15 13:39:00 +02:00
|
|
|
|
|
|
|
|
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(target()->kit());
|
|
|
|
|
if (qtVersion)
|
|
|
|
|
env.prependOrSetLibrarySearchPath(qtVersion->qmakeProperty("QT_INSTALL_LIBS"));
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-27 14:28:49 +01:00
|
|
|
QString QbsRunConfiguration::buildSystemTarget() const
|
2017-06-09 07:53:21 +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
|
|
|
return m_productDisplayName;
|
2017-06-09 07:53:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString QbsRunConfiguration::uniqueProductName() const
|
2013-05-16 16:10:47 +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
|
|
|
return m_uniqueProductName;
|
2013-05-16 16:10:47 +02:00
|
|
|
}
|
|
|
|
|
|
2013-05-15 13:39:00 +02:00
|
|
|
QString QbsRunConfiguration::defaultDisplayName()
|
|
|
|
|
{
|
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
|
|
|
QString defaultName = m_productDisplayName;
|
2014-09-05 12:08:15 +02:00
|
|
|
if (defaultName.isEmpty())
|
2013-05-15 13:39:00 +02:00
|
|
|
defaultName = tr("Qbs Run Configuration");
|
|
|
|
|
return defaultName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Utils::OutputFormatter *QbsRunConfiguration::createOutputFormatter() const
|
|
|
|
|
{
|
|
|
|
|
return new QtSupport::QtOutputFormatter(target()->project());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
// QbsRunConfigurationWidget:
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
2016-01-06 17:58:59 +01:00
|
|
|
QbsRunConfigurationWidget::QbsRunConfigurationWidget(QbsRunConfiguration *rc)
|
|
|
|
|
: m_rc(rc)
|
2013-05-15 13:39:00 +02:00
|
|
|
{
|
2016-01-06 17:58:59 +01:00
|
|
|
auto vboxTopLayout = new QVBoxLayout(this);
|
2013-05-15 13:39:00 +02:00
|
|
|
vboxTopLayout->setMargin(0);
|
|
|
|
|
|
2016-01-06 17:58:59 +01:00
|
|
|
auto detailsContainer = new Utils::DetailsWidget(this);
|
|
|
|
|
detailsContainer->setState(Utils::DetailsWidget::NoSummary);
|
|
|
|
|
vboxTopLayout->addWidget(detailsContainer);
|
|
|
|
|
auto detailsWidget = new QWidget(detailsContainer);
|
|
|
|
|
detailsContainer->setWidget(detailsWidget);
|
|
|
|
|
auto toplayout = new QFormLayout(detailsWidget);
|
2013-05-15 13:39:00 +02:00
|
|
|
toplayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
|
|
|
|
toplayout->setMargin(0);
|
|
|
|
|
|
2015-01-23 12:05:14 +01:00
|
|
|
m_executableLineLabel = new QLabel(this);
|
|
|
|
|
m_executableLineLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
|
|
|
|
setExecutableLineText();
|
|
|
|
|
toplayout->addRow(tr("Executable:"), m_executableLineLabel);
|
2013-05-15 13:39:00 +02:00
|
|
|
|
2015-04-30 08:33:38 +02:00
|
|
|
m_rc->extraAspect<ArgumentsAspect>()->addToMainConfigurationWidget(this, toplayout);
|
2015-05-05 09:48:50 +02:00
|
|
|
m_rc->extraAspect<WorkingDirectoryAspect>()->addToMainConfigurationWidget(this, toplayout);
|
2013-05-15 13:39:00 +02:00
|
|
|
|
2015-05-12 13:05:14 +02:00
|
|
|
m_rc->extraAspect<TerminalAspect>()->addToMainConfigurationWidget(this, toplayout);
|
2013-05-15 13:39:00 +02:00
|
|
|
|
2016-01-06 17:58:59 +01:00
|
|
|
connect(m_rc, &QbsRunConfiguration::targetInformationChanged,
|
|
|
|
|
this, &QbsRunConfigurationWidget::targetInformationHasChanged, Qt::QueuedConnection);
|
2013-05-15 13:39:00 +02:00
|
|
|
|
2016-01-06 17:58:59 +01:00
|
|
|
connect(m_rc, &RunConfiguration::enabledChanged,
|
2017-07-17 16:54:13 +02:00
|
|
|
this, &QbsRunConfigurationWidget::targetInformationHasChanged);
|
2017-10-16 10:06:48 +02:00
|
|
|
targetInformationHasChanged();
|
2017-09-10 16:27:54 +03:00
|
|
|
|
|
|
|
|
Core::VariableChooser::addSupportForChildWidgets(this, rc->macroExpander());
|
2013-05-15 13:39:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QbsRunConfigurationWidget::targetInformationHasChanged()
|
|
|
|
|
{
|
|
|
|
|
m_ignoreChange = true;
|
2015-01-23 12:05:14 +01:00
|
|
|
setExecutableLineText(m_rc->executable());
|
2013-05-24 16:19:55 +02:00
|
|
|
|
2015-05-05 09:48:50 +02:00
|
|
|
WorkingDirectoryAspect *aspect = m_rc->extraAspect<WorkingDirectoryAspect>();
|
|
|
|
|
aspect->pathChooser()->setBaseFileName(m_rc->target()->project()->projectDirectory());
|
2013-05-15 13:39:00 +02:00
|
|
|
m_ignoreChange = false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-23 12:05:14 +01:00
|
|
|
void QbsRunConfigurationWidget::setExecutableLineText(const QString &text)
|
|
|
|
|
{
|
|
|
|
|
const QString newText = text.isEmpty() ? tr("<unknown>") : text;
|
|
|
|
|
m_executableLineLabel->setText(newText);
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-15 13:39:00 +02:00
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
// QbsRunConfigurationFactory:
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
QbsRunConfigurationFactory::QbsRunConfigurationFactory(QObject *parent) :
|
2014-05-26 22:13:14 +03:00
|
|
|
IRunConfigurationFactory(parent)
|
2013-05-15 13:39:00 +02:00
|
|
|
{
|
2017-11-10 15:43:23 +01:00
|
|
|
setObjectName("QbsRunConfigurationFactory");
|
2017-11-20 11:56:19 +01:00
|
|
|
registerRunConfiguration<QbsRunConfiguration>(QBS_RC_PREFIX);
|
2017-11-17 08:24:47 +01:00
|
|
|
setSupportedProjectType<QbsProject>();
|
|
|
|
|
setSupportedTargetDeviceTypes({Constants::DESKTOP_DEVICE_TYPE});
|
2013-05-15 13:39:00 +02:00
|
|
|
}
|
|
|
|
|
|
2017-11-20 11:56:19 +01:00
|
|
|
bool QbsRunConfigurationFactory::canCreateHelper(Target *parent, const QString &buildTarget) const
|
2013-05-15 13:39:00 +02:00
|
|
|
{
|
|
|
|
|
QbsProject *project = static_cast<QbsProject *>(parent->project());
|
2017-11-20 11:56:19 +01:00
|
|
|
QString product = buildTarget.left(buildTarget.indexOf(rcNameSeparator()));
|
|
|
|
|
return findProduct(project->qbsProjectData(), product).isValid();
|
2013-05-15 13:39:00 +02:00
|
|
|
}
|
|
|
|
|
|
2017-11-20 11:56:19 +01:00
|
|
|
QList<QString> QbsRunConfigurationFactory::availableBuildTargets(Target *parent, CreationMode mode) const
|
2013-05-15 13:39:00 +02:00
|
|
|
{
|
2016-04-26 23:01:12 +03:00
|
|
|
QList<qbs::ProductData> products;
|
|
|
|
|
|
2013-05-15 13:39:00 +02:00
|
|
|
QbsProject *project = static_cast<QbsProject *>(parent->project());
|
2013-09-06 18:02:46 +02:00
|
|
|
if (!project || !project->qbsProject().isValid())
|
2017-11-20 11:56:19 +01:00
|
|
|
return {};
|
2013-05-15 13:39:00 +02:00
|
|
|
|
2014-03-21 11:02:54 +01:00
|
|
|
foreach (const qbs::ProductData &product, project->qbsProjectData().allProducts()) {
|
2014-04-30 11:03:14 +02:00
|
|
|
if (product.isRunnable() && product.isEnabled())
|
2016-04-26 23:01:12 +03:00
|
|
|
products << product;
|
2014-03-21 11:02:54 +01:00
|
|
|
}
|
2014-03-03 16:04:44 +01:00
|
|
|
|
2016-04-26 23:01:12 +03:00
|
|
|
if (mode == AutoCreate) {
|
|
|
|
|
std::function<bool (const qbs::ProductData &)> hasQtcRunnable = [](const qbs::ProductData &product) {
|
|
|
|
|
return product.properties().value("qtcRunnable").toBool();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (Utils::anyOf(products, hasQtcRunnable))
|
|
|
|
|
Utils::erase(products, std::not1(hasQtcRunnable));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Utils::transform(products, [project](const qbs::ProductData &product) {
|
2017-11-20 11:56:19 +01:00
|
|
|
return QString(QbsProject::uniqueProductName(product) + rcNameSeparator()
|
|
|
|
|
+ QbsProject::productDisplayName(project->qbsProject(), product));
|
2016-04-26 23:01:12 +03:00
|
|
|
});
|
2013-05-15 13:39:00 +02:00
|
|
|
}
|
|
|
|
|
|
2017-11-20 11:56:19 +01:00
|
|
|
QString QbsRunConfigurationFactory::displayNameForBuildTarget(const QString &buildTarget) const
|
2013-05-15 13:39:00 +02:00
|
|
|
{
|
2017-11-20 11:56:19 +01:00
|
|
|
const int sepPos = buildTarget.indexOf(rcNameSeparator());
|
|
|
|
|
if (sepPos == -1)
|
|
|
|
|
return buildTarget;
|
|
|
|
|
return buildTarget.mid(sepPos + rcNameSeparator().count());
|
2013-05-15 13:39:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace QbsProjectManager
|