Changeset View
Changeset View
Standalone View
Standalone View
plugins/cmake/cmakeserverimportjob.cpp
Show First 20 Lines • Show All 112 Lines • ▼ Show 20 Line(s) | 107 | for (const auto &targetObject: targets) { | |||
---|---|---|---|---|---|
113 | for (const auto &fileGroupValue: fileGroups) { | 113 | for (const auto &fileGroupValue: fileGroups) { | ||
114 | const auto fileGroup = fileGroupValue.toObject(); | 114 | const auto fileGroup = fileGroupValue.toObject(); | ||
115 | CMakeFile file; | 115 | CMakeFile file; | ||
116 | file.includes = kTransform<KDevelop::Path::List>(fileGroup.value(QStringLiteral("includePath")).toArray(), [](const QJsonValue& val) { return KDevelop::Path(val.toObject().value(QStringLiteral("path")).toString()); }); | 116 | file.includes = kTransform<KDevelop::Path::List>(fileGroup.value(QStringLiteral("includePath")).toArray(), [](const QJsonValue& val) { return KDevelop::Path(val.toObject().value(QStringLiteral("path")).toString()); }); | ||
117 | 117 | | |||
118 | file.compileFlags = fileGroup.value(QStringLiteral("compileFlags")).toString(); | 118 | file.compileFlags = fileGroup.value(QStringLiteral("compileFlags")).toString(); | ||
119 | file.defines = processDefines(file.compileFlags, fileGroup.value(QStringLiteral("defines")).toArray()); | 119 | file.defines = processDefines(file.compileFlags, fileGroup.value(QStringLiteral("defines")).toArray()); | ||
120 | 120 | | |||
121 | // apparently some file groups do not contain build system information | ||||
122 | // skip these, as they would produce bogus results for us and break the fallback | ||||
123 | // implemented in CMakeManager::fileInformation | ||||
124 | if (file.isEmpty()) { | ||||
125 | continue; | ||||
126 | } | ||||
127 | | ||||
121 | const auto sourcesArray = fileGroup.value(QStringLiteral("sources")).toArray(); | 128 | const auto sourcesArray = fileGroup.value(QStringLiteral("sources")).toArray(); | ||
122 | const KDevelop::Path::List sources = kTransform<KDevelop::Path::List>(sourcesArray, [targetDir](const QJsonValue& val) { return KDevelop::Path(targetDir, val.toString()); }); | 129 | const KDevelop::Path::List sources = kTransform<KDevelop::Path::List>(sourcesArray, [targetDir](const QJsonValue& val) { return KDevelop::Path(targetDir, val.toString()); }); | ||
123 | targetSources.reserve(targetSources.size() + sources.size()); | 130 | targetSources.reserve(targetSources.size() + sources.size()); | ||
124 | for (const auto& source: sources) { | 131 | for (const auto& source: sources) { | ||
125 | // NOTE: we use the canonical file path to prevent issues with symlinks in the path | 132 | // NOTE: we use the canonical file path to prevent issues with symlinks in the path | ||
126 | // leading to lookup failures | 133 | // leading to lookup failures | ||
127 | const auto localFile = rt->pathInHost(source); | 134 | const auto localFile = rt->pathInHost(source); | ||
128 | const auto canonicalFile = QFileInfo(source.toLocalFile()).canonicalFilePath(); | 135 | const auto canonicalFile = QFileInfo(source.toLocalFile()).canonicalFilePath(); | ||
▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines |