|
|
@@ -2,12 +2,14 @@
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
|
|
#include "cmServerProtocol.h"
|
|
|
|
|
|
+#include "cmAlgorithms.h"
|
|
|
#include "cmExternalMakefileProjectGenerator.h"
|
|
|
#include "cmFileMonitor.h"
|
|
|
#include "cmGeneratorExpression.h"
|
|
|
#include "cmGeneratorTarget.h"
|
|
|
#include "cmGlobalGenerator.h"
|
|
|
#include "cmLinkLineComputer.h"
|
|
|
+#include "cmListFileCache.h"
|
|
|
#include "cmLocalGenerator.h"
|
|
|
#include "cmMakefile.h"
|
|
|
#include "cmServer.h"
|
|
|
@@ -18,6 +20,7 @@
|
|
|
#include "cmStateSnapshot.h"
|
|
|
#include "cmStateTypes.h"
|
|
|
#include "cmSystemTools.h"
|
|
|
+#include "cmTarget.h"
|
|
|
#include "cm_uv.h"
|
|
|
#include "cmake.h"
|
|
|
|
|
|
@@ -249,7 +252,7 @@ bool cmServerProtocol::DoActivate(const cmServerRequest& /*request*/,
|
|
|
|
|
|
std::pair<int, int> cmServerProtocol1::ProtocolVersion() const
|
|
|
{
|
|
|
- return std::make_pair(1, 0);
|
|
|
+ return std::make_pair(1, 1);
|
|
|
}
|
|
|
|
|
|
static void setErrorMessage(std::string* errorMessage, const std::string& text)
|
|
|
@@ -729,6 +732,37 @@ static Json::Value DumpSourceFilesList(
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+static Json::Value DumpBacktrace(const cmListFileBacktrace& backtrace)
|
|
|
+{
|
|
|
+ Json::Value result = Json::arrayValue;
|
|
|
+
|
|
|
+ cmListFileBacktrace backtraceCopy = backtrace;
|
|
|
+ while (!backtraceCopy.Top().FilePath.empty()) {
|
|
|
+ Json::Value entry = Json::objectValue;
|
|
|
+ entry[kPATH_KEY] = backtraceCopy.Top().FilePath;
|
|
|
+ if (backtraceCopy.Top().Line) {
|
|
|
+ entry[kLINE_NUMBER_KEY] = (int)backtraceCopy.Top().Line;
|
|
|
+ }
|
|
|
+ if (!backtraceCopy.Top().Name.empty()) {
|
|
|
+ entry[kNAME_KEY] = backtraceCopy.Top().Name;
|
|
|
+ }
|
|
|
+ result.append(std::move(entry));
|
|
|
+ backtraceCopy = backtraceCopy.Pop();
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
+static void DumpBacktraceRange(Json::Value& result, const std::string& type,
|
|
|
+ const cmBacktraceRange& range)
|
|
|
+{
|
|
|
+ for (const auto& bt : range) {
|
|
|
+ Json::Value obj = Json::objectValue;
|
|
|
+ obj[kTYPE_KEY] = type;
|
|
|
+ obj[kBACKTRACE_KEY] = DumpBacktrace(bt);
|
|
|
+ result.append(obj);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
static Json::Value DumpTarget(cmGeneratorTarget* target,
|
|
|
const std::string& config)
|
|
|
{
|
|
|
@@ -763,6 +797,22 @@ static Json::Value DumpTarget(cmGeneratorTarget* target,
|
|
|
|
|
|
result[kFULL_NAME_KEY] = target->GetFullName(config);
|
|
|
|
|
|
+ Json::Value crossRefs = Json::objectValue;
|
|
|
+ crossRefs[kBACKTRACE_KEY] = DumpBacktrace(target->Target->GetBacktrace());
|
|
|
+
|
|
|
+ Json::Value statements = Json::arrayValue;
|
|
|
+ DumpBacktraceRange(statements, "target_compile_definitions",
|
|
|
+ target->Target->GetCompileDefinitionsBacktraces());
|
|
|
+ DumpBacktraceRange(statements, "target_include_directories",
|
|
|
+ target->Target->GetIncludeDirectoriesBacktraces());
|
|
|
+ DumpBacktraceRange(statements, "target_compile_options",
|
|
|
+ target->Target->GetCompileOptionsBacktraces());
|
|
|
+ DumpBacktraceRange(statements, "target_link_libraries",
|
|
|
+ target->Target->GetLinkImplementationBacktraces());
|
|
|
+
|
|
|
+ crossRefs[kRELATED_STATEMENTS_KEY] = std::move(statements);
|
|
|
+ result[kTARGET_CROSS_REFERENCES_KEY] = std::move(crossRefs);
|
|
|
+
|
|
|
if (target->HaveWellDefinedOutputFiles()) {
|
|
|
Json::Value artifacts = Json::arrayValue;
|
|
|
artifacts.append(
|