fileapi: Generate partial reply when buildsystem generation fails

In particular, the `configureLog` reply is useful for IDEs to read
`CMakeFiles/CMakeConfigureLog.yaml` when configuration fails.

Fixes: #26621
This commit is contained in:
Brad King
2025-04-14 09:34:24 -04:00
parent 09aa968ed0
commit 0cc962665b
42 changed files with 616 additions and 16 deletions

View File

@@ -27,8 +27,17 @@ public:
/** Get the list of configureLog object kind versions requested. */
std::vector<unsigned long> GetConfigureLogVersions();
/** Identify the situation in which WriteReplies is called. */
enum class IndexFor
{
Success,
FailedConfigure,
FailedCompute,
FailedGenerate,
};
/** Write fileapi replies to disk. */
void WriteReplies();
void WriteReplies(IndexFor indexFor);
/** Get the "cmake" instance with which this was constructed. */
cmake* GetCMakeInstance() const { return this->CMakeInstance; }
@@ -157,6 +166,9 @@ private:
This populates the "objects" field of the reply index. */
std::map<Object, Json::Value> ReplyIndexObjects;
/** Identify the situation in which WriteReplies was called. */
IndexFor ReplyIndexFor = IndexFor::Success;
std::unique_ptr<Json::CharReader> JsonReader;
std::unique_ptr<Json::StreamWriter> JsonWriter;