cmake_file_api: New project command

Projects can use the new command to request file API replies for the current
run. No query files are generated, the query is tracked internally. Replies are
created in the file system at generation time in the usual way.

Fixes: #24951
This commit is contained in:
Craig Scott
2023-06-02 17:16:57 +10:00
committed by Brad King
parent 9a63aa8d57
commit 99b2ccf80d
17 changed files with 447 additions and 11 deletions

View File

@@ -41,6 +41,20 @@ public:
/** Report file-api capabilities for cmake -E capabilities. */
static Json::Value ReportCapabilities();
// Keep in sync with ObjectKindName.
enum class ObjectKind
{
CodeModel,
ConfigureLog,
Cache,
CMakeFiles,
Toolchains,
InternalTest
};
bool AddProjectQuery(ObjectKind kind, unsigned majorVersion,
unsigned minorVersion);
private:
cmake* CMakeInstance;
@@ -53,17 +67,6 @@ private:
static std::vector<std::string> LoadDir(std::string const& dir);
void RemoveOldReplyFiles();
// Keep in sync with ObjectKindName.
enum class ObjectKind
{
CodeModel,
ConfigureLog,
Cache,
CMakeFiles,
Toolchains,
InternalTest
};
/** Identify one object kind and major version. */
struct Object
{
@@ -76,6 +79,14 @@ private:
}
return l.Version < r.Version;
}
friend bool operator==(Object const& l, Object const& r)
{
return l.Kind == r.Kind && l.Version == r.Version;
}
friend bool operator!=(Object const& l, Object const& r)
{
return !(l == r);
}
};
/** Represent content of a query directory. */