AutoTest: Be more correct when gathering buildsystem targets

This avoids taking too many buildsystem targets into account. On the
downside this breaks execution of several possible project layouts.

Change-Id: Ia7bf00d11a3e7c9bf362667e33b1d1542495db4a
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Christian Stenger
2017-09-11 15:47:35 +02:00
parent f65ddad8b5
commit fb063a09be

View File

@@ -29,6 +29,7 @@
#include <cpptools/cppmodelmanager.h>
#include <projectexplorer/session.h>
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
namespace Autotest {
@@ -293,11 +294,16 @@ QSet<QString> GTestTreeItem::internalTargets() const
QSet<QString> result;
const auto cppMM = CppTools::CppModelManager::instance();
const auto projectInfo = cppMM->projectInfo(ProjectExplorer::SessionManager::startupProject());
const QString file = filePath();
for (const CppTools::ProjectPart::Ptr projectPart : projectInfo.projectParts()) {
if (projectPart->buildTargetType != CppTools::ProjectPart::Executable)
continue;
if (projectPart->projectFile == proFile())
if (projectPart->projectFile == proFile()
&& Utils::anyOf(projectPart->files, [&file] (const CppTools::ProjectFile &pf) {
return pf.path == file;
})) {
result.insert(projectPart->buildSystemTarget + '|' + projectPart->projectFile);
}
}
return result;
}