Fixes: Gdbmacros are left even after clean.

Task:     241374
Details:  Clean up what we leave behind, take care to not remove anything else. We run make distclean and remove the files we copies there plus the debug and release directories.
This commit is contained in:
dt
2009-01-16 13:25:38 +01:00
parent 3aef80df57
commit 33da8c0410
2 changed files with 104 additions and 63 deletions

View File

@@ -62,8 +62,9 @@ bool GdbMacrosBuildStep::init(const QString &buildConfiguration)
void GdbMacrosBuildStep::run(QFutureInterface<bool> & fi)
{
// TODO CONFIG handling
QVariant v = value("clean");
if (v.isNull() || v.toBool() == false) {
// Normal run
QString dumperPath = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()
->resourcePath() + "/gdbmacros/";
QStringList files;
@@ -128,6 +129,38 @@ void GdbMacrosBuildStep::run(QFutureInterface<bool> & fi)
qmake.waitForFinished();
fi.reportResult(true);
} else {
// Clean step, we want to remove the directory
QString destDir = m_buildDirectory + "/qtc-gdbmacros/";
Qt4Project *qt4Project = static_cast<Qt4Project *>(project());
QProcess make;
make.setEnvironment(qt4Project->environment(m_buildConfiguration).toStringList());
make.setWorkingDirectory(destDir);
make.start(qt4Project->qtVersion(m_buildConfiguration)->makeCommand(), QStringList()<<"distclean");
make.waitForFinished();
QStringList files;
files << "gdbmacros.cpp"
<< "gdbmacros.pro";
QStringList directories;
directories << "debug"
<< "release";
foreach(const QString &file, files) {
QFile destination(destDir + file);
destination.remove();
}
foreach(const QString &dir, directories) {
QDir destination(destDir + dir);
destination.rmdir(destDir + dir);
}
QDir(destDir).rmdir(destDir);
fi.reportResult(true);
}
}
QString GdbMacrosBuildStep::name()

View File

@@ -610,9 +610,13 @@ void Qt4Project::addDefaultBuild()
makeStep = new MakeStep(this);
insertBuildStep(2, makeStep);
GdbMacrosBuildStep *gdbmacrosCleanStep = new GdbMacrosBuildStep(this);
gdbmacrosCleanStep->setValue("clean", true);
insertCleanStep(0, gdbmacrosCleanStep);
MakeStep* cleanStep = new MakeStep(this);
cleanStep->setValue("clean", true);
insertCleanStep(0, cleanStep);
insertCleanStep(1, cleanStep);
ProjectLoadWizard wizard(this);
wizard.execDialog();
@@ -629,6 +633,10 @@ void Qt4Project::addDefaultBuild()
if (v.isValid() && v.toBool()) {
GdbMacrosBuildStep *gdbmacrostep = new GdbMacrosBuildStep(this);
insertBuildStep(0, gdbmacrostep);
GdbMacrosBuildStep *gdbmacrosCleanStep = new GdbMacrosBuildStep(this);
gdbmacrosCleanStep ->setValue("clean", true);
insertCleanStep(0, gdbmacrosCleanStep );
break;
}
}