aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/buildgraph/artifactcleaner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/buildgraph/artifactcleaner.cpp')
-rw-r--r--src/lib/buildgraph/artifactcleaner.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/buildgraph/artifactcleaner.cpp b/src/lib/buildgraph/artifactcleaner.cpp
index f4c5b47b0..7e9a449d4 100644
--- a/src/lib/buildgraph/artifactcleaner.cpp
+++ b/src/lib/buildgraph/artifactcleaner.cpp
@@ -30,6 +30,7 @@
#include "artifact.h"
#include "artifactvisitor.h"
+#include "productbuilddata.h"
#include "projectbuilddata.h"
#include <language/language.h>
@@ -107,7 +108,7 @@ private:
{
if (artifact->product != m_product)
return;
- if (artifact->parents.isEmpty()
+ if (artifact->product->buildData->targetArtifacts.contains(artifact)
&& m_options.cleanType() == CleanOptions::CleanupTemporaries) {
return;
}
@@ -154,9 +155,16 @@ void ArtifactCleaner::cleanup(const TopLevelProjectPtr &project,
// Directories created during the build are not artifacts (TODO: should they be?),
// so we have to clean them up manually.
- foreach (const QString &dir, directories) {
+ QList<QString> dirList = directories.toList();
+ for (int i = 0; i < dirList.count(); ++i) {
+ const QString &dir = dirList.at(i);
if (dir.startsWith(project->buildDirectory) && FileInfo(dir).exists())
removeEmptyDirectories(dir, options);
+ if (dir != project->buildDirectory) {
+ const QString parentDir = QDir::cleanPath(dir + "/..");
+ if (parentDir != project->buildDirectory && !dirList.contains(parentDir))
+ dirList << parentDir;
+ }
}
m_observer->incrementProgressValue();