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>
8 #include "cmStringAlgorithms.h"
16 unsigned long Version
;
18 Json::Value
DumpPath();
19 Json::Value
DumpEventKindNames();
22 ConfigureLog(cmFileAPI
& fileAPI
, unsigned long version
);
26 ConfigureLog::ConfigureLog(cmFileAPI
& fileAPI
, unsigned long 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();
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();