forked from qt-creator/qt-creator
BuildStep: Some cleanup
Remove unused BuildStep API. Remove outdated docs. Cleanup includes. Don't repeat custom cancel messages from build/deploy steps, as in case of cancel action the follow-up message: "Canceled build/deployment." always appears anyway. Change-Id: I50b31e0cc688ee66d76a3a1dbe58eb72702112ad Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -159,9 +159,6 @@ AndroidDeployQtStep::AndroidDeployQtStep(BuildStepList *parent, Id id)
|
|||||||
|
|
||||||
bool AndroidDeployQtStep::init()
|
bool AndroidDeployQtStep::init()
|
||||||
{
|
{
|
||||||
if (!BuildStep::init())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QtSupport::QtVersion *version = QtSupport::QtKitAspect::qtVersion(kit());
|
QtSupport::QtVersion *version = QtSupport::QtKitAspect::qtVersion(kit());
|
||||||
if (!version) {
|
if (!version) {
|
||||||
reportWarningOrError(Tr::tr("The Qt version for kit %1 is invalid.").arg(kit()->displayName()),
|
reportWarningOrError(Tr::tr("The Qt version for kit %1 is invalid.").arg(kit()->displayName()),
|
||||||
|
@@ -148,8 +148,6 @@ void IosDeployStep::updateDisplayNames()
|
|||||||
|
|
||||||
bool IosDeployStep::init()
|
bool IosDeployStep::init()
|
||||||
{
|
{
|
||||||
if (!BuildStep::init())
|
|
||||||
return false;
|
|
||||||
m_device = DeviceKitAspect::device(kit());
|
m_device = DeviceKitAspect::device(kit());
|
||||||
auto runConfig = qobject_cast<const IosRunConfiguration *>(
|
auto runConfig = qobject_cast<const IosRunConfiguration *>(
|
||||||
this->target()->activeRunConfiguration());
|
this->target()->activeRunConfiguration());
|
||||||
|
@@ -50,8 +50,6 @@ private:
|
|||||||
|
|
||||||
bool NimCompilerCleanStep::init()
|
bool NimCompilerCleanStep::init()
|
||||||
{
|
{
|
||||||
if (!BuildStep::init())
|
|
||||||
return false;
|
|
||||||
const FilePath buildDir = buildDirectory();
|
const FilePath buildDir = buildDirectory();
|
||||||
const bool exists = buildDir.exists();
|
const bool exists = buildDir.exists();
|
||||||
if (exists)
|
if (exists)
|
||||||
|
@@ -143,9 +143,6 @@ void AbstractProcessStep::setWorkingDirectoryProvider(const std::function<FilePa
|
|||||||
|
|
||||||
bool AbstractProcessStep::init()
|
bool AbstractProcessStep::init()
|
||||||
{
|
{
|
||||||
if (!BuildStep::init())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!setupProcessParameters(processParameters()))
|
if (!setupProcessParameters(processParameters()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@@ -10,17 +10,12 @@
|
|||||||
#include "kitinformation.h"
|
#include "kitinformation.h"
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
#include "projectexplorerconstants.h"
|
#include "projectexplorerconstants.h"
|
||||||
#include "projectexplorertr.h"
|
|
||||||
#include "sanitizerparser.h"
|
#include "sanitizerparser.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
|
|
||||||
#include <solutions/tasking/tasktree.h>
|
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
|
||||||
#include <utils/fileinprojectfinder.h>
|
#include <utils/fileinprojectfinder.h>
|
||||||
#include <utils/layoutbuilder.h>
|
#include <utils/layoutbuilder.h>
|
||||||
#include <utils/outputformatter.h>
|
#include <utils/outputformatter.h>
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
#include <utils/variablechooser.h>
|
#include <utils/variablechooser.h>
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -41,9 +36,6 @@
|
|||||||
|
|
||||||
\c init() is called in the GUI thread and can be used to query the
|
\c init() is called in the GUI thread and can be used to query the
|
||||||
project for any information you need.
|
project for any information you need.
|
||||||
|
|
||||||
\c run() is run via Utils::asyncRun in a separate thread. If you need an
|
|
||||||
event loop, you need to create it yourself.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -53,26 +45,6 @@
|
|||||||
that you need in the run() function.
|
that you need in the run() function.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn void ProjectExplorer::BuildStep::run(QFutureInterface<bool> &fi)
|
|
||||||
|
|
||||||
Reimplement this function. It is called when the target is built.
|
|
||||||
By default, this function is NOT run in the GUI thread, but runs in its
|
|
||||||
own thread. If you need an event loop, you need to create one.
|
|
||||||
This function should block until the task is done
|
|
||||||
|
|
||||||
The absolute minimal implementation is:
|
|
||||||
\code
|
|
||||||
fi.reportResult(true);
|
|
||||||
\endcode
|
|
||||||
|
|
||||||
By returning \c true from runInGuiThread(), this function is called in
|
|
||||||
the GUI thread. Then the function should not block and instead the
|
|
||||||
finished() signal should be emitted.
|
|
||||||
|
|
||||||
\sa runInGuiThread()
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn BuildStepConfigWidget *ProjectExplorer::BuildStep::createConfigWidget()
|
\fn BuildStepConfigWidget *ProjectExplorer::BuildStep::createConfigWidget()
|
||||||
|
|
||||||
@@ -93,11 +65,6 @@
|
|||||||
It should be in plain text, with the format in the parameter.
|
It should be in plain text, with the format in the parameter.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn void ProjectExplorer::BuildStep::finished()
|
|
||||||
This signal needs to be emitted if the build step runs in the GUI thread.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn bool ProjectExplorer::BuildStep::isImmutable()
|
\fn bool ProjectExplorer::BuildStep::isImmutable()
|
||||||
|
|
||||||
@@ -106,7 +73,6 @@
|
|||||||
immutable steps are run. The default implementation returns \c false.
|
immutable steps are run. The default implementation returns \c false.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using namespace Tasking;
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
static const char buildStepEnabledKey[] = "ProjectExplorer.BuildStep.Enabled";
|
static const char buildStepEnabledKey[] = "ProjectExplorer.BuildStep.Enabled";
|
||||||
@@ -118,52 +84,8 @@ static QList<BuildStepFactory *> g_buildStepFactories;
|
|||||||
BuildStep::BuildStep(BuildStepList *bsl, Id id)
|
BuildStep::BuildStep(BuildStepList *bsl, Id id)
|
||||||
: ProjectConfiguration(bsl, bsl->target(), id)
|
: ProjectConfiguration(bsl, bsl->target(), id)
|
||||||
, m_stepList(bsl)
|
, m_stepList(bsl)
|
||||||
, m_cancelMessage(Tr::tr("The build step was ended forcefully."))
|
|
||||||
{
|
{
|
||||||
connect(this, &ProjectConfiguration::displayNameChanged,
|
connect(this, &ProjectConfiguration::displayNameChanged, this, &BuildStep::updateSummary);
|
||||||
this, &BuildStep::updateSummary);
|
|
||||||
// m_displayName = step->displayName();
|
|
||||||
// m_summaryText = "<b>" + m_displayName + "</b>";
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStep::~BuildStep()
|
|
||||||
{
|
|
||||||
emit finished(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BuildStep::init()
|
|
||||||
{
|
|
||||||
return !m_taskTree;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BuildStep::run()
|
|
||||||
{
|
|
||||||
QTC_ASSERT(!m_taskTree, return);
|
|
||||||
|
|
||||||
m_taskTree.reset(new TaskTree({runRecipe()}));
|
|
||||||
connect(m_taskTree.get(), &TaskTree::progressValueChanged, this, [this](int value) {
|
|
||||||
emit progress(qRound(double(value) * 100 / std::max(m_taskTree->progressMaximum(), 1)), {});
|
|
||||||
});
|
|
||||||
connect(m_taskTree.get(), &TaskTree::done, this, [this] {
|
|
||||||
emit finished(true);
|
|
||||||
m_taskTree.release()->deleteLater();
|
|
||||||
});
|
|
||||||
connect(m_taskTree.get(), &TaskTree::errorOccurred, this, [this] {
|
|
||||||
emit finished(false);
|
|
||||||
m_taskTree.release()->deleteLater();
|
|
||||||
});
|
|
||||||
m_taskTree->start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BuildStep::cancel()
|
|
||||||
{
|
|
||||||
if (!m_taskTree)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_taskTree.reset();
|
|
||||||
if (!m_cancelMessage.isEmpty())
|
|
||||||
emit addOutput(m_cancelMessage, OutputFormat::ErrorMessage);
|
|
||||||
emit finished(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *BuildStep::doCreateConfigWidget()
|
QWidget *BuildStep::doCreateConfigWidget()
|
||||||
@@ -319,11 +241,6 @@ QVariant BuildStep::data(Id id) const
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildStep::setCancelMessage(const QString &message)
|
|
||||||
{
|
|
||||||
m_cancelMessage = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BuildStep::addMacroExpander()
|
void BuildStep::addMacroExpander()
|
||||||
{
|
{
|
||||||
m_addMacroExpander = true;
|
m_addMacroExpander = true;
|
||||||
|
@@ -3,35 +3,25 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "projectconfiguration.h"
|
#include "projectexplorer_export.h"
|
||||||
|
|
||||||
#include "buildconfiguration.h"
|
#include "buildconfiguration.h"
|
||||||
#include "projectexplorer_export.h"
|
#include "projectconfiguration.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
#include <atomic>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
class Environment;
|
|
||||||
class FilePath;
|
|
||||||
class MacroExpander;
|
class MacroExpander;
|
||||||
class OutputFormatter;
|
class OutputFormatter;
|
||||||
} // Utils
|
} // Utils
|
||||||
|
|
||||||
namespace Tasking {
|
namespace Tasking { class GroupItem; }
|
||||||
class GroupItem;
|
|
||||||
class TaskTree;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
class BuildConfiguration;
|
|
||||||
class BuildStepFactory;
|
class BuildStepFactory;
|
||||||
class BuildStepList;
|
class BuildStepList;
|
||||||
class BuildSystem;
|
class BuildSystem;
|
||||||
@@ -48,10 +38,7 @@ protected:
|
|||||||
explicit BuildStep(BuildStepList *bsl, Utils::Id id);
|
explicit BuildStep(BuildStepList *bsl, Utils::Id id);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~BuildStep() override;
|
virtual bool init() = 0;
|
||||||
virtual bool init();
|
|
||||||
void run();
|
|
||||||
void cancel();
|
|
||||||
|
|
||||||
void fromMap(const QVariantMap &map) override;
|
void fromMap(const QVariantMap &map) override;
|
||||||
void toMap(QVariantMap &map) const override;
|
void toMap(QVariantMap &map) const override;
|
||||||
@@ -98,7 +85,7 @@ public:
|
|||||||
void setImmutable(bool immutable) { m_immutable = immutable; }
|
void setImmutable(bool immutable) { m_immutable = immutable; }
|
||||||
|
|
||||||
virtual QVariant data(Utils::Id id) const;
|
virtual QVariant data(Utils::Id id) const;
|
||||||
void setSummaryUpdater(const std::function<QString ()> &summaryUpdater);
|
void setSummaryUpdater(const std::function<QString()> &summaryUpdater);
|
||||||
|
|
||||||
void addMacroExpander();
|
void addMacroExpander();
|
||||||
|
|
||||||
@@ -114,20 +101,18 @@ signals:
|
|||||||
/// Do note that for linking compile output with tasks, you should first emit the output
|
/// Do note that for linking compile output with tasks, you should first emit the output
|
||||||
/// and then emit the task. \p linkedOutput lines will be linked. And the last \p skipLines will
|
/// and then emit the task. \p linkedOutput lines will be linked. And the last \p skipLines will
|
||||||
/// be skipped.
|
/// be skipped.
|
||||||
void addTask(const ProjectExplorer::Task &task, int linkedOutputLines = 0, int skipLines = 0);
|
void addTask(const Task &task, int linkedOutputLines = 0, int skipLines = 0);
|
||||||
|
|
||||||
/// Adds \p string to the compile output view, formatted in \p format
|
/// Adds \p string to the compile output view, formatted in \p format
|
||||||
void addOutput(const QString &string, ProjectExplorer::BuildStep::OutputFormat format,
|
void addOutput(const QString &string, OutputFormat format,
|
||||||
ProjectExplorer::BuildStep::OutputNewlineSetting newlineSetting = DoAppendNewline);
|
OutputNewlineSetting newlineSetting = DoAppendNewline);
|
||||||
|
|
||||||
void enabledChanged();
|
void enabledChanged();
|
||||||
|
|
||||||
void progress(int percentage, const QString &message);
|
void progress(int percentage, const QString &message);
|
||||||
void finished(bool result);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual QWidget *createConfigWidget();
|
virtual QWidget *createConfigWidget();
|
||||||
void setCancelMessage(const QString &message);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class BuildManager;
|
friend class BuildManager;
|
||||||
@@ -140,10 +125,8 @@ private:
|
|||||||
bool m_addMacroExpander = false;
|
bool m_addMacroExpander = false;
|
||||||
std::optional<bool> m_wasExpanded;
|
std::optional<bool> m_wasExpanded;
|
||||||
std::function<QString()> m_summaryUpdater;
|
std::function<QString()> m_summaryUpdater;
|
||||||
std::unique_ptr<Tasking::TaskTree> m_taskTree;
|
|
||||||
|
|
||||||
QString m_summaryText;
|
QString m_summaryText;
|
||||||
QString m_cancelMessage;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT BuildStepFactory
|
class PROJECTEXPLORER_EXPORT BuildStepFactory
|
||||||
|
@@ -35,8 +35,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
bool init() final
|
bool init() final
|
||||||
{
|
{
|
||||||
if (!BuildStep::init())
|
|
||||||
return false;
|
|
||||||
m_source = m_sourceAspect();
|
m_source = m_sourceAspect();
|
||||||
m_target = m_targetAspect();
|
m_target = m_targetAspect();
|
||||||
return m_source.exists();
|
return m_source.exists();
|
||||||
|
@@ -27,9 +27,6 @@ public:
|
|||||||
|
|
||||||
bool init() override
|
bool init() override
|
||||||
{
|
{
|
||||||
if (!BuildStep::init())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
IDevice::ConstPtr device = DeviceKitAspect::device(kit());
|
IDevice::ConstPtr device = DeviceKitAspect::device(kit());
|
||||||
if (device)
|
if (device)
|
||||||
return true;
|
return true;
|
||||||
|
@@ -273,9 +273,6 @@ QbsBuildStep::QbsBuildStep(BuildStepList *bsl, Id id) :
|
|||||||
|
|
||||||
bool QbsBuildStep::init()
|
bool QbsBuildStep::init()
|
||||||
{
|
{
|
||||||
if (!BuildStep::init())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
auto bc = static_cast<QbsBuildConfiguration *>(buildConfiguration());
|
auto bc = static_cast<QbsBuildConfiguration *>(buildConfiguration());
|
||||||
|
|
||||||
if (!bc)
|
if (!bc)
|
||||||
|
@@ -52,8 +52,6 @@ QbsCleanStep::QbsCleanStep(BuildStepList *bsl, Id id)
|
|||||||
|
|
||||||
bool QbsCleanStep::init()
|
bool QbsCleanStep::init()
|
||||||
{
|
{
|
||||||
if (!BuildStep::init())
|
|
||||||
return false;
|
|
||||||
if (buildSystem()->isParsing())
|
if (buildSystem()->isParsing())
|
||||||
return false;
|
return false;
|
||||||
const auto bc = static_cast<QbsBuildConfiguration *>(buildConfiguration());
|
const auto bc = static_cast<QbsBuildConfiguration *>(buildConfiguration());
|
||||||
|
@@ -50,8 +50,6 @@ QbsInstallStep::QbsInstallStep(BuildStepList *bsl, Id id)
|
|||||||
|
|
||||||
bool QbsInstallStep::init()
|
bool QbsInstallStep::init()
|
||||||
{
|
{
|
||||||
if (!BuildStep::init())
|
|
||||||
return false;
|
|
||||||
QTC_ASSERT(!target()->buildSystem()->isParsing(), return false);
|
QTC_ASSERT(!target()->buildSystem()->isParsing(), return false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -38,7 +38,6 @@ using namespace Internal;
|
|||||||
AbstractRemoteLinuxDeployStep::AbstractRemoteLinuxDeployStep(BuildStepList *bsl, Id id)
|
AbstractRemoteLinuxDeployStep::AbstractRemoteLinuxDeployStep(BuildStepList *bsl, Id id)
|
||||||
: BuildStep(bsl, id), d(new AbstractRemoteLinuxDeployStepPrivate)
|
: BuildStep(bsl, id), d(new AbstractRemoteLinuxDeployStepPrivate)
|
||||||
{
|
{
|
||||||
setCancelMessage(Tr::tr("User requests deployment to stop; cleaning up."));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractRemoteLinuxDeployStep::~AbstractRemoteLinuxDeployStep()
|
AbstractRemoteLinuxDeployStep::~AbstractRemoteLinuxDeployStep()
|
||||||
@@ -99,8 +98,6 @@ void AbstractRemoteLinuxDeployStep::toMap(QVariantMap &map) const
|
|||||||
bool AbstractRemoteLinuxDeployStep::init()
|
bool AbstractRemoteLinuxDeployStep::init()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(d->internalInit, return false);
|
QTC_ASSERT(d->internalInit, return false);
|
||||||
if (!BuildStep::init())
|
|
||||||
return false;
|
|
||||||
const auto canDeploy = d->internalInit();
|
const auto canDeploy = d->internalInit();
|
||||||
if (!canDeploy) {
|
if (!canDeploy) {
|
||||||
emit addOutput(Tr::tr("Cannot deploy: %1").arg(canDeploy.error()),
|
emit addOutput(Tr::tr("Cannot deploy: %1").arg(canDeploy.error()),
|
||||||
|
Reference in New Issue
Block a user