Commit 84b7ebbb authored by Milian Wolff's avatar Milian Wolff
Browse files

Don't import CMake file API results without CMakeCache.txt file

Our prune job let the .cmake folder linger around, and we happily
imported the data from there - at least in our unit tests. This
then failed the ctest find job, as no cache file existed. Now
we bail out early if the build dir has no CMakeCache.txt file.
parent 393ee851
Pipeline #202344 passed with stage
in 17 minutes and 37 seconds
......@@ -18,6 +18,7 @@ using namespace KDevelop;
#include <util/path.h>
#include <QtConcurrentRun>
#include <QFile>
#include <QJsonObject>
namespace CMake {
......@@ -40,7 +41,14 @@ void ImportJob::start()
const auto* bsm = m_project->buildSystemManager();
const auto sourceDirectory = m_project->path();
const auto buildDirectory = bsm->buildDirectory(m_project->projectItem());
auto future = QtConcurrent::run([sourceDirectory, buildDirectory]() -> CMakeProjectData {
// don't import data when no suitable CMakeCache file exists, which could happen
// because our prune job didn't use to delete the .cmake folder
if (!QFile::exists(Path(buildDirectory, QStringLiteral("CMakeCache.txt")).toLocalFile())) {
return {};
}
const auto replyIndex = findReplyIndexFile(buildDirectory.toLocalFile());
if (replyIndex.data.isEmpty()) {
return {};
......
Supports Markdown
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