2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2010-01-14 17:41:29 +01:00
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
#include "cmakebuildstep.h"
|
2010-01-14 17:41:29 +01:00
|
|
|
|
2013-07-10 21:43:49 +03:00
|
|
|
#include "cmakebuildconfiguration.h"
|
2019-10-25 09:55:32 +02:00
|
|
|
#include "cmakebuildsystem.h"
|
2016-01-07 13:15:29 +01:00
|
|
|
#include "cmakekitinformation.h"
|
2013-07-10 21:43:49 +03:00
|
|
|
#include "cmakeparser.h"
|
2022-09-05 20:09:12 +02:00
|
|
|
#include "cmakeproject.h"
|
2008-12-04 13:06:02 +01:00
|
|
|
#include "cmakeprojectconstants.h"
|
2022-09-29 15:26:31 +02:00
|
|
|
#include "cmakeprojectmanagertr.h"
|
2016-01-07 13:15:29 +01:00
|
|
|
#include "cmaketool.h"
|
2008-12-04 13:06:02 +01:00
|
|
|
|
2020-04-17 15:30:05 +02:00
|
|
|
#include <coreplugin/find/itemviewfind.h>
|
2010-07-16 14:00:41 +02:00
|
|
|
#include <projectexplorer/buildsteplist.h>
|
2022-09-05 20:09:12 +02:00
|
|
|
#include <projectexplorer/devicesupport/idevice.h>
|
|
|
|
|
#include <projectexplorer/environmentwidget.h>
|
2016-02-12 12:34:35 +01:00
|
|
|
#include <projectexplorer/gnumakeparser.h>
|
2021-10-18 10:23:35 +02:00
|
|
|
#include <projectexplorer/kitinformation.h>
|
2018-11-17 21:19:04 +02:00
|
|
|
#include <projectexplorer/processparameters.h>
|
2020-04-17 15:30:05 +02:00
|
|
|
#include <projectexplorer/project.h>
|
2013-07-10 21:43:49 +03:00
|
|
|
#include <projectexplorer/projectexplorer.h>
|
2022-06-22 15:43:33 +02:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2020-04-17 15:30:05 +02:00
|
|
|
#include <projectexplorer/runconfiguration.h>
|
2012-04-24 15:49:09 +02:00
|
|
|
#include <projectexplorer/target.h>
|
2021-11-15 15:11:43 +01:00
|
|
|
#include <projectexplorer/xcodebuildparser.h>
|
2021-05-31 11:28:12 +00:00
|
|
|
|
2020-06-02 19:37:25 +02:00
|
|
|
#include <utils/algorithm.h>
|
2020-09-18 12:11:40 +02:00
|
|
|
#include <utils/layoutbuilder.h>
|
2020-06-02 19:37:25 +02:00
|
|
|
|
2020-04-17 15:30:05 +02:00
|
|
|
#include <QBoxLayout>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QListWidget>
|
2020-07-30 13:16:43 +02:00
|
|
|
#include <QRegularExpression>
|
2020-09-10 17:01:32 +02:00
|
|
|
#include <QTreeView>
|
2022-09-05 20:09:12 +02:00
|
|
|
#include <QCheckBox>
|
2008-12-09 15:25:01 +01:00
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
using namespace Core;
|
2009-10-27 14:16:28 +01:00
|
|
|
using namespace ProjectExplorer;
|
2020-08-13 16:48:44 +02:00
|
|
|
using namespace Utils;
|
2008-12-04 13:06:02 +01:00
|
|
|
|
2022-09-29 15:26:31 +02:00
|
|
|
namespace CMakeProjectManager::Internal {
|
2020-02-20 18:04:36 +01:00
|
|
|
|
2012-08-03 15:24:33 +02:00
|
|
|
const char BUILD_TARGETS_KEY[] = "CMakeProjectManager.MakeStep.BuildTargets";
|
2020-06-02 17:23:47 +02:00
|
|
|
const char CMAKE_ARGUMENTS_KEY[] = "CMakeProjectManager.MakeStep.CMakeArguments";
|
2016-01-07 13:15:29 +01:00
|
|
|
const char TOOL_ARGUMENTS_KEY[] = "CMakeProjectManager.MakeStep.AdditionalArguments";
|
CMake: iOS: Enable automatic provisioning updates
By default xcodebuild does not try create / download a provisioning
profile for a project if a valid one does not exist locally
in ~/Library/MobileDevice/Provisioning Profiles, even if the
Xcode CODE_SIGN_STYLE attribute is set to Automatic.
Starting with Xcode 9, xcodebuild accepts a new
-allowProvisioningUpdates option.
When passed, xcodebuild will request a new provisioning profile
from Apple's servers for the current project and use it during
the build. The provisioning profile is only needed when building
for a real device, not the simulator.
When building an iOS project with qmake, the option is embedded in the
wrapping Makefile generated by qmake, so Qt Creator can simply call
make (which it does).
For CMake, there is no wrapping Makefile, so we need to pass the new
option explicitly as an additional build tool argument.
There might be cases where automatic provisioning is not desired,
which is why there is now a new checkbox in the CMake build step
configuration widget. It's default value is 'enabled', to match
qmake's behavior.
As an implementation detail, isiOS had to be moved to a header file so
it's accessible to both the build configuration and the build step.
Fixes: QTCREATORBUG-26246
Change-Id: Ic80cd965ba095d0ff379e13ad2ffb8c298c9f7c4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-05 16:26:11 +02:00
|
|
|
const char IOS_AUTOMATIC_PROVISIONG_UPDATES_ARGUMENTS_KEY[] =
|
|
|
|
|
"CMakeProjectManager.MakeStep.iOSAutomaticProvisioningUpdates";
|
2022-09-05 20:09:12 +02:00
|
|
|
const char CLEAR_SYSTEM_ENVIRONMENT_KEY[] = "CMakeProjectManager.MakeStep.ClearSystemEnvironment";
|
|
|
|
|
const char USER_ENVIRONMENT_CHANGES_KEY[] = "CMakeProjectManager.MakeStep.UserEnvironmentChanges";
|
|
|
|
|
const char BUILD_PRESET_KEY[] = "CMakeProjectManager.MakeStep.BuildPreset";
|
2020-09-10 17:01:32 +02:00
|
|
|
|
|
|
|
|
// CmakeProgressParser
|
2020-02-20 18:04:36 +01:00
|
|
|
|
2020-07-30 13:16:43 +02:00
|
|
|
class CmakeProgressParser : public Utils::OutputLineParser
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void progress(int percentage);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Result handleLine(const QString &line, Utils::OutputFormat format) override
|
|
|
|
|
{
|
|
|
|
|
if (format != Utils::StdOutFormat)
|
|
|
|
|
return Status::NotHandled;
|
|
|
|
|
|
|
|
|
|
static const QRegularExpression percentProgress("^\\[\\s*(\\d*)%\\]");
|
|
|
|
|
static const QRegularExpression ninjaProgress("^\\[\\s*(\\d*)/\\s*(\\d*)");
|
|
|
|
|
|
|
|
|
|
QRegularExpressionMatch match = percentProgress.match(line);
|
|
|
|
|
if (match.hasMatch()) {
|
|
|
|
|
bool ok = false;
|
|
|
|
|
const int percent = match.captured(1).toInt(&ok);
|
|
|
|
|
if (ok)
|
|
|
|
|
emit progress(percent);
|
|
|
|
|
return Status::Done;
|
|
|
|
|
}
|
|
|
|
|
match = ninjaProgress.match(line);
|
|
|
|
|
if (match.hasMatch()) {
|
|
|
|
|
m_useNinja = true;
|
|
|
|
|
bool ok = false;
|
|
|
|
|
const int done = match.captured(1).toInt(&ok);
|
|
|
|
|
if (ok) {
|
|
|
|
|
const int all = match.captured(2).toInt(&ok);
|
|
|
|
|
if (ok && all != 0) {
|
|
|
|
|
const int percent = static_cast<int>(100.0 * done / all);
|
|
|
|
|
emit progress(percent);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return Status::Done;
|
|
|
|
|
}
|
|
|
|
|
return Status::NotHandled;
|
|
|
|
|
}
|
|
|
|
|
bool hasDetectedRedirection() const override { return m_useNinja; }
|
|
|
|
|
|
|
|
|
|
// TODO: Shouldn't we know the backend in advance? Then we could merge this class
|
|
|
|
|
// with CmakeParser.
|
|
|
|
|
bool m_useNinja = false;
|
|
|
|
|
};
|
|
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
|
|
|
|
|
// CmakeTargetItem
|
|
|
|
|
|
|
|
|
|
CMakeTargetItem::CMakeTargetItem(const QString &target, CMakeBuildStep *step, bool special)
|
|
|
|
|
: m_target(target), m_step(step), m_special(special)
|
2020-02-20 18:04:36 +01:00
|
|
|
{
|
2020-09-10 17:01:32 +02:00
|
|
|
}
|
2020-02-20 18:04:36 +01:00
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
QVariant CMakeTargetItem::data(int column, int role) const
|
|
|
|
|
{
|
|
|
|
|
if (column == 0) {
|
|
|
|
|
if (role == Qt::DisplayRole) {
|
|
|
|
|
if (m_target.isEmpty())
|
2022-09-29 15:26:31 +02:00
|
|
|
return Tr::tr("Current executable");
|
2020-09-10 17:01:32 +02:00
|
|
|
return m_target;
|
|
|
|
|
}
|
2020-02-20 18:04:36 +01:00
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
if (role == Qt::ToolTipRole) {
|
|
|
|
|
if (m_target.isEmpty()) {
|
2022-09-29 15:26:31 +02:00
|
|
|
return Tr::tr("Build the executable used in the active run "
|
2020-09-10 17:01:32 +02:00
|
|
|
"configuration. Currently: %1")
|
|
|
|
|
.arg(m_step->activeRunConfigTarget());
|
|
|
|
|
}
|
2022-09-29 15:26:31 +02:00
|
|
|
return Tr::tr("Target: %1").arg(m_target);
|
2020-09-10 17:01:32 +02:00
|
|
|
}
|
2020-02-20 18:04:36 +01:00
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
if (role == Qt::CheckStateRole)
|
|
|
|
|
return m_step->buildsBuildTarget(m_target) ? Qt::Checked : Qt::Unchecked;
|
2010-01-14 17:41:29 +01:00
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
if (role == Qt::FontRole) {
|
|
|
|
|
if (m_special) {
|
|
|
|
|
QFont italics;
|
|
|
|
|
italics.setItalic(true);
|
|
|
|
|
return italics;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return QVariant();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CMakeTargetItem::setData(int column, const QVariant &data, int role)
|
2016-04-22 15:54:16 +02:00
|
|
|
{
|
2020-09-10 17:01:32 +02:00
|
|
|
if (column == 0 && role == Qt::CheckStateRole) {
|
|
|
|
|
m_step->setBuildsBuildTarget(m_target, data.value<Qt::CheckState>() == Qt::Checked);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return TreeItem::setData(column, data, role);
|
2016-04-22 15:54:16 +02:00
|
|
|
}
|
|
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
Qt::ItemFlags CMakeTargetItem::flags(int) const
|
|
|
|
|
{
|
|
|
|
|
return Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CMakeBuildStep
|
|
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Utils::Id id) :
|
2019-12-20 17:05:30 +01:00
|
|
|
AbstractProcessStep(bsl, id)
|
2010-01-14 17:41:29 +01:00
|
|
|
{
|
2020-09-08 14:53:15 +02:00
|
|
|
m_cmakeArguments = addAspect<StringAspect>();
|
|
|
|
|
m_cmakeArguments->setSettingsKey(CMAKE_ARGUMENTS_KEY);
|
2022-09-29 15:26:31 +02:00
|
|
|
m_cmakeArguments->setLabelText(Tr::tr("CMake arguments:"));
|
2020-09-08 14:53:15 +02:00
|
|
|
m_cmakeArguments->setDisplayStyle(StringAspect::LineEditDisplay);
|
|
|
|
|
|
|
|
|
|
m_toolArguments = addAspect<StringAspect>();
|
|
|
|
|
m_toolArguments->setSettingsKey(TOOL_ARGUMENTS_KEY);
|
2022-09-29 15:26:31 +02:00
|
|
|
m_toolArguments->setLabelText(Tr::tr("Tool arguments:"));
|
2020-09-08 14:53:15 +02:00
|
|
|
m_toolArguments->setDisplayStyle(StringAspect::LineEditDisplay);
|
|
|
|
|
|
CMake: iOS: Enable automatic provisioning updates
By default xcodebuild does not try create / download a provisioning
profile for a project if a valid one does not exist locally
in ~/Library/MobileDevice/Provisioning Profiles, even if the
Xcode CODE_SIGN_STYLE attribute is set to Automatic.
Starting with Xcode 9, xcodebuild accepts a new
-allowProvisioningUpdates option.
When passed, xcodebuild will request a new provisioning profile
from Apple's servers for the current project and use it during
the build. The provisioning profile is only needed when building
for a real device, not the simulator.
When building an iOS project with qmake, the option is embedded in the
wrapping Makefile generated by qmake, so Qt Creator can simply call
make (which it does).
For CMake, there is no wrapping Makefile, so we need to pass the new
option explicitly as an additional build tool argument.
There might be cases where automatic provisioning is not desired,
which is why there is now a new checkbox in the CMake build step
configuration widget. It's default value is 'enabled', to match
qmake's behavior.
As an implementation detail, isiOS had to be moved to a header file so
it's accessible to both the build configuration and the build step.
Fixes: QTCREATORBUG-26246
Change-Id: Ic80cd965ba095d0ff379e13ad2ffb8c298c9f7c4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-05 16:26:11 +02:00
|
|
|
Kit *kit = buildConfiguration()->kit();
|
|
|
|
|
if (CMakeBuildConfiguration::isIos(kit)) {
|
|
|
|
|
m_useiOSAutomaticProvisioningUpdates = addAspect<BoolAspect>();
|
|
|
|
|
m_useiOSAutomaticProvisioningUpdates->setDefaultValue(true);
|
|
|
|
|
m_useiOSAutomaticProvisioningUpdates->setSettingsKey(
|
|
|
|
|
IOS_AUTOMATIC_PROVISIONG_UPDATES_ARGUMENTS_KEY);
|
|
|
|
|
m_useiOSAutomaticProvisioningUpdates->setLabel(
|
2022-09-29 15:26:31 +02:00
|
|
|
Tr::tr("Enable automatic provisioning updates:"));
|
CMake: iOS: Enable automatic provisioning updates
By default xcodebuild does not try create / download a provisioning
profile for a project if a valid one does not exist locally
in ~/Library/MobileDevice/Provisioning Profiles, even if the
Xcode CODE_SIGN_STYLE attribute is set to Automatic.
Starting with Xcode 9, xcodebuild accepts a new
-allowProvisioningUpdates option.
When passed, xcodebuild will request a new provisioning profile
from Apple's servers for the current project and use it during
the build. The provisioning profile is only needed when building
for a real device, not the simulator.
When building an iOS project with qmake, the option is embedded in the
wrapping Makefile generated by qmake, so Qt Creator can simply call
make (which it does).
For CMake, there is no wrapping Makefile, so we need to pass the new
option explicitly as an additional build tool argument.
There might be cases where automatic provisioning is not desired,
which is why there is now a new checkbox in the CMake build step
configuration widget. It's default value is 'enabled', to match
qmake's behavior.
As an implementation detail, isiOS had to be moved to a header file so
it's accessible to both the build configuration and the build step.
Fixes: QTCREATORBUG-26246
Change-Id: Ic80cd965ba095d0ff379e13ad2ffb8c298c9f7c4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-05 16:26:11 +02:00
|
|
|
m_useiOSAutomaticProvisioningUpdates->setToolTip(
|
2022-09-29 15:26:31 +02:00
|
|
|
Tr::tr("Tells xcodebuild to create and download a provisioning profile "
|
CMake: iOS: Enable automatic provisioning updates
By default xcodebuild does not try create / download a provisioning
profile for a project if a valid one does not exist locally
in ~/Library/MobileDevice/Provisioning Profiles, even if the
Xcode CODE_SIGN_STYLE attribute is set to Automatic.
Starting with Xcode 9, xcodebuild accepts a new
-allowProvisioningUpdates option.
When passed, xcodebuild will request a new provisioning profile
from Apple's servers for the current project and use it during
the build. The provisioning profile is only needed when building
for a real device, not the simulator.
When building an iOS project with qmake, the option is embedded in the
wrapping Makefile generated by qmake, so Qt Creator can simply call
make (which it does).
For CMake, there is no wrapping Makefile, so we need to pass the new
option explicitly as an additional build tool argument.
There might be cases where automatic provisioning is not desired,
which is why there is now a new checkbox in the CMake build step
configuration widget. It's default value is 'enabled', to match
qmake's behavior.
As an implementation detail, isiOS had to be moved to a header file so
it's accessible to both the build configuration and the build step.
Fixes: QTCREATORBUG-26246
Change-Id: Ic80cd965ba095d0ff379e13ad2ffb8c298c9f7c4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-05 16:26:11 +02:00
|
|
|
"if a valid one does not exist."));
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-29 15:26:31 +02:00
|
|
|
m_buildTargetModel.setHeader({Tr::tr("Target")});
|
2020-09-10 17:01:32 +02:00
|
|
|
|
|
|
|
|
setBuildTargets({defaultBuildTarget()});
|
2021-09-16 17:28:47 +02:00
|
|
|
auto *bs = qobject_cast<CMakeBuildSystem *>(buildSystem());
|
|
|
|
|
if (bs && !bs->buildTargets().isEmpty())
|
|
|
|
|
recreateBuildTargetsModel();
|
2017-04-26 15:34:04 +02:00
|
|
|
|
2019-10-09 21:29:12 +03:00
|
|
|
setLowPriority();
|
2019-09-10 23:39:29 +03:00
|
|
|
|
2020-09-14 17:17:55 +02:00
|
|
|
setCommandLineProvider([this] { return cmakeCommand(); });
|
|
|
|
|
|
2022-09-05 20:09:12 +02:00
|
|
|
setEnvironmentModifier([this](Environment &env) {
|
2020-08-13 16:48:44 +02:00
|
|
|
const QString ninjaProgressString = "[%f/%t "; // ninja: [33/100
|
2021-05-20 11:57:21 +02:00
|
|
|
env.setupEnglishOutput();
|
2020-08-13 16:48:44 +02:00
|
|
|
if (!env.expandedValueForKey("NINJA_STATUS").startsWith(ninjaProgressString))
|
|
|
|
|
env.set("NINJA_STATUS", ninjaProgressString + "%o/sec] ");
|
2022-09-05 20:09:12 +02:00
|
|
|
env.modify(m_userEnvironmentChanges);
|
2020-08-13 16:48:44 +02:00
|
|
|
});
|
|
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
connect(target(), &Target::parsingFinished, this, [this](bool success) {
|
|
|
|
|
if (success) // Do not change when parsing failed.
|
|
|
|
|
recreateBuildTargetsModel();
|
2020-06-02 19:37:25 +02:00
|
|
|
});
|
2020-09-10 17:01:32 +02:00
|
|
|
|
|
|
|
|
connect(target(), &Target::activeRunConfigurationChanged,
|
|
|
|
|
this, &CMakeBuildStep::updateBuildTargetsModel);
|
2013-08-26 16:01:24 +02:00
|
|
|
}
|
|
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
QVariantMap CMakeBuildStep::toMap() const
|
2009-10-15 19:06:51 +02:00
|
|
|
{
|
2010-01-14 17:41:29 +01:00
|
|
|
QVariantMap map(AbstractProcessStep::toMap());
|
2020-09-10 17:01:32 +02:00
|
|
|
map.insert(BUILD_TARGETS_KEY, m_buildTargets);
|
2022-09-05 20:09:12 +02:00
|
|
|
map.insert(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY), m_clearSystemEnvironment);
|
|
|
|
|
map.insert(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY), EnvironmentItem::toStringList(m_userEnvironmentChanges));
|
|
|
|
|
map.insert(QLatin1String(BUILD_PRESET_KEY), m_buildPreset);
|
|
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
return map;
|
2009-10-15 19:06:51 +02:00
|
|
|
}
|
|
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
bool CMakeBuildStep::fromMap(const QVariantMap &map)
|
2009-10-15 19:06:51 +02:00
|
|
|
{
|
2020-09-10 17:01:32 +02:00
|
|
|
setBuildTargets(map.value(BUILD_TARGETS_KEY).toStringList());
|
2022-09-05 20:09:12 +02:00
|
|
|
|
|
|
|
|
m_clearSystemEnvironment = map.value(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY))
|
|
|
|
|
.toBool();
|
|
|
|
|
m_userEnvironmentChanges = EnvironmentItem::fromStringList(
|
|
|
|
|
map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList());
|
|
|
|
|
|
|
|
|
|
updateAndEmitEnvironmentChanged();
|
|
|
|
|
|
|
|
|
|
m_buildPreset = map.value(QLatin1String(BUILD_PRESET_KEY)).toString();
|
|
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
return BuildStep::fromMap(map);
|
2009-10-15 19:06:51 +02:00
|
|
|
}
|
|
|
|
|
|
2019-01-10 15:31:44 +01:00
|
|
|
bool CMakeBuildStep::init()
|
2008-12-04 13:06:02 +01:00
|
|
|
{
|
2020-09-14 17:17:55 +02:00
|
|
|
if (!AbstractProcessStep::init())
|
|
|
|
|
return false;
|
|
|
|
|
|
2020-09-08 15:20:30 +02:00
|
|
|
BuildConfiguration *bc = buildConfiguration();
|
2020-02-24 10:46:54 +01:00
|
|
|
QTC_ASSERT(bc, return false);
|
2020-09-10 17:01:32 +02:00
|
|
|
|
2020-02-24 10:46:54 +01:00
|
|
|
if (!bc->isEnabled()) {
|
2020-01-15 08:56:11 +01:00
|
|
|
emit addTask(BuildSystemTask(Task::Error,
|
2022-09-29 15:26:31 +02:00
|
|
|
Tr::tr("The build configuration is currently disabled.")));
|
2020-09-10 17:01:32 +02:00
|
|
|
emitFaultyConfigurationMessage();
|
|
|
|
|
return false;
|
2017-04-24 13:37:55 +02:00
|
|
|
}
|
2016-01-07 13:15:29 +01:00
|
|
|
|
2020-09-07 15:56:18 +02:00
|
|
|
CMakeTool *tool = CMakeKitAspect::cmakeTool(kit());
|
2016-01-07 13:15:29 +01:00
|
|
|
if (!tool || !tool->isValid()) {
|
2020-01-15 08:56:11 +01:00
|
|
|
emit addTask(BuildSystemTask(Task::Error,
|
2022-09-29 15:26:31 +02:00
|
|
|
Tr::tr("A CMake tool must be set up for building. "
|
2020-01-15 08:56:11 +01:00
|
|
|
"Configure a CMake tool in the kit options.")));
|
2020-09-10 17:01:32 +02:00
|
|
|
emitFaultyConfigurationMessage();
|
|
|
|
|
return false;
|
2016-01-07 13:15:29 +01:00
|
|
|
}
|
2009-02-16 13:12:12 +01:00
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
if (m_buildTargets.contains(QString())) {
|
|
|
|
|
RunConfiguration *rc = target()->activeRunConfiguration();
|
|
|
|
|
if (!rc || rc->buildKey().isEmpty()) {
|
|
|
|
|
emit addTask(BuildSystemTask(Task::Error,
|
|
|
|
|
QCoreApplication::translate("ProjectExplorer::Task",
|
2016-01-11 11:40:24 +01:00
|
|
|
"You asked to build the current Run Configuration's build target only, "
|
|
|
|
|
"but it is not associated with a build target. "
|
2020-01-15 08:56:11 +01:00
|
|
|
"Update the Make Step in your build settings.")));
|
2020-09-10 17:01:32 +02:00
|
|
|
emitFaultyConfigurationMessage();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2012-09-06 13:13:12 +02:00
|
|
|
}
|
|
|
|
|
|
2017-06-22 13:53:48 +02:00
|
|
|
// Warn if doing out-of-source builds with a CMakeCache.txt is the source directory
|
2019-05-28 13:49:26 +02:00
|
|
|
const Utils::FilePath projectDirectory = bc->target()->project()->projectDirectory();
|
2017-06-22 13:53:48 +02:00
|
|
|
if (bc->buildDirectory() != projectDirectory) {
|
2019-05-15 14:54:25 +02:00
|
|
|
if (projectDirectory.pathAppended("CMakeCache.txt").exists()) {
|
2020-01-15 08:56:11 +01:00
|
|
|
emit addTask(BuildSystemTask(Task::Warning,
|
2022-09-29 15:26:31 +02:00
|
|
|
Tr::tr("There is a CMakeCache.txt file in \"%1\", which suggest an "
|
2017-06-22 13:53:48 +02:00
|
|
|
"in-source build was done before. You are now building in \"%2\", "
|
|
|
|
|
"and the CMakeCache.txt file might confuse CMake.")
|
2020-01-15 08:56:11 +01:00
|
|
|
.arg(projectDirectory.toUserOutput(), bc->buildDirectory().toUserOutput())));
|
2017-06-22 13:53:48 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-02 19:37:25 +02:00
|
|
|
setIgnoreReturnValue(m_buildTargets == QStringList(CMakeBuildStep::cleanTarget()));
|
2009-06-22 16:11:45 +02:00
|
|
|
|
2020-09-14 17:17:55 +02:00
|
|
|
return true;
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2020-04-16 13:53:05 +02:00
|
|
|
void CMakeBuildStep::setupOutputFormatter(Utils::OutputFormatter *formatter)
|
|
|
|
|
{
|
|
|
|
|
CMakeParser *cmakeParser = new CMakeParser;
|
2020-07-30 13:16:43 +02:00
|
|
|
CmakeProgressParser * const progressParser = new CmakeProgressParser;
|
|
|
|
|
connect(progressParser, &CmakeProgressParser::progress, this, [this](int percent) {
|
|
|
|
|
emit progress(percent, {});
|
|
|
|
|
});
|
|
|
|
|
formatter->addLineParser(progressParser);
|
2020-04-16 13:53:05 +02:00
|
|
|
cmakeParser->setSourceDirectory(project()->projectDirectory().toString());
|
|
|
|
|
formatter->addLineParsers({cmakeParser, new GnuMakeParser});
|
2021-11-15 15:11:43 +01:00
|
|
|
ToolChain *tc = ToolChainKitAspect::cxxToolChain(kit());
|
|
|
|
|
OutputTaskParser *xcodeBuildParser = nullptr;
|
|
|
|
|
if (tc && tc->targetAbi().os() == Abi::DarwinOS) {
|
|
|
|
|
xcodeBuildParser = new XcodebuildParser;
|
|
|
|
|
formatter->addLineParser(xcodeBuildParser);
|
|
|
|
|
progressParser->setRedirectionDetector(xcodeBuildParser);
|
|
|
|
|
}
|
2020-09-07 15:56:18 +02:00
|
|
|
const QList<Utils::OutputLineParser *> additionalParsers = kit()->createOutputParsers();
|
2020-07-30 13:16:43 +02:00
|
|
|
for (Utils::OutputLineParser * const p : additionalParsers)
|
|
|
|
|
p->setRedirectionDetector(progressParser);
|
|
|
|
|
formatter->addLineParsers(additionalParsers);
|
2020-04-16 13:53:05 +02:00
|
|
|
formatter->addSearchDir(processParameters()->effectiveWorkingDirectory());
|
|
|
|
|
AbstractProcessStep::setupOutputFormatter(formatter);
|
|
|
|
|
}
|
|
|
|
|
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
void CMakeBuildStep::doRun()
|
2016-02-25 14:18:05 +01:00
|
|
|
{
|
|
|
|
|
// Make sure CMake state was written to disk before trying to build:
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
m_waiting = false;
|
2020-02-19 11:55:48 +01:00
|
|
|
auto bs = static_cast<CMakeBuildSystem *>(buildSystem());
|
2019-10-25 09:55:32 +02:00
|
|
|
if (bs->persistCMakeState()) {
|
2022-09-29 15:26:31 +02:00
|
|
|
emit addOutput(Tr::tr("Persisting CMake state..."), BuildStep::OutputFormat::NormalMessage);
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
m_waiting = true;
|
2020-02-19 11:55:48 +01:00
|
|
|
} else if (buildSystem()->isWaitingForParse()) {
|
2022-09-29 15:26:31 +02:00
|
|
|
emit addOutput(Tr::tr("Running CMake in preparation to build..."), BuildStep::OutputFormat::NormalMessage);
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
m_waiting = true;
|
2016-10-06 15:55:55 +02:00
|
|
|
}
|
2016-02-25 14:18:05 +01:00
|
|
|
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
if (m_waiting) {
|
2019-10-25 09:55:32 +02:00
|
|
|
m_runTrigger = connect(target(), &Target::parsingFinished,
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
this, [this](bool success) { handleProjectWasParsed(success); });
|
2016-02-25 14:18:05 +01:00
|
|
|
} else {
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
runImpl();
|
2016-02-25 14:18:05 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
void CMakeBuildStep::runImpl()
|
2016-02-25 14:18:05 +01:00
|
|
|
{
|
|
|
|
|
// Do the actual build:
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
AbstractProcessStep::doRun();
|
2017-06-19 17:29:35 +02:00
|
|
|
}
|
|
|
|
|
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
void CMakeBuildStep::handleProjectWasParsed(bool success)
|
2017-06-19 17:29:35 +02:00
|
|
|
{
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
m_waiting = false;
|
2016-02-25 14:18:05 +01:00
|
|
|
disconnect(m_runTrigger);
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
if (isCanceled()) {
|
|
|
|
|
emit finished(false);
|
|
|
|
|
} else if (success) {
|
|
|
|
|
runImpl();
|
2017-07-18 16:48:02 +02:00
|
|
|
} else {
|
2022-09-29 15:26:31 +02:00
|
|
|
AbstractProcessStep::stdError(Tr::tr("Project did not parse successfully, cannot build."));
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
emit finished(false);
|
2017-07-18 16:48:02 +02:00
|
|
|
}
|
2016-02-25 14:18:05 +01:00
|
|
|
}
|
|
|
|
|
|
2019-07-23 13:05:07 +02:00
|
|
|
QString CMakeBuildStep::defaultBuildTarget() const
|
|
|
|
|
{
|
2019-08-16 12:16:17 +02:00
|
|
|
const BuildStepList *const bsl = stepList();
|
|
|
|
|
QTC_ASSERT(bsl, return {});
|
2020-06-26 13:59:38 +02:00
|
|
|
const Utils::Id parentId = bsl->id();
|
2019-07-23 13:05:07 +02:00
|
|
|
if (parentId == ProjectExplorer::Constants::BUILDSTEPS_CLEAN)
|
|
|
|
|
return cleanTarget();
|
|
|
|
|
if (parentId == ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
|
|
|
|
|
return installTarget();
|
|
|
|
|
return allTarget();
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-05 20:09:12 +02:00
|
|
|
bool CMakeBuildStep::isCleanStep() const
|
|
|
|
|
{
|
|
|
|
|
const BuildStepList *const bsl = stepList();
|
|
|
|
|
QTC_ASSERT(bsl, return false);
|
|
|
|
|
const Utils::Id parentId = bsl->id();
|
|
|
|
|
return parentId == ProjectExplorer::Constants::BUILDSTEPS_CLEAN;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-02 19:37:25 +02:00
|
|
|
QStringList CMakeBuildStep::buildTargets() const
|
2011-10-21 23:17:58 +02:00
|
|
|
{
|
2020-06-02 19:37:25 +02:00
|
|
|
return m_buildTargets;
|
2011-10-21 23:17:58 +02:00
|
|
|
}
|
|
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
bool CMakeBuildStep::buildsBuildTarget(const QString &target) const
|
2009-01-12 15:10:33 +01:00
|
|
|
{
|
2020-06-02 19:37:25 +02:00
|
|
|
return m_buildTargets.contains(target);
|
2009-01-12 15:10:33 +01:00
|
|
|
}
|
|
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
void CMakeBuildStep::setBuildsBuildTarget(const QString &target, bool on)
|
|
|
|
|
{
|
|
|
|
|
QStringList targets = m_buildTargets;
|
|
|
|
|
if (on && !m_buildTargets.contains(target))
|
|
|
|
|
targets.append(target);
|
|
|
|
|
if (!on)
|
|
|
|
|
targets.removeAll(target);
|
|
|
|
|
setBuildTargets(targets);
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-02 19:37:25 +02:00
|
|
|
void CMakeBuildStep::setBuildTargets(const QStringList &buildTargets)
|
2011-10-21 23:17:58 +02:00
|
|
|
{
|
2020-09-10 17:01:32 +02:00
|
|
|
if (buildTargets.isEmpty())
|
|
|
|
|
m_buildTargets = QStringList(defaultBuildTarget());
|
|
|
|
|
else
|
|
|
|
|
m_buildTargets = buildTargets;
|
|
|
|
|
updateBuildTargetsModel();
|
2011-10-21 23:17:58 +02:00
|
|
|
}
|
|
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
CommandLine CMakeBuildStep::cmakeCommand() const
|
2015-11-26 19:50:39 +01:00
|
|
|
{
|
2021-10-18 10:23:35 +02:00
|
|
|
CommandLine cmd;
|
|
|
|
|
if (CMakeTool *tool = CMakeKitAspect::cmakeTool(kit()))
|
|
|
|
|
cmd.setExecutable(tool->cmakeExecutable());
|
2015-11-26 19:50:39 +01:00
|
|
|
|
2021-10-18 10:23:35 +02:00
|
|
|
FilePath buildDirectory = ".";
|
2021-01-25 20:00:53 +01:00
|
|
|
if (buildConfiguration())
|
2021-10-18 10:23:35 +02:00
|
|
|
buildDirectory = buildConfiguration()->buildDirectory();
|
|
|
|
|
|
|
|
|
|
cmd.addArgs({"--build", buildDirectory.onDevice(cmd.executable()).path()});
|
2015-11-26 19:50:39 +01:00
|
|
|
|
2020-06-02 19:37:25 +02:00
|
|
|
cmd.addArg("--target");
|
2020-09-10 17:01:32 +02:00
|
|
|
cmd.addArgs(Utils::transform(m_buildTargets, [this](const QString &s) {
|
|
|
|
|
if (s.isEmpty()) {
|
|
|
|
|
if (RunConfiguration *rc = target()->activeRunConfiguration())
|
|
|
|
|
return rc->buildKey();
|
2019-07-29 13:51:43 +02:00
|
|
|
}
|
2020-09-10 17:01:32 +02:00
|
|
|
return s;
|
2020-06-02 19:37:25 +02:00
|
|
|
}));
|
2016-01-07 13:15:29 +01:00
|
|
|
|
2021-01-14 16:38:55 +01:00
|
|
|
auto bs = qobject_cast<CMakeBuildSystem*>(buildSystem());
|
2022-05-02 18:02:37 +02:00
|
|
|
if (bs && bs->isMultiConfigReader()) {
|
2021-01-14 16:38:55 +01:00
|
|
|
cmd.addArg("--config");
|
2022-09-05 20:09:12 +02:00
|
|
|
if (m_configuration)
|
|
|
|
|
cmd.addArg(m_configuration.value());
|
|
|
|
|
else
|
|
|
|
|
cmd.addArg(bs->cmakeBuildType());
|
2021-01-14 16:38:55 +01:00
|
|
|
}
|
|
|
|
|
|
2020-09-08 14:53:15 +02:00
|
|
|
if (!m_cmakeArguments->value().isEmpty())
|
|
|
|
|
cmd.addArgs(m_cmakeArguments->value(), CommandLine::Raw);
|
2016-03-30 13:06:21 +02:00
|
|
|
|
CMake: iOS: Enable automatic provisioning updates
By default xcodebuild does not try create / download a provisioning
profile for a project if a valid one does not exist locally
in ~/Library/MobileDevice/Provisioning Profiles, even if the
Xcode CODE_SIGN_STYLE attribute is set to Automatic.
Starting with Xcode 9, xcodebuild accepts a new
-allowProvisioningUpdates option.
When passed, xcodebuild will request a new provisioning profile
from Apple's servers for the current project and use it during
the build. The provisioning profile is only needed when building
for a real device, not the simulator.
When building an iOS project with qmake, the option is embedded in the
wrapping Makefile generated by qmake, so Qt Creator can simply call
make (which it does).
For CMake, there is no wrapping Makefile, so we need to pass the new
option explicitly as an additional build tool argument.
There might be cases where automatic provisioning is not desired,
which is why there is now a new checkbox in the CMake build step
configuration widget. It's default value is 'enabled', to match
qmake's behavior.
As an implementation detail, isiOS had to be moved to a header file so
it's accessible to both the build configuration and the build step.
Fixes: QTCREATORBUG-26246
Change-Id: Ic80cd965ba095d0ff379e13ad2ffb8c298c9f7c4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-05 16:26:11 +02:00
|
|
|
bool toolArgumentsSpecified = false;
|
2020-09-08 14:53:15 +02:00
|
|
|
if (!m_toolArguments->value().isEmpty()) {
|
2019-05-29 18:54:45 +02:00
|
|
|
cmd.addArg("--");
|
2020-09-08 14:53:15 +02:00
|
|
|
cmd.addArgs(m_toolArguments->value(), CommandLine::Raw);
|
CMake: iOS: Enable automatic provisioning updates
By default xcodebuild does not try create / download a provisioning
profile for a project if a valid one does not exist locally
in ~/Library/MobileDevice/Provisioning Profiles, even if the
Xcode CODE_SIGN_STYLE attribute is set to Automatic.
Starting with Xcode 9, xcodebuild accepts a new
-allowProvisioningUpdates option.
When passed, xcodebuild will request a new provisioning profile
from Apple's servers for the current project and use it during
the build. The provisioning profile is only needed when building
for a real device, not the simulator.
When building an iOS project with qmake, the option is embedded in the
wrapping Makefile generated by qmake, so Qt Creator can simply call
make (which it does).
For CMake, there is no wrapping Makefile, so we need to pass the new
option explicitly as an additional build tool argument.
There might be cases where automatic provisioning is not desired,
which is why there is now a new checkbox in the CMake build step
configuration widget. It's default value is 'enabled', to match
qmake's behavior.
As an implementation detail, isiOS had to be moved to a header file so
it's accessible to both the build configuration and the build step.
Fixes: QTCREATORBUG-26246
Change-Id: Ic80cd965ba095d0ff379e13ad2ffb8c298c9f7c4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-05 16:26:11 +02:00
|
|
|
toolArgumentsSpecified = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m_useiOSAutomaticProvisioningUpdates && m_useiOSAutomaticProvisioningUpdates->value()) {
|
|
|
|
|
// Only add the double dash if it wasn't added before.
|
|
|
|
|
if (!toolArgumentsSpecified)
|
|
|
|
|
cmd.addArg("--");
|
|
|
|
|
cmd.addArgs("-allowProvisioningUpdates", CommandLine::Raw);
|
2016-01-07 13:15:29 +01:00
|
|
|
}
|
2014-04-03 16:33:04 +02:00
|
|
|
|
2019-05-29 18:54:45 +02:00
|
|
|
return cmd;
|
2014-10-02 17:51:02 +02:00
|
|
|
}
|
|
|
|
|
|
2021-01-14 16:38:55 +01:00
|
|
|
QString CMakeBuildStep::cleanTarget() const
|
2016-01-07 12:09:59 +01:00
|
|
|
{
|
2017-04-28 08:23:57 +02:00
|
|
|
return QString("clean");
|
2016-01-07 12:09:59 +01:00
|
|
|
}
|
|
|
|
|
|
2021-01-14 16:38:55 +01:00
|
|
|
QString CMakeBuildStep::allTarget() const
|
2020-12-22 16:57:54 +01:00
|
|
|
{
|
2021-01-14 16:38:55 +01:00
|
|
|
return m_allTarget;
|
2020-12-22 16:57:54 +01:00
|
|
|
}
|
|
|
|
|
|
2021-01-14 16:38:55 +01:00
|
|
|
QString CMakeBuildStep::installTarget() const
|
2017-06-02 09:11:39 +02:00
|
|
|
{
|
2021-01-14 16:38:55 +01:00
|
|
|
return m_installTarget;
|
2017-06-02 09:11:39 +02:00
|
|
|
}
|
|
|
|
|
|
2021-01-14 16:38:55 +01:00
|
|
|
QStringList CMakeBuildStep::specialTargets(bool allCapsTargets)
|
2017-04-26 15:27:01 +02:00
|
|
|
{
|
2021-01-14 16:38:55 +01:00
|
|
|
if (!allCapsTargets)
|
|
|
|
|
return {"all", "clean", "install", "install/strip", "package", "test"};
|
|
|
|
|
else
|
|
|
|
|
return {"ALL_BUILD", "clean", "INSTALL", "PACKAGE", "RUN_TESTS"};
|
2016-03-30 13:06:21 +02:00
|
|
|
}
|
|
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
QString CMakeBuildStep::activeRunConfigTarget() const
|
|
|
|
|
{
|
|
|
|
|
RunConfiguration *rc = target()->activeRunConfiguration();
|
|
|
|
|
return rc ? rc->buildKey() : QString();
|
|
|
|
|
}
|
2009-03-12 15:51:44 +01:00
|
|
|
|
2022-09-05 20:09:12 +02:00
|
|
|
void CMakeBuildStep::setBuildPreset(const QString &preset)
|
|
|
|
|
{
|
|
|
|
|
m_buildPreset = preset;
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-02 17:53:39 +02:00
|
|
|
QWidget *CMakeBuildStep::createConfigWidget()
|
2009-01-12 15:10:33 +01:00
|
|
|
{
|
2020-09-14 12:37:32 +02:00
|
|
|
auto updateDetails = [this] {
|
2020-09-10 17:01:32 +02:00
|
|
|
ProcessParameters param;
|
|
|
|
|
setupProcessParameters(¶m);
|
|
|
|
|
param.setCommandLine(cmakeCommand());
|
2022-09-05 20:09:12 +02:00
|
|
|
|
|
|
|
|
QString summaryText = param.summary(displayName());
|
|
|
|
|
|
|
|
|
|
if (!m_buildPreset.isEmpty()) {
|
|
|
|
|
const CMakeProject *cp = static_cast<const CMakeProject *>(project());
|
|
|
|
|
|
|
|
|
|
const auto buildPresets = cp->presetsData().buildPresets;
|
|
|
|
|
const PresetsDetails::BuildPreset preset
|
|
|
|
|
= Utils::findOrDefault(buildPresets, [this](const PresetsDetails::BuildPreset &bp) {
|
|
|
|
|
return bp.name == m_buildPreset;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const QString presetDisplayName = preset.displayName ? preset.displayName.value()
|
|
|
|
|
: preset.name;
|
|
|
|
|
if (!presetDisplayName.isEmpty())
|
|
|
|
|
summaryText.append(QString("<br><b>Preset</b>: %1").arg(presetDisplayName));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setSummaryText(summaryText);
|
2020-09-10 17:01:32 +02:00
|
|
|
};
|
2018-10-12 17:52:09 +02:00
|
|
|
|
2022-09-29 15:26:31 +02:00
|
|
|
setDisplayName(Tr::tr("Build", "ConfigWidget display name."));
|
2009-03-12 15:51:44 +01:00
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
auto buildTargetsView = new QTreeView;
|
|
|
|
|
buildTargetsView->setMinimumHeight(200);
|
|
|
|
|
buildTargetsView->setModel(&m_buildTargetModel);
|
|
|
|
|
buildTargetsView->setRootIsDecorated(false);
|
|
|
|
|
buildTargetsView->setHeaderHidden(true);
|
|
|
|
|
|
|
|
|
|
auto frame = ItemViewFind::createSearchableWrapper(buildTargetsView,
|
|
|
|
|
ItemViewFind::LightColored);
|
2014-08-04 12:16:04 +02:00
|
|
|
|
2022-09-05 20:09:12 +02:00
|
|
|
auto createAndAddEnvironmentWidgets = [this](Layouting::Form &builder) {
|
2022-09-29 15:26:31 +02:00
|
|
|
auto clearBox = new QCheckBox(Tr::tr("Clear system environment"));
|
2022-09-05 20:09:12 +02:00
|
|
|
clearBox->setChecked(useClearEnvironment());
|
|
|
|
|
|
|
|
|
|
auto envWidget = new EnvironmentWidget(nullptr, EnvironmentWidget::TypeLocal, clearBox);
|
|
|
|
|
envWidget->setBaseEnvironment(baseEnvironment());
|
|
|
|
|
envWidget->setBaseEnvironmentText(baseEnvironmentText());
|
|
|
|
|
envWidget->setUserChanges(userEnvironmentChanges());
|
|
|
|
|
|
|
|
|
|
connect(envWidget, &EnvironmentWidget::userChangesChanged, this, [this, envWidget] {
|
|
|
|
|
setUserEnvironmentChanges(envWidget->userChanges());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
connect(clearBox, &QAbstractButton::toggled, this, [this, envWidget](bool checked) {
|
|
|
|
|
setUseClearEnvironment(checked);
|
|
|
|
|
envWidget->setBaseEnvironment(baseEnvironment());
|
|
|
|
|
envWidget->setBaseEnvironmentText(baseEnvironmentText());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
connect(this, &CMakeBuildStep::environmentChanged, this, [this, envWidget] {
|
|
|
|
|
envWidget->setBaseEnvironment(baseEnvironment());
|
|
|
|
|
envWidget->setBaseEnvironmentText(baseEnvironmentText());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
builder.addRow(clearBox);
|
|
|
|
|
builder.addRow(envWidget);
|
|
|
|
|
};
|
|
|
|
|
|
2021-03-11 19:02:42 +01:00
|
|
|
Layouting::Form builder;
|
|
|
|
|
builder.addRow(m_cmakeArguments);
|
|
|
|
|
builder.addRow(m_toolArguments);
|
CMake: iOS: Enable automatic provisioning updates
By default xcodebuild does not try create / download a provisioning
profile for a project if a valid one does not exist locally
in ~/Library/MobileDevice/Provisioning Profiles, even if the
Xcode CODE_SIGN_STYLE attribute is set to Automatic.
Starting with Xcode 9, xcodebuild accepts a new
-allowProvisioningUpdates option.
When passed, xcodebuild will request a new provisioning profile
from Apple's servers for the current project and use it during
the build. The provisioning profile is only needed when building
for a real device, not the simulator.
When building an iOS project with qmake, the option is embedded in the
wrapping Makefile generated by qmake, so Qt Creator can simply call
make (which it does).
For CMake, there is no wrapping Makefile, so we need to pass the new
option explicitly as an additional build tool argument.
There might be cases where automatic provisioning is not desired,
which is why there is now a new checkbox in the CMake build step
configuration widget. It's default value is 'enabled', to match
qmake's behavior.
As an implementation detail, isiOS had to be moved to a header file so
it's accessible to both the build configuration and the build step.
Fixes: QTCREATORBUG-26246
Change-Id: Ic80cd965ba095d0ff379e13ad2ffb8c298c9f7c4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-05 16:26:11 +02:00
|
|
|
|
|
|
|
|
if (m_useiOSAutomaticProvisioningUpdates)
|
|
|
|
|
builder.addRow(m_useiOSAutomaticProvisioningUpdates);
|
|
|
|
|
|
2022-09-29 15:26:31 +02:00
|
|
|
builder.addRow({new QLabel(Tr::tr("Targets:")), frame});
|
2022-09-05 20:09:12 +02:00
|
|
|
|
|
|
|
|
if (!isCleanStep() && !m_buildPreset.isEmpty())
|
|
|
|
|
createAndAddEnvironmentWidgets(builder);
|
|
|
|
|
|
2022-09-15 19:50:54 +02:00
|
|
|
auto widget = builder.emerge(Layouting::WithoutMargins);
|
2009-01-12 15:10:33 +01:00
|
|
|
|
2011-05-30 13:30:10 +02:00
|
|
|
updateDetails();
|
|
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
connect(m_cmakeArguments, &StringAspect::changed, this, updateDetails);
|
|
|
|
|
connect(m_toolArguments, &StringAspect::changed, this, updateDetails);
|
2020-09-08 14:53:15 +02:00
|
|
|
|
CMake: iOS: Enable automatic provisioning updates
By default xcodebuild does not try create / download a provisioning
profile for a project if a valid one does not exist locally
in ~/Library/MobileDevice/Provisioning Profiles, even if the
Xcode CODE_SIGN_STYLE attribute is set to Automatic.
Starting with Xcode 9, xcodebuild accepts a new
-allowProvisioningUpdates option.
When passed, xcodebuild will request a new provisioning profile
from Apple's servers for the current project and use it during
the build. The provisioning profile is only needed when building
for a real device, not the simulator.
When building an iOS project with qmake, the option is embedded in the
wrapping Makefile generated by qmake, so Qt Creator can simply call
make (which it does).
For CMake, there is no wrapping Makefile, so we need to pass the new
option explicitly as an additional build tool argument.
There might be cases where automatic provisioning is not desired,
which is why there is now a new checkbox in the CMake build step
configuration widget. It's default value is 'enabled', to match
qmake's behavior.
As an implementation detail, isiOS had to be moved to a header file so
it's accessible to both the build configuration and the build step.
Fixes: QTCREATORBUG-26246
Change-Id: Ic80cd965ba095d0ff379e13ad2ffb8c298c9f7c4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-05 16:26:11 +02:00
|
|
|
if (m_useiOSAutomaticProvisioningUpdates)
|
|
|
|
|
connect(m_useiOSAutomaticProvisioningUpdates, &BoolAspect::changed, this, updateDetails);
|
|
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::settingsChanged,
|
2020-09-10 17:01:32 +02:00
|
|
|
this, updateDetails);
|
2014-10-02 17:51:02 +02:00
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
connect(buildConfiguration(), &BuildConfiguration::environmentChanged,
|
|
|
|
|
this, updateDetails);
|
|
|
|
|
|
|
|
|
|
connect(this, &CMakeBuildStep::buildTargetsChanged, widget, updateDetails);
|
|
|
|
|
|
|
|
|
|
return widget;
|
2009-01-12 15:10:33 +01:00
|
|
|
}
|
2008-12-04 13:06:02 +01:00
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
void CMakeBuildStep::recreateBuildTargetsModel()
|
2017-03-31 17:17:20 +02:00
|
|
|
{
|
2020-09-10 17:01:32 +02:00
|
|
|
auto addItem = [this](const QString &target, bool special = false) {
|
|
|
|
|
auto item = new CMakeTargetItem(target, this, special);
|
|
|
|
|
m_buildTargetModel.rootItem()->appendChild(item);
|
|
|
|
|
};
|
2020-06-02 19:37:25 +02:00
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
m_buildTargetModel.clear();
|
2018-07-20 12:17:36 +02:00
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
auto bs = qobject_cast<CMakeBuildSystem *>(buildSystem());
|
|
|
|
|
QStringList targetList = bs ? bs->buildTargetTitles() : QStringList();
|
2017-03-31 17:17:20 +02:00
|
|
|
|
2021-01-14 16:38:55 +01:00
|
|
|
bool usesAllCapsTargets = bs ? bs->usesAllCapsTargets() : false;
|
|
|
|
|
if (usesAllCapsTargets) {
|
|
|
|
|
m_allTarget = "ALL_BUILD";
|
|
|
|
|
m_installTarget = "INSTALL";
|
|
|
|
|
|
|
|
|
|
int idx = m_buildTargets.indexOf(QString("all"));
|
|
|
|
|
if (idx != -1)
|
|
|
|
|
m_buildTargets[idx] = QString("ALL_BUILD");
|
|
|
|
|
idx = m_buildTargets.indexOf(QString("install"));
|
|
|
|
|
if (idx != -1)
|
|
|
|
|
m_buildTargets[idx] = QString("INSTALL");
|
|
|
|
|
}
|
|
|
|
|
targetList.removeDuplicates();
|
2016-03-30 13:06:21 +02:00
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
addItem(QString(), true);
|
2017-04-26 15:29:54 +02:00
|
|
|
|
2021-03-31 17:58:09 +02:00
|
|
|
// Remove the targets that do not exist in the build system
|
|
|
|
|
// This can result when selected targets get renamed
|
|
|
|
|
if (!targetList.empty()) {
|
2021-04-27 14:27:53 +02:00
|
|
|
Utils::erase(m_buildTargets, [targetList](const QString &bt) {
|
|
|
|
|
return !bt.isEmpty() /* "current executable" */ && !targetList.contains(bt);
|
|
|
|
|
});
|
2021-03-31 17:58:09 +02:00
|
|
|
if (m_buildTargets.empty())
|
|
|
|
|
m_buildTargets.push_back(m_allTarget);
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
for (const QString &buildTarget : qAsConst(targetList))
|
2021-01-14 16:38:55 +01:00
|
|
|
addItem(buildTarget, specialTargets(usesAllCapsTargets).contains(buildTarget));
|
2016-03-30 13:06:21 +02:00
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
updateBuildTargetsModel();
|
2009-08-06 17:26:38 +02:00
|
|
|
}
|
|
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
void CMakeBuildStep::updateBuildTargetsModel()
|
2013-08-26 16:01:24 +02:00
|
|
|
{
|
2020-09-10 17:01:32 +02:00
|
|
|
emit m_buildTargetModel.layoutChanged();
|
|
|
|
|
emit buildTargetsChanged();
|
2013-08-26 16:01:24 +02:00
|
|
|
}
|
2018-07-20 12:17:36 +02:00
|
|
|
|
2022-09-05 20:09:12 +02:00
|
|
|
void CMakeBuildStep::setConfiguration(const QString &configuration)
|
|
|
|
|
{
|
|
|
|
|
m_configuration = configuration;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CMakeBuildStep::setToolArguments(const QStringList &nativeToolArguments)
|
|
|
|
|
{
|
|
|
|
|
m_toolArguments->setValue(nativeToolArguments.join(" "));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CMakeBuildStep::setCMakeArguments(const QStringList &cmakeArguments)
|
|
|
|
|
{
|
|
|
|
|
m_cmakeArguments->setValue(cmakeArguments.join(" "));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Environment CMakeBuildStep::environment() const
|
|
|
|
|
{
|
|
|
|
|
return m_environment;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CMakeBuildStep::setUserEnvironmentChanges(const Utils::EnvironmentItems &diff)
|
|
|
|
|
{
|
|
|
|
|
if (m_userEnvironmentChanges == diff)
|
|
|
|
|
return;
|
|
|
|
|
m_userEnvironmentChanges = diff;
|
|
|
|
|
updateAndEmitEnvironmentChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EnvironmentItems CMakeBuildStep::userEnvironmentChanges() const
|
|
|
|
|
{
|
|
|
|
|
return m_userEnvironmentChanges;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CMakeBuildStep::useClearEnvironment() const
|
|
|
|
|
{
|
|
|
|
|
return m_clearSystemEnvironment;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CMakeBuildStep::setUseClearEnvironment(bool b)
|
|
|
|
|
{
|
|
|
|
|
if (useClearEnvironment() == b)
|
|
|
|
|
return;
|
|
|
|
|
m_clearSystemEnvironment = b;
|
|
|
|
|
updateAndEmitEnvironmentChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CMakeBuildStep::updateAndEmitEnvironmentChanged()
|
|
|
|
|
{
|
|
|
|
|
Environment env = baseEnvironment();
|
|
|
|
|
env.modify(userEnvironmentChanges());
|
|
|
|
|
if (env == m_environment)
|
|
|
|
|
return;
|
|
|
|
|
m_environment = env;
|
|
|
|
|
emit environmentChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Environment CMakeBuildStep::baseEnvironment() const
|
|
|
|
|
{
|
|
|
|
|
Environment result;
|
|
|
|
|
if (!useClearEnvironment()) {
|
|
|
|
|
ProjectExplorer::IDevice::ConstPtr devicePtr = BuildDeviceKitAspect::device(kit());
|
|
|
|
|
result = devicePtr ? devicePtr->systemEnvironment() : Environment::systemEnvironment();
|
|
|
|
|
}
|
|
|
|
|
buildConfiguration()->addToEnvironment(result);
|
|
|
|
|
kit()->addToBuildEnvironment(result);
|
|
|
|
|
result.modify(project()->additionalEnvironment());
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString CMakeBuildStep::baseEnvironmentText() const
|
|
|
|
|
{
|
|
|
|
|
if (useClearEnvironment())
|
2022-09-29 15:26:31 +02:00
|
|
|
return Tr::tr("Clean Environment");
|
2022-09-05 20:09:12 +02:00
|
|
|
else
|
2022-09-29 15:26:31 +02:00
|
|
|
return Tr::tr("System Environment");
|
2022-09-05 20:09:12 +02:00
|
|
|
}
|
|
|
|
|
|
2020-09-10 17:01:32 +02:00
|
|
|
void CMakeBuildStep::processFinished(int exitCode, QProcess::ExitStatus status)
|
2009-08-06 17:26:38 +02:00
|
|
|
{
|
2020-09-10 17:01:32 +02:00
|
|
|
AbstractProcessStep::processFinished(exitCode, status);
|
|
|
|
|
emit progress(100, QString());
|
2009-08-06 15:31:32 +02:00
|
|
|
}
|
|
|
|
|
|
2016-01-07 12:33:52 +01:00
|
|
|
// CMakeBuildStepFactory
|
2008-12-04 13:06:02 +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
|
|
|
CMakeBuildStepFactory::CMakeBuildStepFactory()
|
2010-01-14 17:41:29 +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
|
|
|
registerStep<CMakeBuildStep>(Constants::CMAKE_BUILD_STEP_ID);
|
2022-09-29 15:26:31 +02:00
|
|
|
setDisplayName(Tr::tr("CMake Build", "Display name for CMakeProjectManager::CMakeBuildStep id."));
|
2020-04-07 14:44:22 +02:00
|
|
|
setSupportedProjectType(Constants::CMAKE_PROJECT_ID);
|
2010-01-14 17:41:29 +01:00
|
|
|
}
|
|
|
|
|
|
2022-09-29 15:26:31 +02:00
|
|
|
} // CMakeProjectManager::Internal
|
2020-07-30 13:16:43 +02:00
|
|
|
|
|
|
|
|
#include <cmakebuildstep.moc>
|