forked from qt-creator/qt-creator
Remove project() from BuildStep
The project() should in most cases not matter, instead the BuildConfiguration should. This shows all the information that needs to move into the BuildConfiguration classes.
This commit is contained in:
@@ -106,10 +106,10 @@ BuildConfiguration *CMakeBuildConfigurationFactory::create(const QString &type)
|
||||
return false;
|
||||
BuildConfiguration *bc = new CMakeBuildConfiguration(m_project, buildConfigurationName);
|
||||
|
||||
MakeStep *makeStep = new MakeStep(m_project, bc);
|
||||
MakeStep *makeStep = new MakeStep(bc);
|
||||
bc->insertBuildStep(0, makeStep);
|
||||
|
||||
MakeStep *cleanMakeStep = new MakeStep(m_project, bc);
|
||||
MakeStep *cleanMakeStep = new MakeStep(bc);
|
||||
bc->insertCleanStep(0, cleanMakeStep);
|
||||
cleanMakeStep->setClean(true);
|
||||
|
||||
@@ -671,11 +671,11 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
|
||||
bc->setValue("buildDirectory", copw.buildDirectory());
|
||||
|
||||
// Now create a standard build configuration
|
||||
makeStep = new MakeStep(this, bc);
|
||||
makeStep = new MakeStep(bc);
|
||||
bc->insertBuildStep(0, makeStep);
|
||||
|
||||
//TODO save arguments somewhere copw.arguments()
|
||||
MakeStep *cleanMakeStep = new MakeStep(this, bc);
|
||||
MakeStep *cleanMakeStep = new MakeStep(bc);
|
||||
bc->insertCleanStep(0, cleanMakeStep);
|
||||
cleanMakeStep->setClean(true);
|
||||
setActiveBuildConfiguration(bc);
|
||||
|
||||
@@ -42,15 +42,14 @@ using namespace CMakeProjectManager;
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
MakeStep::MakeStep(CMakeProject *pro, BuildConfiguration *bc)
|
||||
: AbstractMakeStep(pro, bc), m_pro(pro), m_clean(false), m_futureInterface(0)
|
||||
MakeStep::MakeStep(BuildConfiguration *bc)
|
||||
: AbstractMakeStep(bc), m_clean(false), m_futureInterface(0)
|
||||
{
|
||||
m_percentProgress = QRegExp("^\\[\\s*(\\d*)%\\]");
|
||||
}
|
||||
|
||||
MakeStep::MakeStep(MakeStep *bs, BuildConfiguration *bc)
|
||||
: AbstractMakeStep(bs, bc),
|
||||
m_pro(bs->m_pro),
|
||||
m_clean(bs->m_clean),
|
||||
m_futureInterface(0),
|
||||
m_buildTargets(bs->m_buildTargets),
|
||||
@@ -97,17 +96,19 @@ void MakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
|
||||
bool MakeStep::init()
|
||||
{
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
setBuildParser(m_pro->buildParser(bc));
|
||||
// TODO, we should probably have a member cmakeBuildConfiguration();
|
||||
CMakeProject *pro = static_cast<CMakeProject *>(buildConfiguration()->project());
|
||||
setBuildParser(pro->buildParser(bc));
|
||||
|
||||
setEnabled(true);
|
||||
setWorkingDirectory(m_pro->buildDirectory(bc));
|
||||
setWorkingDirectory(pro->buildDirectory(bc));
|
||||
|
||||
setCommand(m_pro->toolChain(bc)->makeCommand());
|
||||
setCommand(pro->toolChain(bc)->makeCommand());
|
||||
|
||||
QStringList arguments = m_buildTargets;
|
||||
arguments << additionalArguments();
|
||||
setArguments(arguments);
|
||||
setEnvironment(m_pro->environment(bc));
|
||||
setEnvironment(pro->environment(bc));
|
||||
setIgnoreReturnValue(m_clean);
|
||||
|
||||
return AbstractMakeStep::init();
|
||||
@@ -154,11 +155,6 @@ void MakeStep::stdOut(const QString &line)
|
||||
AbstractMakeStep::stdOut(line);
|
||||
}
|
||||
|
||||
CMakeProject *MakeStep::project() const
|
||||
{
|
||||
return m_pro;
|
||||
}
|
||||
|
||||
bool MakeStep::buildsTarget(const QString &target) const
|
||||
{
|
||||
return m_buildTargets.contains(target);
|
||||
@@ -277,12 +273,10 @@ bool MakeStepFactory::canCreate(const QString &name) const
|
||||
return (Constants::MAKESTEP == name);
|
||||
}
|
||||
|
||||
BuildStep *MakeStepFactory::create(Project *project, BuildConfiguration *bc, const QString &name) const
|
||||
BuildStep *MakeStepFactory::create(BuildConfiguration *bc, const QString &name) const
|
||||
{
|
||||
Q_ASSERT(name == Constants::MAKESTEP);
|
||||
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
|
||||
Q_ASSERT(pro);
|
||||
return new MakeStep(pro, bc);
|
||||
return new MakeStep(bc);
|
||||
}
|
||||
|
||||
BuildStep *MakeStepFactory::clone(BuildStep *bs, BuildConfiguration *bc) const
|
||||
|
||||
@@ -49,7 +49,7 @@ class MakeStep : public ProjectExplorer::AbstractMakeStep
|
||||
friend class MakeStepConfigWidget; // TODO remove
|
||||
// This is for modifying internal data
|
||||
public:
|
||||
MakeStep(CMakeProject *pro, ProjectExplorer::BuildConfiguration *bc);
|
||||
MakeStep(ProjectExplorer::BuildConfiguration *bc);
|
||||
MakeStep(MakeStep *bs, ProjectExplorer::BuildConfiguration *bc);
|
||||
~MakeStep();
|
||||
virtual bool init();
|
||||
@@ -60,7 +60,6 @@ public:
|
||||
virtual QString displayName();
|
||||
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
||||
virtual bool immutable() const;
|
||||
CMakeProject *project() const;
|
||||
bool buildsTarget(const QString &target) const;
|
||||
void setBuildTarget(const QString &target, bool on);
|
||||
QStringList additionalArguments() const;
|
||||
@@ -77,7 +76,6 @@ protected:
|
||||
// For parsing [ 76%]
|
||||
virtual void stdOut(const QString &line);
|
||||
private:
|
||||
CMakeProject *m_pro;
|
||||
bool m_clean;
|
||||
QRegExp m_percentProgress;
|
||||
QFutureInterface<bool> *m_futureInterface;
|
||||
@@ -107,7 +105,7 @@ private:
|
||||
class MakeStepFactory : public ProjectExplorer::IBuildStepFactory
|
||||
{
|
||||
virtual bool canCreate(const QString &name) const;
|
||||
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::Project *pro, ProjectExplorer::BuildConfiguration *bc, const QString &name) const;
|
||||
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::BuildConfiguration *bc, const QString &name) const;
|
||||
virtual ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStep *bs, ProjectExplorer::BuildConfiguration *bc) const;
|
||||
virtual QStringList canCreateForProject(ProjectExplorer::Project *pro) const;
|
||||
virtual QString displayNameForName(const QString &name) const;
|
||||
|
||||
Reference in New Issue
Block a user