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