diff options
author | Christian Kandeler <christian.kandeler@digia.com> | 2013-12-04 13:44:48 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@digia.com> | 2013-12-04 14:57:36 +0100 |
commit | aa31e2dced97062552934271d186a43c3fd8e457 (patch) | |
tree | c5e503408fb3646dcf5d841d22c86f96425da491 /src/lib/buildgraph/artifactcleaner.cpp | |
parent | d8ff3bfaae6d76fb362a6ebb403abf1a903a7ee6 (diff) |
Fix "clean" operation.
We were missing some artifacts, and we also left some empty directories
behind.
Change-Id: Ib93fb7a6a644e09526c8d4e177d580fe2d870c54
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/lib/buildgraph/artifactcleaner.cpp')
-rw-r--r-- | src/lib/buildgraph/artifactcleaner.cpp | 12 |
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(); |