Commit 4ba95878 authored by Andre Hartmann's avatar Andre Hartmann Committed by Daniel Teske

Add a default "clean" BuildStep to Generic Projects.

Change-Id: I9e566781d719292a6881d040385bd5ce649d398a
Reviewed-by: default avatarAndre Hartmann <aha_1980@gmx.de>
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent 649ba48e
......@@ -183,11 +183,19 @@ BuildConfiguration *GenericBuildConfigurationFactory::create(ProjectExplorer::Ta
bc->setDisplayName(buildConfigurationName);
ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
ProjectExplorer::BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
Q_ASSERT(buildSteps);
GenericMakeStep *makeStep = new GenericMakeStep(buildSteps);
buildSteps->insertStep(0, makeStep);
makeStep->setBuildTarget("all", /* on = */ true);
Q_ASSERT(cleanSteps);
GenericMakeStep *cleanMakeStep = new GenericMakeStep(cleanSteps);
cleanSteps->insertStep(0, cleanMakeStep);
cleanMakeStep->setBuildTarget("clean", /* on = */ true);
cleanMakeStep->setClean(true);
target->addBuildConfiguration(bc); // also makes the name unique...
return bc;
}
......
......@@ -64,16 +64,19 @@ const char * const GENERIC_MS_DISPLAY_NAME(QT_TRANSLATE_NOOP("GenericProjectMana
const char * const BUILD_TARGETS_KEY("GenericProjectManager.GenericMakeStep.BuildTargets");
const char * const MAKE_ARGUMENTS_KEY("GenericProjectManager.GenericMakeStep.MakeArguments");
const char * const MAKE_COMMAND_KEY("GenericProjectManager.GenericMakeStep.MakeCommand");
const char * const CLEAN_KEY("GenericProjectManager.GenericMakeStep.Clean");
}
GenericMakeStep::GenericMakeStep(ProjectExplorer::BuildStepList *parent) :
AbstractProcessStep(parent, QLatin1String(GENERIC_MS_ID))
AbstractProcessStep(parent, QLatin1String(GENERIC_MS_ID)),
m_clean(false)
{
ctor();
}
GenericMakeStep::GenericMakeStep(ProjectExplorer::BuildStepList *parent, const QString &id) :
AbstractProcessStep(parent, id)
AbstractProcessStep(parent, id),
m_clean(false)
{
ctor();
}
......@@ -82,7 +85,8 @@ GenericMakeStep::GenericMakeStep(ProjectExplorer::BuildStepList *parent, Generic
AbstractProcessStep(parent, bs),
m_buildTargets(bs->m_buildTargets),
m_makeArguments(bs->m_makeArguments),
m_makeCommand(bs->m_makeCommand)
m_makeCommand(bs->m_makeCommand),
m_clean(bs->m_clean)
{
ctor();
}
......@@ -114,6 +118,11 @@ bool GenericMakeStep::init()
pp->setCommand(makeCommand());
pp->setArguments(allArguments());
// If we are cleaning, then make can fail with an error code, but that doesn't mean
// we should stop the clean queue
// That is mostly so that rebuild works on an already clean project
setIgnoreReturnValue(m_clean);
setOutputParser(new ProjectExplorer::GnuMakeParser());
if (bc->genericTarget()->genericProject()->toolChain())
appendOutputParser(bc->genericTarget()->genericProject()->toolChain()->outputParser());
......@@ -122,6 +131,16 @@ bool GenericMakeStep::init()
return AbstractProcessStep::init();
}
void GenericMakeStep::setClean(bool clean)
{
m_clean = clean;
}
bool GenericMakeStep::isClean() const
{
return m_clean;
}
QVariantMap GenericMakeStep::toMap() const
{
QVariantMap map(AbstractProcessStep::toMap());
......@@ -129,6 +148,7 @@ QVariantMap GenericMakeStep::toMap() const
map.insert(QLatin1String(BUILD_TARGETS_KEY), m_buildTargets);
map.insert(QLatin1String(MAKE_ARGUMENTS_KEY), m_makeArguments);
map.insert(QLatin1String(MAKE_COMMAND_KEY), m_makeCommand);
map.insert(QLatin1String(CLEAN_KEY), m_clean);
return map;
}
......@@ -137,6 +157,7 @@ bool GenericMakeStep::fromMap(const QVariantMap &map)
m_buildTargets = map.value(QLatin1String(BUILD_TARGETS_KEY)).toStringList();
m_makeArguments = map.value(QLatin1String(MAKE_ARGUMENTS_KEY)).toString();
m_makeCommand = map.value(QLatin1String(MAKE_COMMAND_KEY)).toString();
m_clean = map.value(QLatin1String(CLEAN_KEY)).toBool();
return BuildStep::fromMap(map);
}
......
......@@ -79,6 +79,9 @@ public:
QString allArguments() const;
QString makeCommand() const;
void setClean(bool clean);
bool isClean() const;
QVariantMap toMap() const;
protected:
......@@ -92,6 +95,7 @@ private:
QStringList m_buildTargets;
QString m_makeArguments;
QString m_makeCommand;
bool m_clean;
};
class GenericMakeStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget
......
......@@ -136,11 +136,17 @@ GenericTarget *GenericTargetFactory::create(ProjectExplorer::Project *parent, co
bc->setDisplayName("all");
ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
ProjectExplorer::BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
GenericMakeStep *makeStep = new GenericMakeStep(buildSteps);
buildSteps->insertStep(0, makeStep);
makeStep->setBuildTarget("all", /* on = */ true);
GenericMakeStep *cleanMakeStep = new GenericMakeStep(cleanSteps);
cleanSteps->insertStep(0, cleanMakeStep);
cleanMakeStep->setBuildTarget("clean", /* on = */ true);
cleanMakeStep->setClean(true);
bc->setBuildDirectory(genericproject->projectDirectory());
t->addBuildConfiguration(bc);
......
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