diff --git a/src/plugins/android/androiddeployqtstep.cpp b/src/plugins/android/androiddeployqtstep.cpp index c75b14bf362..e91687f6db7 100644 --- a/src/plugins/android/androiddeployqtstep.cpp +++ b/src/plugins/android/androiddeployqtstep.cpp @@ -159,9 +159,6 @@ AndroidDeployQtStep::AndroidDeployQtStep(BuildStepList *parent, Id id) bool AndroidDeployQtStep::init() { - if (!BuildStep::init()) - return false; - QtSupport::QtVersion *version = QtSupport::QtKitAspect::qtVersion(kit()); if (!version) { reportWarningOrError(Tr::tr("The Qt version for kit %1 is invalid.").arg(kit()->displayName()), diff --git a/src/plugins/ios/iosdeploystep.cpp b/src/plugins/ios/iosdeploystep.cpp index b218af2284d..3e86d9ec860 100644 --- a/src/plugins/ios/iosdeploystep.cpp +++ b/src/plugins/ios/iosdeploystep.cpp @@ -148,8 +148,6 @@ void IosDeployStep::updateDisplayNames() bool IosDeployStep::init() { - if (!BuildStep::init()) - return false; m_device = DeviceKitAspect::device(kit()); auto runConfig = qobject_cast( this->target()->activeRunConfiguration()); diff --git a/src/plugins/nim/project/nimcompilercleanstep.cpp b/src/plugins/nim/project/nimcompilercleanstep.cpp index e8b523e7a5a..edfe1b370cb 100644 --- a/src/plugins/nim/project/nimcompilercleanstep.cpp +++ b/src/plugins/nim/project/nimcompilercleanstep.cpp @@ -50,8 +50,6 @@ private: bool NimCompilerCleanStep::init() { - if (!BuildStep::init()) - return false; const FilePath buildDir = buildDirectory(); const bool exists = buildDir.exists(); if (exists) diff --git a/src/plugins/projectexplorer/abstractprocessstep.cpp b/src/plugins/projectexplorer/abstractprocessstep.cpp index 550ecff2812..c5516d5dc5b 100644 --- a/src/plugins/projectexplorer/abstractprocessstep.cpp +++ b/src/plugins/projectexplorer/abstractprocessstep.cpp @@ -143,9 +143,6 @@ void AbstractProcessStep::setWorkingDirectoryProvider(const std::function - -#include #include #include #include -#include #include /*! @@ -41,9 +36,6 @@ \c init() is called in the GUI thread and can be used to query the 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. */ -/*! - \fn void ProjectExplorer::BuildStep::run(QFutureInterface &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() @@ -93,11 +65,6 @@ 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() @@ -106,7 +73,6 @@ immutable steps are run. The default implementation returns \c false. */ -using namespace Tasking; using namespace Utils; static const char buildStepEnabledKey[] = "ProjectExplorer.BuildStep.Enabled"; @@ -118,52 +84,8 @@ static QList g_buildStepFactories; BuildStep::BuildStep(BuildStepList *bsl, Id id) : ProjectConfiguration(bsl, bsl->target(), id) , m_stepList(bsl) - , m_cancelMessage(Tr::tr("The build step was ended forcefully.")) { - connect(this, &ProjectConfiguration::displayNameChanged, - this, &BuildStep::updateSummary); -// m_displayName = step->displayName(); -// m_summaryText = "" + m_displayName + ""; -} - -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); + connect(this, &ProjectConfiguration::displayNameChanged, this, &BuildStep::updateSummary); } QWidget *BuildStep::doCreateConfigWidget() @@ -319,11 +241,6 @@ QVariant BuildStep::data(Id id) const return {}; } -void BuildStep::setCancelMessage(const QString &message) -{ - m_cancelMessage = message; -} - void BuildStep::addMacroExpander() { m_addMacroExpander = true; diff --git a/src/plugins/projectexplorer/buildstep.h b/src/plugins/projectexplorer/buildstep.h index c22579f75fe..c5c82978223 100644 --- a/src/plugins/projectexplorer/buildstep.h +++ b/src/plugins/projectexplorer/buildstep.h @@ -3,35 +3,25 @@ #pragma once -#include "projectconfiguration.h" +#include "projectexplorer_export.h" #include "buildconfiguration.h" -#include "projectexplorer_export.h" +#include "projectconfiguration.h" #include -#include - -#include #include -#include #include namespace Utils { -class Environment; -class FilePath; class MacroExpander; class OutputFormatter; } // Utils -namespace Tasking { -class GroupItem; -class TaskTree; -} +namespace Tasking { class GroupItem; } namespace ProjectExplorer { -class BuildConfiguration; class BuildStepFactory; class BuildStepList; class BuildSystem; @@ -48,10 +38,7 @@ protected: explicit BuildStep(BuildStepList *bsl, Utils::Id id); public: - ~BuildStep() override; - virtual bool init(); - void run(); - void cancel(); + virtual bool init() = 0; void fromMap(const QVariantMap &map) override; void toMap(QVariantMap &map) const override; @@ -98,7 +85,7 @@ public: void setImmutable(bool immutable) { m_immutable = immutable; } virtual QVariant data(Utils::Id id) const; - void setSummaryUpdater(const std::function &summaryUpdater); + void setSummaryUpdater(const std::function &summaryUpdater); void addMacroExpander(); @@ -114,20 +101,18 @@ signals: /// 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 /// 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 - void addOutput(const QString &string, ProjectExplorer::BuildStep::OutputFormat format, - ProjectExplorer::BuildStep::OutputNewlineSetting newlineSetting = DoAppendNewline); + void addOutput(const QString &string, OutputFormat format, + OutputNewlineSetting newlineSetting = DoAppendNewline); void enabledChanged(); void progress(int percentage, const QString &message); - void finished(bool result); protected: virtual QWidget *createConfigWidget(); - void setCancelMessage(const QString &message); private: friend class BuildManager; @@ -140,10 +125,8 @@ private: bool m_addMacroExpander = false; std::optional m_wasExpanded; std::function m_summaryUpdater; - std::unique_ptr m_taskTree; QString m_summaryText; - QString m_cancelMessage; }; class PROJECTEXPLORER_EXPORT BuildStepFactory diff --git a/src/plugins/projectexplorer/copystep.cpp b/src/plugins/projectexplorer/copystep.cpp index 0d5c012016d..98cd5df3f17 100644 --- a/src/plugins/projectexplorer/copystep.cpp +++ b/src/plugins/projectexplorer/copystep.cpp @@ -35,8 +35,6 @@ public: protected: bool init() final { - if (!BuildStep::init()) - return false; m_source = m_sourceAspect(); m_target = m_targetAspect(); return m_source.exists(); diff --git a/src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.cpp b/src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.cpp index 00b9527b417..9ccf0662d07 100644 --- a/src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.cpp +++ b/src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.cpp @@ -27,9 +27,6 @@ public: bool init() override { - if (!BuildStep::init()) - return false; - IDevice::ConstPtr device = DeviceKitAspect::device(kit()); if (device) return true; diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp index 3cae842280a..17e76c85e7b 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp +++ b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp @@ -273,9 +273,6 @@ QbsBuildStep::QbsBuildStep(BuildStepList *bsl, Id id) : bool QbsBuildStep::init() { - if (!BuildStep::init()) - return false; - auto bc = static_cast(buildConfiguration()); if (!bc) diff --git a/src/plugins/qbsprojectmanager/qbscleanstep.cpp b/src/plugins/qbsprojectmanager/qbscleanstep.cpp index 475d38e9478..e3de616166e 100644 --- a/src/plugins/qbsprojectmanager/qbscleanstep.cpp +++ b/src/plugins/qbsprojectmanager/qbscleanstep.cpp @@ -52,8 +52,6 @@ QbsCleanStep::QbsCleanStep(BuildStepList *bsl, Id id) bool QbsCleanStep::init() { - if (!BuildStep::init()) - return false; if (buildSystem()->isParsing()) return false; const auto bc = static_cast(buildConfiguration()); diff --git a/src/plugins/qbsprojectmanager/qbsinstallstep.cpp b/src/plugins/qbsprojectmanager/qbsinstallstep.cpp index 0797f4cbca0..59baaf6e38e 100644 --- a/src/plugins/qbsprojectmanager/qbsinstallstep.cpp +++ b/src/plugins/qbsprojectmanager/qbsinstallstep.cpp @@ -50,8 +50,6 @@ QbsInstallStep::QbsInstallStep(BuildStepList *bsl, Id id) bool QbsInstallStep::init() { - if (!BuildStep::init()) - return false; QTC_ASSERT(!target()->buildSystem()->isParsing(), return false); return true; } diff --git a/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp b/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp index b9ebcf71246..a8f3d31d1e9 100644 --- a/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp +++ b/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp @@ -38,7 +38,6 @@ using namespace Internal; AbstractRemoteLinuxDeployStep::AbstractRemoteLinuxDeployStep(BuildStepList *bsl, Id id) : BuildStep(bsl, id), d(new AbstractRemoteLinuxDeployStepPrivate) { - setCancelMessage(Tr::tr("User requests deployment to stop; cleaning up.")); } AbstractRemoteLinuxDeployStep::~AbstractRemoteLinuxDeployStep() @@ -99,8 +98,6 @@ void AbstractRemoteLinuxDeployStep::toMap(QVariantMap &map) const bool AbstractRemoteLinuxDeployStep::init() { QTC_ASSERT(d->internalInit, return false); - if (!BuildStep::init()) - return false; const auto canDeploy = d->internalInit(); if (!canDeploy) { emit addOutput(Tr::tr("Cannot deploy: %1").arg(canDeploy.error()),