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 "qbsbuildstep.h"
|
|
|
|
|
|
|
|
#include "qbsbuildconfiguration.h"
|
|
|
|
#include "qbsparser.h"
|
|
|
|
#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
|
|
|
|
|
|
|
#include "ui_qbsbuildstepconfigwidget.h"
|
|
|
|
|
2014-03-03 17:32:40 +01:00
|
|
|
#include <coreplugin/icore.h>
|
2016-09-20 17:11:03 +03:00
|
|
|
#include <coreplugin/variablechooser.h>
|
2013-01-30 18:19:31 +01:00
|
|
|
#include <projectexplorer/buildsteplist.h>
|
|
|
|
#include <projectexplorer/kit.h>
|
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
|
|
|
#include <projectexplorer/target.h>
|
2013-06-13 17:15:44 +02:00
|
|
|
#include <qtsupport/qtversionmanager.h>
|
2016-09-20 17:11:03 +03:00
|
|
|
#include <utils/macroexpander.h>
|
2013-01-30 18:19:31 +01:00
|
|
|
#include <utils/qtcassert.h>
|
2013-06-12 14:36:02 +02:00
|
|
|
#include <utils/qtcprocess.h>
|
2016-08-03 17:55:54 +02:00
|
|
|
#include <utils/utilsicons.h>
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
#include <qbs.h>
|
|
|
|
|
|
|
|
static const char QBS_CONFIG[] = "Qbs.Configuration";
|
|
|
|
static const char QBS_DRY_RUN[] = "Qbs.DryRun";
|
|
|
|
static const char QBS_KEEP_GOING[] = "Qbs.DryKeepGoing";
|
|
|
|
static const char QBS_MAXJOBCOUNT[] = "Qbs.MaxJobs";
|
2014-11-20 11:10:13 +01:00
|
|
|
static const char QBS_SHOWCOMMANDLINES[] = "Qbs.ShowCommandLines";
|
2015-01-09 10:29:55 +01:00
|
|
|
static const char QBS_INSTALL[] = "Qbs.Install";
|
|
|
|
static const char QBS_CLEAN_INSTALL_ROOT[] = "Qbs.CleanInstallRoot";
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
// Constants:
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
|
|
namespace QbsProjectManager {
|
|
|
|
namespace Internal {
|
|
|
|
|
2016-10-23 05:52:51 +03:00
|
|
|
class QbsBuildStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
QbsBuildStepConfigWidget(QbsBuildStep *step);
|
|
|
|
~QbsBuildStepConfigWidget();
|
|
|
|
QString summaryText() const;
|
|
|
|
QString displayName() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void updateState();
|
|
|
|
void updateQmlDebuggingOption();
|
|
|
|
void updatePropertyEdit(const QVariantMap &data);
|
|
|
|
|
|
|
|
void changeBuildVariant(int);
|
|
|
|
void changeShowCommandLines(bool show);
|
|
|
|
void changeKeepGoing(bool kg);
|
|
|
|
void changeJobCount(int count);
|
|
|
|
void changeInstall(bool install);
|
|
|
|
void changeCleanInstallRoot(bool clean);
|
2017-02-13 15:40:59 +01:00
|
|
|
void changeUseDefaultInstallDir(bool useDefault);
|
|
|
|
void changeInstallDir(const QString &dir);
|
2016-10-23 05:52:51 +03:00
|
|
|
void changeForceProbes(bool forceProbes);
|
|
|
|
void applyCachedProperties();
|
|
|
|
|
|
|
|
// QML debugging:
|
|
|
|
void linkQmlDebuggingLibraryChecked(bool checked);
|
|
|
|
|
|
|
|
bool validateProperties(Utils::FancyLineEdit *edit, QString *errorMessage);
|
|
|
|
|
|
|
|
Ui::QbsBuildStepConfigWidget *m_ui;
|
|
|
|
|
2016-10-23 06:01:41 +03:00
|
|
|
class Property
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Property() = default;
|
|
|
|
Property(const QString &n, const QString &v, const QString &e) :
|
|
|
|
name(n), value(v), effectiveValue(e)
|
|
|
|
{}
|
|
|
|
bool operator==(const Property &other) const
|
|
|
|
{
|
|
|
|
return name == other.name
|
|
|
|
&& value == other.value
|
|
|
|
&& effectiveValue == other.effectiveValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString name;
|
|
|
|
QString value;
|
|
|
|
QString effectiveValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
QList<Property> m_propertyCache;
|
2016-10-23 05:52:51 +03:00
|
|
|
QbsBuildStep *m_step;
|
|
|
|
QString m_summary;
|
|
|
|
bool m_ignoreChange;
|
|
|
|
};
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
// --------------------------------------------------------------------
|
|
|
|
// QbsBuildStep:
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
|
|
QbsBuildStep::QbsBuildStep(ProjectExplorer::BuildStepList *bsl) :
|
|
|
|
ProjectExplorer::BuildStep(bsl, Core::Id(Constants::QBS_BUILDSTEP_ID)),
|
2014-07-14 14:22:27 +02:00
|
|
|
m_job(0), m_parser(0), m_parsingProject(false)
|
2013-01-30 18:19:31 +01:00
|
|
|
{
|
2013-04-12 16:19:22 +02:00
|
|
|
setDisplayName(tr("Qbs Build"));
|
2013-05-27 11:36:44 +02:00
|
|
|
setQbsConfiguration(QVariantMap());
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
QbsBuildStep::QbsBuildStep(ProjectExplorer::BuildStepList *bsl, const QbsBuildStep *other) :
|
|
|
|
ProjectExplorer::BuildStep(bsl, Core::Id(Constants::QBS_BUILDSTEP_ID)),
|
2014-07-14 14:22:27 +02:00
|
|
|
m_qbsBuildOptions(other->m_qbsBuildOptions), m_job(0), m_parser(0), m_parsingProject(false)
|
2013-06-13 17:53:02 +02:00
|
|
|
{
|
2016-10-23 06:01:41 +03:00
|
|
|
setQbsConfiguration(other->qbsConfiguration(PreserveVariables));
|
2013-06-13 17:53:02 +02:00
|
|
|
}
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
QbsBuildStep::~QbsBuildStep()
|
|
|
|
{
|
|
|
|
cancel();
|
2013-04-17 15:32:59 +02:00
|
|
|
if (m_job) {
|
|
|
|
m_job->deleteLater();
|
|
|
|
m_job = 0;
|
|
|
|
}
|
2013-01-30 18:19:31 +01:00
|
|
|
delete m_parser;
|
|
|
|
}
|
|
|
|
|
2015-11-13 12:19:35 +01:00
|
|
|
bool QbsBuildStep::init(QList<const BuildStep *> &earlierSteps)
|
2013-01-30 18:19:31 +01:00
|
|
|
{
|
2015-11-13 12:19:35 +01:00
|
|
|
Q_UNUSED(earlierSteps);
|
2013-01-30 18:19:31 +01:00
|
|
|
if (static_cast<QbsProject *>(project())->isParsing() || m_job)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
QbsBuildConfiguration *bc = static_cast<QbsBuildConfiguration *>(buildConfiguration());
|
|
|
|
if (!bc)
|
|
|
|
bc = static_cast<QbsBuildConfiguration *>(target()->activeBuildConfiguration());
|
|
|
|
|
|
|
|
if (!bc)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
delete m_parser;
|
|
|
|
m_parser = new Internal::QbsParser;
|
|
|
|
ProjectExplorer::IOutputParser *parser = target()->kit()->createOutputParser();
|
|
|
|
if (parser)
|
|
|
|
m_parser->appendOutputParser(parser);
|
|
|
|
|
|
|
|
m_changedFiles = bc->changedFiles();
|
2013-07-24 16:47:02 +02:00
|
|
|
m_activeFileTags = bc->activeFileTags();
|
2013-06-10 15:40:18 +02:00
|
|
|
m_products = bc->products();
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2016-06-28 23:29:21 +03:00
|
|
|
connect(m_parser, &ProjectExplorer::IOutputParser::addOutput,
|
|
|
|
this, [this](const QString &string, ProjectExplorer::BuildStep::OutputFormat format) {
|
|
|
|
emit addOutput(string, format);
|
|
|
|
});
|
2016-05-25 15:58:20 +02:00
|
|
|
connect(m_parser, &ProjectExplorer::IOutputParser::addTask, this, &QbsBuildStep::addTask);
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QbsBuildStep::run(QFutureInterface<bool> &fi)
|
|
|
|
{
|
|
|
|
m_fi = &fi;
|
|
|
|
|
2014-07-14 14:22:27 +02:00
|
|
|
// We need a pre-build parsing step in order not to lose project file changes done
|
|
|
|
// right before building (but before the delay has elapsed).
|
|
|
|
parseProject();
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ProjectExplorer::BuildStepConfigWidget *QbsBuildStep::createConfigWidget()
|
|
|
|
{
|
|
|
|
return new QbsBuildStepConfigWidget(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QbsBuildStep::runInGuiThread() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QbsBuildStep::cancel()
|
|
|
|
{
|
2014-07-14 14:22:27 +02:00
|
|
|
if (m_parsingProject)
|
|
|
|
qbsProject()->cancelParsing();
|
|
|
|
else if (m_job)
|
2013-01-30 18:19:31 +01:00
|
|
|
m_job->cancel();
|
|
|
|
}
|
|
|
|
|
2016-10-23 06:01:41 +03:00
|
|
|
QVariantMap QbsBuildStep::qbsConfiguration(VariableHandling variableHandling) const
|
2013-01-30 18:19:31 +01:00
|
|
|
{
|
2016-06-17 17:22:30 +02:00
|
|
|
QVariantMap config = m_qbsConfiguration;
|
2017-07-27 23:27:25 +03:00
|
|
|
config.insert(Constants::QBS_FORCE_PROBES_KEY, m_forceProbes);
|
2016-10-23 06:01:41 +03:00
|
|
|
if (variableHandling == ExpandVariables) {
|
|
|
|
const Utils::MacroExpander *expander = Utils::globalMacroExpander();
|
2016-11-08 14:15:24 +01:00
|
|
|
for (auto it = config.begin(), end = config.end(); it != end; ++it) {
|
|
|
|
const QString rawString = it.value().toString();
|
|
|
|
const QString expandedString = expander->expand(rawString);
|
|
|
|
it.value() = qbs::representationToSettingsValue(expandedString);
|
|
|
|
}
|
2016-10-23 06:01:41 +03:00
|
|
|
}
|
2016-06-17 17:22:30 +02:00
|
|
|
return config;
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void QbsBuildStep::setQbsConfiguration(const QVariantMap &config)
|
|
|
|
{
|
|
|
|
QbsProject *pro = static_cast<QbsProject *>(project());
|
|
|
|
|
|
|
|
QVariantMap tmp = config;
|
2017-07-27 23:27:25 +03:00
|
|
|
tmp.insert(Constants::QBS_CONFIG_PROFILE_KEY, pro->profileForTarget(target()));
|
|
|
|
if (!tmp.contains(Constants::QBS_CONFIG_VARIANT_KEY))
|
|
|
|
tmp.insert(Constants::QBS_CONFIG_VARIANT_KEY,
|
2013-01-30 18:19:31 +01:00
|
|
|
QString::fromLatin1(Constants::QBS_VARIANT_DEBUG));
|
|
|
|
|
|
|
|
if (tmp == m_qbsConfiguration)
|
|
|
|
return;
|
|
|
|
m_qbsConfiguration = tmp;
|
2014-06-19 15:29:11 +02:00
|
|
|
QbsBuildConfiguration *bc = static_cast<QbsBuildConfiguration *>(buildConfiguration());
|
|
|
|
if (bc)
|
|
|
|
bc->emitBuildTypeChanged();
|
2013-01-30 18:19:31 +01:00
|
|
|
emit qbsConfigurationChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QbsBuildStep::keepGoing() const
|
|
|
|
{
|
2013-05-23 17:15:52 +02:00
|
|
|
return m_qbsBuildOptions.keepGoing();
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
2014-11-20 11:10:13 +01:00
|
|
|
bool QbsBuildStep::showCommandLines() const
|
|
|
|
{
|
2015-03-09 15:48:31 +01:00
|
|
|
return m_qbsBuildOptions.echoMode() == qbs::CommandEchoModeCommandLine;
|
2014-11-20 11:10:13 +01:00
|
|
|
}
|
|
|
|
|
2015-01-09 10:29:55 +01:00
|
|
|
bool QbsBuildStep::install() const
|
|
|
|
{
|
|
|
|
return m_qbsBuildOptions.install();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QbsBuildStep::cleanInstallRoot() const
|
|
|
|
{
|
|
|
|
return m_qbsBuildOptions.removeExistingInstallation();
|
|
|
|
}
|
|
|
|
|
2017-02-13 15:40:59 +01:00
|
|
|
bool QbsBuildStep::hasCustomInstallRoot() const
|
|
|
|
{
|
2017-07-27 23:27:25 +03:00
|
|
|
return m_qbsConfiguration.contains(Constants::QBS_INSTALL_ROOT_KEY);
|
2017-02-13 15:40:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Utils::FileName QbsBuildStep::installRoot() const
|
|
|
|
{
|
|
|
|
Utils::FileName root = Utils::FileName::fromString(m_qbsConfiguration
|
2017-07-27 23:27:25 +03:00
|
|
|
.value(Constants::QBS_INSTALL_ROOT_KEY).toString());
|
2017-02-13 15:40:59 +01:00
|
|
|
if (root.isNull()) {
|
|
|
|
const QbsBuildConfiguration * const bc
|
|
|
|
= static_cast<QbsBuildConfiguration *>(buildConfiguration());
|
|
|
|
root = bc->buildDirectory().appendPath(bc->configurationName())
|
|
|
|
.appendPath(qbs::InstallOptions::defaultInstallRoot());
|
|
|
|
}
|
|
|
|
return root;
|
|
|
|
}
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
int QbsBuildStep::maxJobs() const
|
|
|
|
{
|
2013-05-24 16:20:10 +02:00
|
|
|
if (m_qbsBuildOptions.maxJobCount() > 0)
|
|
|
|
return m_qbsBuildOptions.maxJobCount();
|
2013-04-12 17:26:10 +02:00
|
|
|
return qbs::BuildOptions::defaultMaxJobCount();
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
2016-06-17 17:22:30 +02:00
|
|
|
static QString forceProbesKey() { return QLatin1String("Qbs.forceProbesKey"); }
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
bool QbsBuildStep::fromMap(const QVariantMap &map)
|
|
|
|
{
|
|
|
|
if (!ProjectExplorer::BuildStep::fromMap(map))
|
|
|
|
return false;
|
|
|
|
|
2017-07-27 23:27:25 +03:00
|
|
|
setQbsConfiguration(map.value(QBS_CONFIG).toMap());
|
|
|
|
m_qbsBuildOptions.setDryRun(map.value(QBS_DRY_RUN).toBool());
|
|
|
|
m_qbsBuildOptions.setKeepGoing(map.value(QBS_KEEP_GOING).toBool());
|
|
|
|
m_qbsBuildOptions.setMaxJobCount(map.value(QBS_MAXJOBCOUNT).toInt());
|
|
|
|
const bool showCommandLines = map.value(QBS_SHOWCOMMANDLINES).toBool();
|
2015-03-09 15:48:31 +01:00
|
|
|
m_qbsBuildOptions.setEchoMode(showCommandLines ? qbs::CommandEchoModeCommandLine
|
|
|
|
: qbs::CommandEchoModeSummary);
|
2017-07-27 23:27:25 +03:00
|
|
|
m_qbsBuildOptions.setInstall(map.value(QBS_INSTALL, true).toBool());
|
|
|
|
m_qbsBuildOptions.setRemoveExistingInstallation(map.value(QBS_CLEAN_INSTALL_ROOT)
|
2015-01-09 10:29:55 +01:00
|
|
|
.toBool());
|
2016-06-17 17:22:30 +02:00
|
|
|
m_forceProbes = map.value(forceProbesKey()).toBool();
|
2013-01-30 18:19:31 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
QVariantMap QbsBuildStep::toMap() const
|
|
|
|
{
|
|
|
|
QVariantMap map = ProjectExplorer::BuildStep::toMap();
|
2017-07-27 23:27:25 +03:00
|
|
|
map.insert(QBS_CONFIG, m_qbsConfiguration);
|
|
|
|
map.insert(QBS_DRY_RUN, m_qbsBuildOptions.dryRun());
|
|
|
|
map.insert(QBS_KEEP_GOING, m_qbsBuildOptions.keepGoing());
|
|
|
|
map.insert(QBS_MAXJOBCOUNT, m_qbsBuildOptions.maxJobCount());
|
|
|
|
map.insert(QBS_SHOWCOMMANDLINES,
|
2015-03-09 15:48:31 +01:00
|
|
|
m_qbsBuildOptions.echoMode() == qbs::CommandEchoModeCommandLine);
|
2017-07-27 23:27:25 +03:00
|
|
|
map.insert(QBS_INSTALL, m_qbsBuildOptions.install());
|
|
|
|
map.insert(QBS_CLEAN_INSTALL_ROOT,
|
2015-01-09 10:29:55 +01:00
|
|
|
m_qbsBuildOptions.removeExistingInstallation());
|
2016-06-17 17:22:30 +02:00
|
|
|
map.insert(forceProbesKey(), m_forceProbes);
|
2013-01-30 18:19:31 +01:00
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QbsBuildStep::buildingDone(bool success)
|
|
|
|
{
|
2014-03-03 17:23:41 +01:00
|
|
|
m_lastWasSuccess = success;
|
2013-01-30 18:19:31 +01:00
|
|
|
// Report errors:
|
2013-06-18 12:06:11 +02:00
|
|
|
foreach (const qbs::ErrorItem &item, m_job->error().items())
|
|
|
|
createTaskAndOutput(ProjectExplorer::Task::Error, item.description(),
|
2014-11-07 13:40:49 +01:00
|
|
|
item.codeLocation().filePath(), item.codeLocation().line());
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2014-03-03 17:23:41 +01:00
|
|
|
QbsProject *pro = static_cast<QbsProject *>(project());
|
|
|
|
|
2014-02-18 15:12:41 +01:00
|
|
|
// Building can uncover additional target artifacts.
|
2014-07-11 12:44:12 +02:00
|
|
|
pro->updateAfterBuild();
|
|
|
|
|
|
|
|
// The reparsing, if it is necessary, has to be done before finished() is emitted, as
|
|
|
|
// otherwise a potential additional build step could conflict with the parsing step.
|
2014-07-14 14:22:27 +02:00
|
|
|
if (pro->parsingScheduled())
|
|
|
|
parseProject();
|
|
|
|
else
|
2014-07-11 12:44:12 +02:00
|
|
|
finish();
|
2014-03-03 17:23:41 +01:00
|
|
|
}
|
2014-02-18 15:12:41 +01:00
|
|
|
|
2014-07-14 14:22:27 +02:00
|
|
|
void QbsBuildStep::reparsingDone(bool success)
|
2014-03-03 17:23:41 +01:00
|
|
|
{
|
2017-07-13 10:51:15 +02:00
|
|
|
disconnect(qbsProject(), &ProjectExplorer::Project::parsingFinished,
|
|
|
|
this, &QbsBuildStep::reparsingDone);
|
2014-07-14 14:22:27 +02:00
|
|
|
m_parsingProject = false;
|
|
|
|
if (m_job) { // This was a scheduled reparsing after building.
|
|
|
|
finish();
|
|
|
|
} else if (!success) {
|
|
|
|
m_lastWasSuccess = false;
|
|
|
|
finish();
|
|
|
|
} else {
|
|
|
|
build();
|
|
|
|
}
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void QbsBuildStep::handleTaskStarted(const QString &desciption, int max)
|
|
|
|
{
|
|
|
|
Q_UNUSED(desciption);
|
|
|
|
QTC_ASSERT(m_fi, return);
|
|
|
|
|
|
|
|
m_progressBase = m_fi->progressValue();
|
|
|
|
m_fi->setProgressRange(0, m_progressBase + max);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QbsBuildStep::handleProgress(int value)
|
|
|
|
{
|
|
|
|
QTC_ASSERT(m_fi, return);
|
|
|
|
m_fi->setProgressValue(m_progressBase + value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QbsBuildStep::handleCommandDescriptionReport(const QString &highlight, const QString &message)
|
|
|
|
{
|
|
|
|
Q_UNUSED(highlight);
|
2017-01-12 10:59:12 +01:00
|
|
|
emit addOutput(message, OutputFormat::Stdout);
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void QbsBuildStep::handleProcessResultReport(const qbs::ProcessResult &result)
|
|
|
|
{
|
2013-05-23 17:15:52 +02:00
|
|
|
bool hasOutput = !result.stdOut().isEmpty() || !result.stdErr().isEmpty();
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2013-05-24 16:20:10 +02:00
|
|
|
if (result.success() && !hasOutput)
|
2013-01-30 18:19:31 +01:00
|
|
|
return;
|
|
|
|
|
2013-05-23 17:15:52 +02:00
|
|
|
m_parser->setWorkingDirectory(result.workingDirectory());
|
2013-03-15 12:48:35 +01:00
|
|
|
|
2017-07-27 23:27:25 +03:00
|
|
|
QString commandline = result.executableFilePath() + ' '
|
2014-05-21 12:21:02 +02:00
|
|
|
+ Utils::QtcProcess::joinArgs(result.arguments());
|
2017-01-12 10:59:12 +01:00
|
|
|
addOutput(commandline, OutputFormat::Stdout);
|
2013-03-15 12:48:35 +01:00
|
|
|
|
2013-05-23 17:15:52 +02:00
|
|
|
foreach (const QString &line, result.stdErr()) {
|
2013-01-30 18:19:31 +01:00
|
|
|
m_parser->stdError(line);
|
2017-01-12 10:59:12 +01:00
|
|
|
addOutput(line, OutputFormat::Stderr);
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
2013-05-23 17:15:52 +02:00
|
|
|
foreach (const QString &line, result.stdOut()) {
|
2013-01-30 18:19:31 +01:00
|
|
|
m_parser->stdOutput(line);
|
2017-01-12 10:59:12 +01:00
|
|
|
addOutput(line, OutputFormat::Stdout);
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
2013-05-27 12:48:47 +02:00
|
|
|
m_parser->flush();
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void QbsBuildStep::createTaskAndOutput(ProjectExplorer::Task::TaskType type, const QString &message,
|
|
|
|
const QString &file, int line)
|
|
|
|
{
|
2015-04-20 17:13:45 +02:00
|
|
|
ProjectExplorer::Task task = ProjectExplorer::Task(type, message,
|
|
|
|
Utils::FileName::fromString(file), line,
|
|
|
|
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE);
|
|
|
|
emit addTask(task, 1);
|
2017-01-12 10:59:12 +01:00
|
|
|
emit addOutput(message, OutputFormat::Stdout);
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
QString QbsBuildStep::buildVariant() const
|
|
|
|
{
|
2016-10-23 06:01:41 +03:00
|
|
|
return qbsConfiguration(PreserveVariables).value(Constants::QBS_CONFIG_VARIANT_KEY).toString();
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
2013-06-13 17:15:44 +02:00
|
|
|
bool QbsBuildStep::isQmlDebuggingEnabled() const
|
|
|
|
{
|
2016-10-23 06:01:41 +03:00
|
|
|
QVariantMap data = qbsConfiguration(PreserveVariables);
|
2017-07-27 23:27:25 +03:00
|
|
|
return data.value(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY, false).toBool()
|
|
|
|
|| data.value(Constants::QBS_CONFIG_QUICK_DEBUG_KEY, false).toBool();
|
2013-06-13 17:15:44 +02:00
|
|
|
}
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
void QbsBuildStep::setBuildVariant(const QString &variant)
|
|
|
|
{
|
2017-07-27 23:27:25 +03:00
|
|
|
if (m_qbsConfiguration.value(Constants::QBS_CONFIG_VARIANT_KEY).toString() == variant)
|
2013-01-30 18:19:31 +01:00
|
|
|
return;
|
2017-07-27 23:27:25 +03:00
|
|
|
m_qbsConfiguration.insert(Constants::QBS_CONFIG_VARIANT_KEY, variant);
|
2013-01-30 18:19:31 +01:00
|
|
|
emit qbsConfigurationChanged();
|
2014-06-19 15:29:11 +02:00
|
|
|
QbsBuildConfiguration *bc = static_cast<QbsBuildConfiguration *>(buildConfiguration());
|
|
|
|
if (bc)
|
|
|
|
bc->emitBuildTypeChanged();
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
QString QbsBuildStep::profile() const
|
|
|
|
{
|
2016-10-23 06:01:41 +03:00
|
|
|
return qbsConfiguration(PreserveVariables).value(Constants::QBS_CONFIG_PROFILE_KEY).toString();
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void QbsBuildStep::setKeepGoing(bool kg)
|
|
|
|
{
|
2013-05-23 17:15:52 +02:00
|
|
|
if (m_qbsBuildOptions.keepGoing() == kg)
|
2013-01-30 18:19:31 +01:00
|
|
|
return;
|
2013-05-23 17:15:52 +02:00
|
|
|
m_qbsBuildOptions.setKeepGoing(kg);
|
2013-01-30 18:19:31 +01:00
|
|
|
emit qbsBuildOptionsChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QbsBuildStep::setMaxJobs(int jobcount)
|
|
|
|
{
|
2013-05-23 17:15:52 +02:00
|
|
|
if (m_qbsBuildOptions.maxJobCount() == jobcount)
|
2013-01-30 18:19:31 +01:00
|
|
|
return;
|
2013-05-23 17:15:52 +02:00
|
|
|
m_qbsBuildOptions.setMaxJobCount(jobcount);
|
2013-01-30 18:19:31 +01:00
|
|
|
emit qbsBuildOptionsChanged();
|
|
|
|
}
|
|
|
|
|
2014-11-20 11:10:13 +01:00
|
|
|
void QbsBuildStep::setShowCommandLines(bool show)
|
|
|
|
{
|
2015-03-09 15:48:31 +01:00
|
|
|
if (showCommandLines() == show)
|
2014-11-20 11:10:13 +01:00
|
|
|
return;
|
2015-03-09 15:48:31 +01:00
|
|
|
m_qbsBuildOptions.setEchoMode(show ? qbs::CommandEchoModeCommandLine
|
|
|
|
: qbs::CommandEchoModeSummary);
|
2014-11-20 11:10:13 +01:00
|
|
|
emit qbsBuildOptionsChanged();
|
|
|
|
}
|
|
|
|
|
2015-01-09 10:29:55 +01:00
|
|
|
void QbsBuildStep::setInstall(bool install)
|
|
|
|
{
|
|
|
|
if (m_qbsBuildOptions.install() == install)
|
|
|
|
return;
|
|
|
|
m_qbsBuildOptions.setInstall(install);
|
|
|
|
emit qbsBuildOptionsChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QbsBuildStep::setCleanInstallRoot(bool clean)
|
|
|
|
{
|
|
|
|
if (m_qbsBuildOptions.removeExistingInstallation() == clean)
|
|
|
|
return;
|
|
|
|
m_qbsBuildOptions.setRemoveExistingInstallation(clean);
|
|
|
|
emit qbsBuildOptionsChanged();
|
|
|
|
}
|
|
|
|
|
2014-07-14 14:22:27 +02:00
|
|
|
void QbsBuildStep::parseProject()
|
|
|
|
{
|
|
|
|
m_parsingProject = true;
|
2017-07-13 10:51:15 +02:00
|
|
|
connect(qbsProject(), &ProjectExplorer::Project::parsingFinished,
|
|
|
|
this, &QbsBuildStep::reparsingDone);
|
2014-07-17 12:02:56 +02:00
|
|
|
qbsProject()->parseCurrentBuildConfiguration();
|
2014-07-14 14:22:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void QbsBuildStep::build()
|
|
|
|
{
|
|
|
|
qbs::BuildOptions options(m_qbsBuildOptions);
|
|
|
|
options.setChangedFiles(m_changedFiles);
|
|
|
|
options.setFilesToConsider(m_changedFiles);
|
|
|
|
options.setActiveFileTags(m_activeFileTags);
|
2016-10-07 16:35:17 +02:00
|
|
|
options.setLogElapsedTime(!qgetenv(Constants::QBS_PROFILING_ENV).isEmpty());
|
2014-07-14 14:22:27 +02:00
|
|
|
|
2014-11-17 16:26:23 +01:00
|
|
|
QString error;
|
|
|
|
m_job = qbsProject()->build(options, m_products, error);
|
2014-07-14 14:22:27 +02:00
|
|
|
if (!m_job) {
|
2017-01-12 10:59:12 +01:00
|
|
|
emit addOutput(error, OutputFormat::ErrorMessage);
|
2016-04-20 12:49:25 +02:00
|
|
|
reportRunResult(*m_fi, false);
|
2014-07-14 14:22:27 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_progressBase = 0;
|
|
|
|
|
2016-06-28 23:29:21 +03:00
|
|
|
connect(m_job, &qbs::AbstractJob::finished, this, &QbsBuildStep::buildingDone);
|
|
|
|
connect(m_job, &qbs::AbstractJob::taskStarted,
|
|
|
|
this, &QbsBuildStep::handleTaskStarted);
|
|
|
|
connect(m_job, &qbs::AbstractJob::taskProgress,
|
|
|
|
this, &QbsBuildStep::handleProgress);
|
|
|
|
connect(m_job, &qbs::BuildJob::reportCommandDescription,
|
|
|
|
this, &QbsBuildStep::handleCommandDescriptionReport);
|
|
|
|
connect(m_job, &qbs::BuildJob::reportProcessResult,
|
|
|
|
this, &QbsBuildStep::handleProcessResultReport);
|
2014-07-14 14:22:27 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-07-11 12:44:12 +02:00
|
|
|
void QbsBuildStep::finish()
|
|
|
|
{
|
|
|
|
QTC_ASSERT(m_fi, return);
|
2016-04-20 12:49:25 +02:00
|
|
|
reportRunResult(*m_fi, m_lastWasSuccess);
|
2014-07-11 12:44:12 +02:00
|
|
|
m_fi = 0; // do not delete, it is not ours
|
2014-07-14 14:22:27 +02:00
|
|
|
if (m_job) {
|
|
|
|
m_job->deleteLater();
|
|
|
|
m_job = 0;
|
|
|
|
}
|
2014-07-11 12:44:12 +02:00
|
|
|
}
|
|
|
|
|
2014-07-14 14:22:27 +02:00
|
|
|
QbsProject *QbsBuildStep::qbsProject() const
|
|
|
|
{
|
|
|
|
return static_cast<QbsProject *>(project());
|
|
|
|
}
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
// --------------------------------------------------------------------
|
|
|
|
// QbsBuildStepConfigWidget:
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
|
|
QbsBuildStepConfigWidget::QbsBuildStepConfigWidget(QbsBuildStep *step) :
|
2013-06-12 14:36:02 +02:00
|
|
|
m_step(step),
|
|
|
|
m_ignoreChange(false)
|
2013-01-30 18:19:31 +01:00
|
|
|
{
|
2016-06-28 23:29:21 +03:00
|
|
|
connect(m_step, &ProjectExplorer::ProjectConfiguration::displayNameChanged,
|
|
|
|
this, &QbsBuildStepConfigWidget::updateState);
|
|
|
|
connect(m_step, &QbsBuildStep::qbsConfigurationChanged,
|
|
|
|
this, &QbsBuildStepConfigWidget::updateState);
|
|
|
|
connect(m_step, &QbsBuildStep::qbsBuildOptionsChanged,
|
|
|
|
this, &QbsBuildStepConfigWidget::updateState);
|
2016-02-22 17:49:02 +01:00
|
|
|
connect(&QbsProjectManagerSettings::instance(), &QbsProjectManagerSettings::settingsBaseChanged,
|
|
|
|
this, &QbsBuildStepConfigWidget::updateState);
|
2017-07-31 13:07:44 +02:00
|
|
|
step->target()->subscribeSignal(&ProjectExplorer::BuildConfiguration::buildDirectoryChanged,
|
|
|
|
this, [this]() {
|
|
|
|
if (m_step->target()->activeBuildConfiguration() == sender())
|
|
|
|
updateState();
|
|
|
|
});
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
|
|
|
m_ui = new Ui::QbsBuildStepConfigWidget;
|
|
|
|
m_ui->setupUi(this);
|
2017-02-13 15:40:59 +01:00
|
|
|
m_ui->installDirChooser->setExpectedKind(Utils::PathChooser::Directory);
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2016-09-20 17:11:03 +03:00
|
|
|
auto chooser = new Core::VariableChooser(this);
|
|
|
|
chooser->addSupportedWidget(m_ui->propertyEdit);
|
2015-04-28 14:49:56 +02:00
|
|
|
m_ui->propertyEdit->setValidationFunction([this](Utils::FancyLineEdit *edit,
|
|
|
|
QString *errorMessage) {
|
|
|
|
return validateProperties(edit, errorMessage);
|
|
|
|
});
|
2016-08-03 17:55:54 +02:00
|
|
|
m_ui->qmlDebuggingWarningText->setPixmap(Utils::Icons::WARNING.pixmap());
|
2015-04-28 14:49:56 +02:00
|
|
|
|
2016-06-28 23:29:21 +03:00
|
|
|
connect(m_ui->buildVariantComboBox,
|
|
|
|
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
|
|
|
this, &QbsBuildStepConfigWidget::changeBuildVariant);
|
|
|
|
connect(m_ui->keepGoingCheckBox, &QAbstractButton::toggled,
|
|
|
|
this, &QbsBuildStepConfigWidget::changeKeepGoing);
|
|
|
|
connect(m_ui->jobSpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
|
|
|
this, &QbsBuildStepConfigWidget::changeJobCount);
|
2014-11-20 11:10:13 +01:00
|
|
|
connect(m_ui->showCommandLinesCheckBox, &QCheckBox::toggled, this,
|
|
|
|
&QbsBuildStepConfigWidget::changeShowCommandLines);
|
2015-01-09 10:29:55 +01:00
|
|
|
connect(m_ui->installCheckBox, &QCheckBox::toggled, this,
|
|
|
|
&QbsBuildStepConfigWidget::changeInstall);
|
|
|
|
connect(m_ui->cleanInstallRootCheckBox, &QCheckBox::toggled, this,
|
|
|
|
&QbsBuildStepConfigWidget::changeCleanInstallRoot);
|
2017-02-13 15:40:59 +01:00
|
|
|
connect(m_ui->defaultInstallDirCheckBox, &QCheckBox::toggled, this,
|
|
|
|
&QbsBuildStepConfigWidget::changeUseDefaultInstallDir);
|
|
|
|
connect(m_ui->installDirChooser, &Utils::PathChooser::rawPathChanged, this,
|
|
|
|
&QbsBuildStepConfigWidget::changeInstallDir);
|
2016-06-17 17:22:30 +02:00
|
|
|
connect(m_ui->forceProbesCheckBox, &QCheckBox::toggled, this,
|
|
|
|
&QbsBuildStepConfigWidget::changeForceProbes);
|
2016-06-28 23:29:21 +03:00
|
|
|
connect(m_ui->qmlDebuggingLibraryCheckBox, &QAbstractButton::toggled,
|
|
|
|
this, &QbsBuildStepConfigWidget::linkQmlDebuggingLibraryChecked);
|
|
|
|
connect(QtSupport::QtVersionManager::instance(), &QtSupport::QtVersionManager::dumpUpdatedFor,
|
|
|
|
this, &QbsBuildStepConfigWidget::updateQmlDebuggingOption);
|
2013-01-30 18:19:31 +01:00
|
|
|
updateState();
|
|
|
|
}
|
|
|
|
|
2014-11-21 12:38:50 +02:00
|
|
|
QbsBuildStepConfigWidget::~QbsBuildStepConfigWidget()
|
|
|
|
{
|
|
|
|
delete m_ui;
|
|
|
|
}
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
QString QbsBuildStepConfigWidget::summaryText() const
|
|
|
|
{
|
|
|
|
return m_summary;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString QbsBuildStepConfigWidget::displayName() const
|
|
|
|
{
|
|
|
|
return m_step->displayName();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QbsBuildStepConfigWidget::updateState()
|
|
|
|
{
|
2013-06-12 14:36:02 +02:00
|
|
|
if (!m_ignoreChange) {
|
|
|
|
m_ui->keepGoingCheckBox->setChecked(m_step->keepGoing());
|
|
|
|
m_ui->jobSpinBox->setValue(m_step->maxJobs());
|
2014-11-20 11:10:13 +01:00
|
|
|
m_ui->showCommandLinesCheckBox->setChecked(m_step->showCommandLines());
|
2015-01-09 10:29:55 +01:00
|
|
|
m_ui->installCheckBox->setChecked(m_step->install());
|
|
|
|
m_ui->cleanInstallRootCheckBox->setChecked(m_step->cleanInstallRoot());
|
2016-06-17 17:22:30 +02:00
|
|
|
m_ui->forceProbesCheckBox->setChecked(m_step->forceProbes());
|
2016-10-23 06:01:41 +03:00
|
|
|
updatePropertyEdit(m_step->qbsConfiguration(QbsBuildStep::PreserveVariables));
|
2013-06-13 17:15:44 +02:00
|
|
|
m_ui->qmlDebuggingLibraryCheckBox->setChecked(m_step->isQmlDebuggingEnabled());
|
2017-02-13 15:40:59 +01:00
|
|
|
m_ui->installDirChooser->setFileName(m_step->installRoot());
|
|
|
|
m_ui->defaultInstallDirCheckBox->setChecked(!m_step->hasCustomInstallRoot());
|
2013-06-12 14:36:02 +02:00
|
|
|
}
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2013-06-13 17:15:44 +02:00
|
|
|
updateQmlDebuggingOption();
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
const QString buildVariant = m_step->buildVariant();
|
2017-07-27 23:27:25 +03:00
|
|
|
const int idx = (buildVariant == Constants::QBS_VARIANT_DEBUG) ? 0 : 1;
|
2013-01-30 18:19:31 +01:00
|
|
|
m_ui->buildVariantComboBox->setCurrentIndex(idx);
|
2017-02-13 15:40:59 +01:00
|
|
|
QString command = static_cast<QbsBuildConfiguration *>(m_step->buildConfiguration())
|
|
|
|
->equivalentCommandLine(m_step);
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2015-04-28 14:49:56 +02:00
|
|
|
for (int i = 0; i < m_propertyCache.count(); ++i) {
|
2017-07-27 23:27:25 +03:00
|
|
|
command += ' ' + m_propertyCache.at(i).name + ':' + m_propertyCache.at(i).effectiveValue;
|
2013-06-12 14:36:02 +02:00
|
|
|
}
|
|
|
|
|
2013-06-13 17:15:44 +02:00
|
|
|
if (m_step->isQmlDebuggingEnabled())
|
2017-07-27 23:27:25 +03:00
|
|
|
command += " Qt.declarative.qmlDebugging:true Qt.quick.qmlDebugging:true";
|
2013-10-25 15:42:15 +02:00
|
|
|
m_ui->commandLineTextEdit->setPlainText(command);
|
2013-06-13 17:15:44 +02:00
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
QString summary = tr("<b>Qbs:</b> %1").arg(command);
|
2013-06-12 14:36:02 +02:00
|
|
|
if (m_summary != summary) {
|
2013-01-30 18:19:31 +01:00
|
|
|
m_summary = summary;
|
|
|
|
emit updateSummary();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-13 17:15:44 +02:00
|
|
|
void QbsBuildStepConfigWidget::updateQmlDebuggingOption()
|
|
|
|
{
|
|
|
|
QString warningText;
|
|
|
|
bool supported = QtSupport::BaseQtVersion::isQmlDebuggingSupported(m_step->target()->kit(),
|
|
|
|
&warningText);
|
|
|
|
m_ui->qmlDebuggingLibraryCheckBox->setEnabled(supported);
|
|
|
|
|
|
|
|
if (supported && m_step->isQmlDebuggingEnabled())
|
|
|
|
warningText = tr("Might make your application vulnerable. Only use in a safe environment.");
|
|
|
|
|
|
|
|
m_ui->qmlDebuggingWarningText->setText(warningText);
|
|
|
|
m_ui->qmlDebuggingWarningIcon->setVisible(!warningText.isEmpty());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-12 14:36:02 +02:00
|
|
|
void QbsBuildStepConfigWidget::updatePropertyEdit(const QVariantMap &data)
|
|
|
|
{
|
|
|
|
QVariantMap editable = data;
|
|
|
|
|
|
|
|
// remove data that is edited with special UIs:
|
2017-07-27 23:27:25 +03:00
|
|
|
editable.remove(Constants::QBS_CONFIG_PROFILE_KEY);
|
|
|
|
editable.remove(Constants::QBS_CONFIG_VARIANT_KEY);
|
|
|
|
editable.remove(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY);
|
|
|
|
editable.remove(Constants::QBS_CONFIG_QUICK_DEBUG_KEY);
|
|
|
|
editable.remove(Constants::QBS_FORCE_PROBES_KEY);
|
|
|
|
editable.remove(Constants::QBS_INSTALL_ROOT_KEY);
|
2013-06-12 14:36:02 +02:00
|
|
|
|
|
|
|
QStringList propertyList;
|
|
|
|
for (QVariantMap::const_iterator i = editable.constBegin(); i != editable.constEnd(); ++i)
|
2017-07-27 23:27:25 +03:00
|
|
|
propertyList.append(i.key() + ':' + i.value().toString());
|
2013-06-12 14:36:02 +02:00
|
|
|
|
|
|
|
m_ui->propertyEdit->setText(Utils::QtcProcess::joinArgs(propertyList));
|
|
|
|
}
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
void QbsBuildStepConfigWidget::changeBuildVariant(int idx)
|
|
|
|
{
|
|
|
|
QString variant;
|
|
|
|
if (idx == 1)
|
2017-07-27 23:27:25 +03:00
|
|
|
variant = Constants::QBS_VARIANT_RELEASE;
|
2013-01-30 18:19:31 +01:00
|
|
|
else
|
2017-07-27 23:27:25 +03:00
|
|
|
variant = Constants::QBS_VARIANT_DEBUG;
|
2013-06-12 14:36:02 +02:00
|
|
|
m_ignoreChange = true;
|
2013-01-30 18:19:31 +01:00
|
|
|
m_step->setBuildVariant(variant);
|
2013-06-12 14:36:02 +02:00
|
|
|
m_ignoreChange = false;
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
2014-11-20 11:10:13 +01:00
|
|
|
void QbsBuildStepConfigWidget::changeShowCommandLines(bool show)
|
|
|
|
{
|
|
|
|
m_ignoreChange = true;
|
|
|
|
m_step->setShowCommandLines(show);
|
|
|
|
m_ignoreChange = false;
|
|
|
|
}
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
void QbsBuildStepConfigWidget::changeKeepGoing(bool kg)
|
|
|
|
{
|
2013-06-12 14:36:02 +02:00
|
|
|
m_ignoreChange = true;
|
2013-01-30 18:19:31 +01:00
|
|
|
m_step->setKeepGoing(kg);
|
2013-06-12 14:36:02 +02:00
|
|
|
m_ignoreChange = false;
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void QbsBuildStepConfigWidget::changeJobCount(int count)
|
|
|
|
{
|
2013-06-12 14:36:02 +02:00
|
|
|
m_ignoreChange = true;
|
2013-01-30 18:19:31 +01:00
|
|
|
m_step->setMaxJobs(count);
|
2013-06-12 14:36:02 +02:00
|
|
|
m_ignoreChange = false;
|
|
|
|
}
|
|
|
|
|
2015-01-09 10:29:55 +01:00
|
|
|
void QbsBuildStepConfigWidget::changeInstall(bool install)
|
|
|
|
{
|
|
|
|
m_ignoreChange = true;
|
|
|
|
m_step->setInstall(install);
|
|
|
|
m_ignoreChange = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QbsBuildStepConfigWidget::changeCleanInstallRoot(bool clean)
|
|
|
|
{
|
|
|
|
m_ignoreChange = true;
|
|
|
|
m_step->setCleanInstallRoot(clean);
|
|
|
|
m_ignoreChange = false;
|
|
|
|
}
|
|
|
|
|
2017-02-13 15:40:59 +01:00
|
|
|
void QbsBuildStepConfigWidget::changeUseDefaultInstallDir(bool useDefault)
|
|
|
|
{
|
|
|
|
m_ignoreChange = true;
|
|
|
|
QVariantMap config = m_step->qbsConfiguration(QbsBuildStep::PreserveVariables);
|
|
|
|
m_ui->installDirChooser->setEnabled(!useDefault);
|
|
|
|
if (useDefault)
|
|
|
|
config.remove(Constants::QBS_INSTALL_ROOT_KEY);
|
|
|
|
else
|
|
|
|
config.insert(Constants::QBS_INSTALL_ROOT_KEY, m_ui->installDirChooser->rawPath());
|
|
|
|
m_step->setQbsConfiguration(config);
|
|
|
|
m_ignoreChange = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QbsBuildStepConfigWidget::changeInstallDir(const QString &dir)
|
|
|
|
{
|
|
|
|
if (!m_step->hasCustomInstallRoot())
|
|
|
|
return;
|
|
|
|
m_ignoreChange = true;
|
|
|
|
QVariantMap config = m_step->qbsConfiguration(QbsBuildStep::PreserveVariables);
|
|
|
|
config.insert(Constants::QBS_INSTALL_ROOT_KEY, dir);
|
|
|
|
m_step->setQbsConfiguration(config);
|
|
|
|
m_ignoreChange = false;
|
|
|
|
}
|
|
|
|
|
2016-06-17 17:22:30 +02:00
|
|
|
void QbsBuildStepConfigWidget::changeForceProbes(bool forceProbes)
|
|
|
|
{
|
|
|
|
m_ignoreChange = true;
|
|
|
|
m_step->setForceProbes(forceProbes);
|
|
|
|
m_ignoreChange = false;
|
|
|
|
}
|
|
|
|
|
2015-04-28 14:49:56 +02:00
|
|
|
void QbsBuildStepConfigWidget::applyCachedProperties()
|
2013-06-12 14:36:02 +02:00
|
|
|
{
|
|
|
|
QVariantMap data;
|
2016-10-23 06:01:41 +03:00
|
|
|
const QVariantMap tmp = m_step->qbsConfiguration(QbsBuildStep::PreserveVariables);
|
2013-06-12 14:36:02 +02:00
|
|
|
|
|
|
|
// Insert values set up with special UIs:
|
2017-07-27 23:27:25 +03:00
|
|
|
data.insert(Constants::QBS_CONFIG_PROFILE_KEY,
|
|
|
|
tmp.value(Constants::QBS_CONFIG_PROFILE_KEY));
|
|
|
|
data.insert(Constants::QBS_CONFIG_VARIANT_KEY,
|
|
|
|
tmp.value(Constants::QBS_CONFIG_VARIANT_KEY));
|
|
|
|
if (tmp.contains(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY))
|
|
|
|
data.insert(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY,
|
|
|
|
tmp.value(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY));
|
|
|
|
if (tmp.contains(Constants::QBS_CONFIG_QUICK_DEBUG_KEY))
|
|
|
|
data.insert(Constants::QBS_CONFIG_QUICK_DEBUG_KEY,
|
|
|
|
tmp.value(Constants::QBS_CONFIG_QUICK_DEBUG_KEY));
|
2017-10-06 16:49:47 +02:00
|
|
|
if (tmp.contains(Constants::QBS_INSTALL_ROOT_KEY))
|
|
|
|
data.insert(Constants::QBS_INSTALL_ROOT_KEY,
|
|
|
|
tmp.value(Constants::QBS_INSTALL_ROOT_KEY));
|
2013-06-13 17:15:44 +02:00
|
|
|
|
2016-10-23 06:01:41 +03:00
|
|
|
for (int i = 0; i < m_propertyCache.count(); ++i) {
|
|
|
|
const Property &property = m_propertyCache.at(i);
|
|
|
|
data.insert(property.name, property.value);
|
|
|
|
}
|
2013-06-12 14:36:02 +02:00
|
|
|
|
|
|
|
m_ignoreChange = true;
|
|
|
|
m_step->setQbsConfiguration(data);
|
|
|
|
m_ignoreChange = false;
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
2013-06-13 17:15:44 +02:00
|
|
|
void QbsBuildStepConfigWidget::linkQmlDebuggingLibraryChecked(bool checked)
|
|
|
|
{
|
2016-10-23 06:01:41 +03:00
|
|
|
QVariantMap data = m_step->qbsConfiguration(QbsBuildStep::PreserveVariables);
|
2013-06-13 17:15:44 +02:00
|
|
|
if (checked) {
|
2017-07-27 23:27:25 +03:00
|
|
|
data.insert(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY, checked);
|
|
|
|
data.insert(Constants::QBS_CONFIG_QUICK_DEBUG_KEY, checked);
|
2013-06-13 17:15:44 +02:00
|
|
|
} else {
|
2017-07-27 23:27:25 +03:00
|
|
|
data.remove(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY);
|
|
|
|
data.remove(Constants::QBS_CONFIG_QUICK_DEBUG_KEY);
|
2013-06-13 17:15:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
m_ignoreChange = true;
|
|
|
|
m_step->setQbsConfiguration(data);
|
|
|
|
m_ignoreChange = false;
|
|
|
|
}
|
|
|
|
|
2015-04-28 14:49:56 +02:00
|
|
|
bool QbsBuildStepConfigWidget::validateProperties(Utils::FancyLineEdit *edit, QString *errorMessage)
|
|
|
|
{
|
|
|
|
Utils::QtcProcess::SplitError err;
|
|
|
|
QStringList argList = Utils::QtcProcess::splitArgs(edit->text(), Utils::HostOsInfo::hostOs(),
|
|
|
|
false, &err);
|
|
|
|
if (err != Utils::QtcProcess::SplitOk) {
|
|
|
|
if (errorMessage)
|
|
|
|
*errorMessage = tr("Could not split properties.");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-10-23 06:01:41 +03:00
|
|
|
QList<Property> properties;
|
|
|
|
const Utils::MacroExpander *expander = Utils::globalMacroExpander();
|
2016-09-20 17:11:03 +03:00
|
|
|
foreach (const QString &rawArg, argList) {
|
2017-07-27 23:27:25 +03:00
|
|
|
int pos = rawArg.indexOf(':');
|
2015-04-28 14:49:56 +02:00
|
|
|
if (pos > 0) {
|
2016-10-23 06:01:41 +03:00
|
|
|
const QString rawValue = rawArg.mid(pos + 1);
|
|
|
|
Property property(rawArg.left(pos), rawValue, expander->expand(rawValue));
|
|
|
|
properties.append(property);
|
2015-04-28 14:49:56 +02:00
|
|
|
} else {
|
|
|
|
if (errorMessage)
|
2015-06-01 09:51:04 +02:00
|
|
|
*errorMessage = tr("No \":\" found in property definition.");
|
2015-04-28 14:49:56 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_propertyCache != properties) {
|
|
|
|
m_propertyCache = properties;
|
|
|
|
applyCachedProperties();
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
// --------------------------------------------------------------------
|
|
|
|
// QbsBuildStepFactory:
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
|
|
QbsBuildStepFactory::QbsBuildStepFactory(QObject *parent) :
|
|
|
|
ProjectExplorer::IBuildStepFactory(parent)
|
|
|
|
{ }
|
|
|
|
|
2016-06-10 13:58:50 +02:00
|
|
|
QList<ProjectExplorer::BuildStepInfo> QbsBuildStepFactory::availableSteps(ProjectExplorer::BuildStepList *parent) const
|
2013-01-30 18:19:31 +01:00
|
|
|
{
|
|
|
|
if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_BUILD
|
2013-05-31 14:33:24 +02:00
|
|
|
&& qobject_cast<QbsBuildConfiguration *>(parent->parent())
|
|
|
|
&& qobject_cast<QbsProject *>(parent->target()->project()))
|
2017-02-22 15:09:35 +01:00
|
|
|
return {{Constants::QBS_BUILDSTEP_ID, tr("Qbs Build")}};
|
2016-06-10 13:58:50 +02:00
|
|
|
|
|
|
|
return {};
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
2014-07-01 11:08:26 +02:00
|
|
|
ProjectExplorer::BuildStep *QbsBuildStepFactory::create(ProjectExplorer::BuildStepList *parent, Core::Id id)
|
2013-01-30 18:19:31 +01:00
|
|
|
{
|
2016-05-18 12:37:29 +02:00
|
|
|
Q_UNUSED(id);
|
2013-01-30 18:19:31 +01:00
|
|
|
return new QbsBuildStep(parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
ProjectExplorer::BuildStep *QbsBuildStepFactory::clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product)
|
|
|
|
{
|
|
|
|
return new QbsBuildStep(parent, static_cast<QbsBuildStep *>(product));
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
} // namespace QbsProjectManager
|
2016-10-23 05:52:51 +03:00
|
|
|
|
|
|
|
#include "qbsbuildstep.moc"
|