@return source CMake files (e.g. CMakeLists.txt, *.cmake), modifying which should trigger reloading the project.
| 271 | |
| 272 | /// @return source CMake files (e.g. CMakeLists.txt, *.cmake), modifying which should trigger reloading the project. |
| 273 | static QSet<Path> parseCMakeFiles(const QJsonObject& cmakeFiles, PathInterner& sourcePathInterner, |
| 274 | QDateTime* lastModifiedCMakeFile) |
| 275 | { |
| 276 | Q_ASSERT(lastModifiedCMakeFile); |
| 277 | QSet<Path> ret; |
| 278 | for (const auto& jsonInput : cmakeFiles.value(QLatin1String("inputs")).toArray()) { |
| 279 | const auto input = jsonInput.toObject(); |
| 280 | const auto path = sourcePathInterner.internPath(input.value(QLatin1String("path")).toString()); |
| 281 | const auto isGenerated = input.value(QLatin1String("isGenerated")).toBool(); |
| 282 | const auto isExternal = input.value(QLatin1String("isExternal")).toBool(); |
| 283 | |
| 284 | // Generated CMake files can be modified during the CMake configure step - after KDevelop |
| 285 | // modifies the API client query file. Don't take into account last modified timestamps of |
| 286 | // generated files to prevent wrongly considering up-to-date data outdated. The user is |
| 287 | // not supposed to modify the generated files manually, so ignoring them should be fine. |
| 288 | if (!isGenerated && path.isLocalFile()) { |
| 289 | const auto info = QFileInfo(path.toLocalFile()); |
| 290 | *lastModifiedCMakeFile = std::max(info.lastModified(), *lastModifiedCMakeFile); |
| 291 | } |
| 292 | |
| 293 | // Reloading the project when a generated CMake file is changed can cause a reload loop, and the user is not |
| 294 | // supposed to modify the generated files manually. External files are not under the top-level source or build |
| 295 | // directories, so AbstractFileManagerPlugin::projectWatcher() never watches them. Watching each individual |
| 296 | // external CMake file can be costly and cause issues elsewhere if a watched item count limit is reached. |
| 297 | if (!isGenerated && !isExternal) { |
| 298 | ret.insert(path); |
| 299 | } |
| 300 | } |
| 301 | return ret; |
| 302 | } |
| 303 | |
| 304 | CMakeProjectData parseReplyIndexFile(const ReplyIndex& replyIndex, const Path& sourceDirectory, |
| 305 | const Path& buildDirectory) |
no test coverage detected