forked from qt-creator/qt-creator
Use a type enum instead of duplicating functions between build and clean
That is e.g. buildSteps() and cleanSteps() --> steps(type)
This commit is contained in:
@@ -175,7 +175,7 @@ BuildConfiguration *GenericBuildConfigurationFactory::create(ProjectExplorer::Ta
|
||||
bc->setDisplayName(buildConfigurationName);
|
||||
|
||||
GenericMakeStep *makeStep = new GenericMakeStep(bc);
|
||||
bc->insertBuildStep(0, makeStep);
|
||||
bc->insertStep(ProjectExplorer::Build, 0, makeStep);
|
||||
makeStep->setBuildTarget("all", /* on = */ true);
|
||||
|
||||
target->addBuildConfiguration(bc); // also makes the name unique...
|
||||
|
||||
@@ -307,32 +307,38 @@ GenericMakeStepFactory::~GenericMakeStepFactory()
|
||||
{
|
||||
}
|
||||
|
||||
bool GenericMakeStepFactory::canCreate(ProjectExplorer::BuildConfiguration *parent, const QString &id) const
|
||||
bool GenericMakeStepFactory::canCreate(ProjectExplorer::BuildConfiguration *parent,
|
||||
ProjectExplorer::StepType type,
|
||||
const QString &id) const
|
||||
{
|
||||
Q_UNUSED(type)
|
||||
if (!qobject_cast<GenericBuildConfiguration *>(parent))
|
||||
return false;
|
||||
return id == QLatin1String(GENERIC_MS_ID);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep *GenericMakeStepFactory::create(ProjectExplorer::BuildConfiguration *parent,
|
||||
ProjectExplorer::StepType type,
|
||||
const QString &id)
|
||||
{
|
||||
if (!canCreate(parent, id))
|
||||
if (!canCreate(parent, type, id))
|
||||
return 0;
|
||||
return new GenericMakeStep(parent);
|
||||
}
|
||||
|
||||
bool GenericMakeStepFactory::canClone(ProjectExplorer::BuildConfiguration *parent,
|
||||
ProjectExplorer::StepType type,
|
||||
ProjectExplorer::BuildStep *source) const
|
||||
{
|
||||
const QString id(source->id());
|
||||
return canCreate(parent, id);
|
||||
return canCreate(parent, type, id);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep *GenericMakeStepFactory::clone(ProjectExplorer::BuildConfiguration *parent,
|
||||
ProjectExplorer::StepType type,
|
||||
ProjectExplorer::BuildStep *source)
|
||||
{
|
||||
if (!canClone(parent, source))
|
||||
if (!canClone(parent, type, source))
|
||||
return 0;
|
||||
GenericMakeStep *old(qobject_cast<GenericMakeStep *>(source));
|
||||
Q_ASSERT(old);
|
||||
@@ -340,16 +346,18 @@ ProjectExplorer::BuildStep *GenericMakeStepFactory::clone(ProjectExplorer::Build
|
||||
}
|
||||
|
||||
bool GenericMakeStepFactory::canRestore(ProjectExplorer::BuildConfiguration *parent,
|
||||
ProjectExplorer::StepType type,
|
||||
const QVariantMap &map) const
|
||||
{
|
||||
QString id(ProjectExplorer::idFromMap(map));
|
||||
return canCreate(parent, id);
|
||||
return canCreate(parent, type, id);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep *GenericMakeStepFactory::restore(ProjectExplorer::BuildConfiguration *parent,
|
||||
ProjectExplorer::StepType type,
|
||||
const QVariantMap &map)
|
||||
{
|
||||
if (!canRestore(parent, map))
|
||||
if (!canRestore(parent, type, map))
|
||||
return 0;
|
||||
GenericMakeStep *bs(new GenericMakeStep(parent));
|
||||
if (bs->fromMap(map))
|
||||
@@ -358,8 +366,10 @@ ProjectExplorer::BuildStep *GenericMakeStepFactory::restore(ProjectExplorer::Bui
|
||||
return 0;
|
||||
}
|
||||
|
||||
QStringList GenericMakeStepFactory::availableCreationIds(ProjectExplorer::BuildConfiguration *parent) const
|
||||
QStringList GenericMakeStepFactory::availableCreationIds(ProjectExplorer::BuildConfiguration *parent,
|
||||
ProjectExplorer::StepType type) const
|
||||
{
|
||||
Q_UNUSED(type)
|
||||
if (!qobject_cast<GenericBuildConfiguration *>(parent))
|
||||
return QStringList();
|
||||
return QStringList() << QLatin1String(GENERIC_MS_ID);
|
||||
|
||||
@@ -113,19 +113,27 @@ public:
|
||||
explicit GenericMakeStepFactory(QObject *parent = 0);
|
||||
virtual ~GenericMakeStepFactory();
|
||||
|
||||
virtual bool canCreate(ProjectExplorer::BuildConfiguration *parent, const QString &id) const;
|
||||
virtual bool canCreate(ProjectExplorer::BuildConfiguration *parent,
|
||||
ProjectExplorer::StepType type,
|
||||
const QString &id) const;
|
||||
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::BuildConfiguration *parent,
|
||||
ProjectExplorer::StepType type,
|
||||
const QString &id);
|
||||
virtual bool canClone(ProjectExplorer::BuildConfiguration *parent,
|
||||
ProjectExplorer::StepType type,
|
||||
ProjectExplorer::BuildStep *source) const;
|
||||
virtual ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildConfiguration *parent,
|
||||
ProjectExplorer::StepType type,
|
||||
ProjectExplorer::BuildStep *source);
|
||||
virtual bool canRestore(ProjectExplorer::BuildConfiguration *parent,
|
||||
ProjectExplorer::StepType type,
|
||||
const QVariantMap &map) const;
|
||||
virtual ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildConfiguration *parent,
|
||||
ProjectExplorer::StepType type,
|
||||
const QVariantMap &map);
|
||||
|
||||
virtual QStringList availableCreationIds(ProjectExplorer::BuildConfiguration *bc) const;
|
||||
virtual QStringList availableCreationIds(ProjectExplorer::BuildConfiguration *bc,
|
||||
ProjectExplorer::StepType type) const;
|
||||
virtual QString displayNameForId(const QString &id) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ GenericTarget *GenericTargetFactory::create(ProjectExplorer::Project *parent, co
|
||||
bc->setDisplayName("all");
|
||||
|
||||
GenericMakeStep *makeStep = new GenericMakeStep(bc);
|
||||
bc->insertBuildStep(0, makeStep);
|
||||
bc->insertStep(ProjectExplorer::Build, 0, makeStep);
|
||||
|
||||
makeStep->setBuildTarget("all", /* on = */ true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user