Merge topic 'curl-tls-verify'
[kiteware-cmake.git] / Source / cmFileAPIConfigureLog.cxx
blobad0997cf469c16f4e66b275aeb26fdb857b9d02c
1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
3 #include "cmFileAPIConfigureLog.h"
5 #include <cm3p/json/value.h>
7 #include "cmFileAPI.h"
8 #include "cmStringAlgorithms.h"
9 #include "cmake.h"
11 namespace {
13 class ConfigureLog
15 cmFileAPI& FileAPI;
16 unsigned long Version;
18 Json::Value DumpPath();
19 Json::Value DumpEventKindNames();
21 public:
22 ConfigureLog(cmFileAPI& fileAPI, unsigned long version);
23 Json::Value Dump();
26 ConfigureLog::ConfigureLog(cmFileAPI& fileAPI, unsigned long version)
27 : FileAPI(fileAPI)
28 , Version(version)
30 static_cast<void>(this->Version);
33 Json::Value ConfigureLog::Dump()
35 Json::Value configureLog = Json::objectValue;
36 configureLog["path"] = this->DumpPath();
37 configureLog["eventKindNames"] = this->DumpEventKindNames();
38 return configureLog;
41 Json::Value ConfigureLog::DumpPath()
43 return cmStrCat(this->FileAPI.GetCMakeInstance()->GetHomeOutputDirectory(),
44 "/CMakeFiles/CMakeConfigureLog.yaml");
47 Json::Value ConfigureLog::DumpEventKindNames()
49 // Report at most one version of each event kind.
50 // If a new event kind is added, increment ConfigureLogV1Minor.
51 // If a new version of an existing event kind is added, a new
52 // major version of the configureLog object kind is needed.
53 Json::Value eventKindNames = Json::arrayValue;
54 if (this->Version == 1) {
55 eventKindNames.append("message-v1"); // WriteMessageEvent
56 eventKindNames.append("try_compile-v1"); // WriteTryCompileEvent
57 eventKindNames.append("try_run-v1"); // WriteTryRunEvent
59 return eventKindNames;
63 Json::Value cmFileAPIConfigureLogDump(cmFileAPI& fileAPI,
64 unsigned long version)
66 ConfigureLog configureLog(fileAPI, version);
67 return configureLog.Dump();