Commit e4cdad30 authored by Tobias Hunger's avatar Tobias Hunger

CMake: Move MakeStep to CMakeBuildStep

Change-Id: I2a3432acd90cc27fb444ab30c3239497a51e01df
Reviewed-by: default avatarCristian Adam <cristian.adam@gmail.com>
Reviewed-by: default avatarNiels Weber <niels.weber@theqtcompany.com>
parent 2ce52e32
...@@ -31,12 +31,12 @@ ...@@ -31,12 +31,12 @@
#include "cmakebuildconfiguration.h" #include "cmakebuildconfiguration.h"
#include "cmakebuildinfo.h" #include "cmakebuildinfo.h"
#include "cmakebuildstep.h"
#include "cmakeopenprojectwizard.h" #include "cmakeopenprojectwizard.h"
#include "cmakeproject.h" #include "cmakeproject.h"
#include "cmakeprojectconstants.h" #include "cmakeprojectconstants.h"
#include "cmakebuildsettingswidget.h" #include "cmakebuildsettingswidget.h"
#include "cmakeprojectmanager.h" #include "cmakeprojectmanager.h"
#include "makestep.h"
#include <coreplugin/documentmanager.h> #include <coreplugin/documentmanager.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
...@@ -232,19 +232,19 @@ ProjectExplorer::BuildConfiguration *CMakeBuildConfigurationFactory::create(Proj ...@@ -232,19 +232,19 @@ ProjectExplorer::BuildConfiguration *CMakeBuildConfigurationFactory::create(Proj
ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
ProjectExplorer::BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN); ProjectExplorer::BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
MakeStep *makeStep = new MakeStep(buildSteps); auto buildStep = new CMakeBuildStep(buildSteps);
buildSteps->insertStep(0, makeStep); buildSteps->insertStep(0, buildStep);
MakeStep *cleanMakeStep = new MakeStep(cleanSteps); auto cleanStep = new CMakeBuildStep(cleanSteps);
cleanSteps->insertStep(0, cleanMakeStep); cleanSteps->insertStep(0, cleanStep);
cleanMakeStep->setBuildTarget(MakeStep::cleanTarget(), true); cleanStep->setBuildTarget(CMakeBuildStep::cleanTarget(), true);
bc->setBuildDirectory(copy.buildDirectory); bc->setBuildDirectory(copy.buildDirectory);
bc->setInitialArguments(copy.arguments); bc->setInitialArguments(copy.arguments);
// Default to all // Default to all
if (project->hasBuildTarget(QLatin1String("all"))) if (project->hasBuildTarget(QLatin1String("all")))
makeStep->setBuildTarget(QLatin1String("all"), true); buildStep->setBuildTarget(QLatin1String("all"), true);
return bc; return bc;
} }
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef MAKESTEP_H #ifndef CMAKEBUILDSTEP_H
#define MAKESTEP_H #define CMAKEBUILDSTEP_H
#include <projectexplorer/abstractprocessstep.h> #include <projectexplorer/abstractprocessstep.h>
...@@ -48,15 +48,15 @@ namespace Internal { ...@@ -48,15 +48,15 @@ namespace Internal {
class CMakeBuildConfiguration; class CMakeBuildConfiguration;
class CMakeRunConfiguration; class CMakeRunConfiguration;
class MakeStepFactory; class CMakeBuildStepFactory;
class MakeStep : public ProjectExplorer::AbstractProcessStep class CMakeBuildStep : public ProjectExplorer::AbstractProcessStep
{ {
Q_OBJECT Q_OBJECT
friend class MakeStepFactory; friend class CMakeBuildStepFactory;
public: public:
explicit MakeStep(ProjectExplorer::BuildStepList *bsl); explicit CMakeBuildStep(ProjectExplorer::BuildStepList *bsl);
CMakeBuildConfiguration *cmakeBuildConfiguration() const; CMakeBuildConfiguration *cmakeBuildConfiguration() const;
...@@ -100,8 +100,8 @@ protected: ...@@ -100,8 +100,8 @@ protected:
void processStarted() override; void processStarted() override;
void processFinished(int exitCode, QProcess::ExitStatus status) override; void processFinished(int exitCode, QProcess::ExitStatus status) override;
MakeStep(ProjectExplorer::BuildStepList *bsl, MakeStep *bs); CMakeBuildStep(ProjectExplorer::BuildStepList *bsl, CMakeBuildStep *bs);
MakeStep(ProjectExplorer::BuildStepList *bsl, Core::Id id); CMakeBuildStep(ProjectExplorer::BuildStepList *bsl, Core::Id id);
bool fromMap(const QVariantMap &map) override; bool fromMap(const QVariantMap &map) override;
...@@ -124,11 +124,11 @@ private: ...@@ -124,11 +124,11 @@ private:
QString m_makeCmd; QString m_makeCmd;
}; };
class MakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget class CMakeBuildStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
MakeStepConfigWidget(MakeStep *makeStep); CMakeBuildStepConfigWidget(CMakeBuildStep *buildStep);
virtual QString displayName() const; virtual QString displayName() const;
virtual QString summaryText() const; virtual QString summaryText() const;
...@@ -141,20 +141,20 @@ private: ...@@ -141,20 +141,20 @@ private:
void selectedBuildTargetsChanged(); void selectedBuildTargetsChanged();
private: private:
MakeStep *m_makeStep; CMakeBuildStep *m_buildStep;
Utils::PathChooser *m_makePathChooser; Utils::PathChooser *m_makePathChooser;
QListWidget *m_buildTargetsList; QListWidget *m_buildTargetsList;
QLineEdit *m_additionalArguments; QLineEdit *m_additionalArguments;
QString m_summaryText; QString m_summaryText;
}; };
class MakeStepFactory : public ProjectExplorer::IBuildStepFactory class CMakeBuildStepFactory : public ProjectExplorer::IBuildStepFactory
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit MakeStepFactory(QObject *parent = 0); explicit CMakeBuildStepFactory(QObject *parent = 0);
virtual ~MakeStepFactory(); virtual ~CMakeBuildStepFactory();
bool canCreate(ProjectExplorer::BuildStepList *parent, Core::Id id) const; bool canCreate(ProjectExplorer::BuildStepList *parent, Core::Id id) const;
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id); ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id);
...@@ -170,4 +170,4 @@ public: ...@@ -170,4 +170,4 @@ public:
} // namespace Internal } // namespace Internal
} // namespace CMakeProjectManager } // namespace CMakeProjectManager
#endif // MAKESTEP_H #endif // CMAKEBUILDSTEP_H
...@@ -29,16 +29,17 @@ ...@@ -29,16 +29,17 @@
****************************************************************************/ ****************************************************************************/
#include "cmakelocatorfilter.h" #include "cmakelocatorfilter.h"
#include "cmakebuildstep.h"
#include "cmakeproject.h" #include "cmakeproject.h"
#include "makestep.h"
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h> #include <projectexplorer/session.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/buildsteplist.h> #include <projectexplorer/buildsteplist.h>
#include <utils/fileutils.h>
#include <utils/algorithm.h>
#include <utils/fileutils.h>
using namespace CMakeProjectManager; using namespace CMakeProjectManager;
using namespace CMakeProjectManager::Internal; using namespace CMakeProjectManager::Internal;
...@@ -111,25 +112,22 @@ void CMakeLocatorFilter::accept(Core::LocatorFilterEntry selection) const ...@@ -111,25 +112,22 @@ void CMakeLocatorFilter::accept(Core::LocatorFilterEntry selection) const
return; return;
// Find the make step // Find the make step
MakeStep *makeStep = 0;
ProjectExplorer::BuildStepList *buildStepList = cmakeProject->activeTarget()->activeBuildConfiguration() ProjectExplorer::BuildStepList *buildStepList = cmakeProject->activeTarget()->activeBuildConfiguration()
->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); ->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
for (int i = 0; i < buildStepList->count(); ++i) { auto buildStep
makeStep = qobject_cast<MakeStep *>(buildStepList->at(i)); = qobject_cast<CMakeBuildStep *>(findOrDefault(buildStepList->steps(),
if (makeStep) [](BuildStep *s) -> bool { return qobject_cast<CMakeBuildStep *>(s); }));
break; if (!buildStep)
}
if (!makeStep)
return; return;
// Change the make step to build only the given target // Change the make step to build only the given target
QStringList oldTargets = makeStep->buildTargets(); QStringList oldTargets = buildStep->buildTargets();
makeStep->clearBuildTargets(); buildStep->clearBuildTargets();
makeStep->setBuildTarget(selection.displayName, true); buildStep->setBuildTarget(selection.displayName, true);
// Build // Build
ProjectExplorerPlugin::buildProject(cmakeProject); ProjectExplorerPlugin::buildProject(cmakeProject);
makeStep->setBuildTargets(oldTargets); buildStep->setBuildTargets(oldTargets);
} }
void CMakeLocatorFilter::refresh(QFutureInterface<void> &future) void CMakeLocatorFilter::refresh(QFutureInterface<void> &future)
......
...@@ -31,10 +31,10 @@ ...@@ -31,10 +31,10 @@
#include "cmakeproject.h" #include "cmakeproject.h"
#include "cmakebuildconfiguration.h" #include "cmakebuildconfiguration.h"
#include "cmakebuildstep.h"
#include "cmakeprojectconstants.h" #include "cmakeprojectconstants.h"
#include "cmakeprojectnodes.h" #include "cmakeprojectnodes.h"
#include "cmakerunconfiguration.h" #include "cmakerunconfiguration.h"
#include "makestep.h"
#include "cmakeopenprojectwizard.h" #include "cmakeopenprojectwizard.h"
#include "cmakecbpparser.h" #include "cmakecbpparser.h"
#include "cmakefile.h" #include "cmakefile.h"
......
...@@ -2,12 +2,12 @@ DEFINES += CMAKEPROJECTMANAGER_LIBRARY ...@@ -2,12 +2,12 @@ DEFINES += CMAKEPROJECTMANAGER_LIBRARY
include(../../qtcreatorplugin.pri) include(../../qtcreatorplugin.pri)
HEADERS = cmakebuildinfo.h \ HEADERS = cmakebuildinfo.h \
cmakebuildstep.h \
cmakeproject.h \ cmakeproject.h \
cmakeprojectplugin.h \ cmakeprojectplugin.h \
cmakeprojectmanager.h \ cmakeprojectmanager.h \
cmakeprojectconstants.h \ cmakeprojectconstants.h \
cmakeprojectnodes.h \ cmakeprojectnodes.h \
makestep.h \
cmakerunconfiguration.h \ cmakerunconfiguration.h \
cmakeopenprojectwizard.h \ cmakeopenprojectwizard.h \
cmakebuildconfiguration.h \ cmakebuildconfiguration.h \
...@@ -30,11 +30,11 @@ HEADERS = cmakebuildinfo.h \ ...@@ -30,11 +30,11 @@ HEADERS = cmakebuildinfo.h \
cmakepreloadcachekitinformation.h \ cmakepreloadcachekitinformation.h \
cmakepreloadcachekitconfigwidget.h cmakepreloadcachekitconfigwidget.h
SOURCES = cmakeproject.cpp \ SOURCES = cmakebuildstep.cpp \
cmakeproject.cpp \
cmakeprojectplugin.cpp \ cmakeprojectplugin.cpp \
cmakeprojectmanager.cpp \ cmakeprojectmanager.cpp \
cmakeprojectnodes.cpp \ cmakeprojectnodes.cpp \
makestep.cpp \
cmakerunconfiguration.cpp \ cmakerunconfiguration.cpp \
cmakeopenprojectwizard.cpp \ cmakeopenprojectwizard.cpp \
cmakebuildconfiguration.cpp \ cmakebuildconfiguration.cpp \
......
...@@ -23,6 +23,8 @@ QtcPlugin { ...@@ -23,6 +23,8 @@ QtcPlugin {
"cmakebuildinfo.h", "cmakebuildinfo.h",
"cmakebuildsettingswidget.cpp", "cmakebuildsettingswidget.cpp",
"cmakebuildsettingswidget.h", "cmakebuildsettingswidget.h",
"cmakebuildstep.cpp",
"cmakebuildstep.h",
"cmakecbpparser.cpp", "cmakecbpparser.cpp",
"cmakecbpparser.h", "cmakecbpparser.h",
"cmakeeditor.cpp", "cmakeeditor.cpp",
...@@ -61,8 +63,6 @@ QtcPlugin { ...@@ -61,8 +63,6 @@ QtcPlugin {
"cmaketool.h", "cmaketool.h",
"cmaketoolmanager.cpp", "cmaketoolmanager.cpp",
"cmaketoolmanager.h", "cmaketoolmanager.h",
"makestep.cpp",
"makestep.h",
"cmakesettingspage.h", "cmakesettingspage.h",
"cmakesettingspage.cpp", "cmakesettingspage.cpp",
"generatorinfo.h", "generatorinfo.h",
......
...@@ -31,10 +31,10 @@ ...@@ -31,10 +31,10 @@
#include "cmakeprojectplugin.h" #include "cmakeprojectplugin.h"
#include "cmakeeditor.h" #include "cmakeeditor.h"
#include "cmakebuildstep.h"
#include "cmakeprojectmanager.h" #include "cmakeprojectmanager.h"
#include "cmakebuildconfiguration.h" #include "cmakebuildconfiguration.h"
#include "cmakerunconfiguration.h" #include "cmakerunconfiguration.h"
#include "makestep.h"
#include "cmakeprojectconstants.h" #include "cmakeprojectconstants.h"
#include "cmakelocatorfilter.h" #include "cmakelocatorfilter.h"
#include "cmakesettingspage.h" #include "cmakesettingspage.h"
...@@ -67,7 +67,7 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString * ...@@ -67,7 +67,7 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *
addAutoReleasedObject(new CMakeSettingsPage); addAutoReleasedObject(new CMakeSettingsPage);
addAutoReleasedObject(new CMakeManager); addAutoReleasedObject(new CMakeManager);
addAutoReleasedObject(new MakeStepFactory); addAutoReleasedObject(new CMakeBuildStepFactory);
addAutoReleasedObject(new CMakeRunConfigurationFactory); addAutoReleasedObject(new CMakeRunConfigurationFactory);
addAutoReleasedObject(new CMakeBuildConfigurationFactory); addAutoReleasedObject(new CMakeBuildConfigurationFactory);
addAutoReleasedObject(new CMakeEditorFactory); addAutoReleasedObject(new CMakeEditorFactory);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment