mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-10-06 04:03:27 +03:00
instrumentation: Fix ctest output of Build.xml when targets have labels
Fixes #27585
This commit is contained in:
1 parent
a7ce90353a
commit
63165db061
1 file changed
+14
-11
@@ -620,7 +620,6 @@ void cmCTestBuildHandler::GenerateInstrumentationXML(cmXMLWriter& xml)
|
||||
if (target_name == "." || target_name == "..") {
|
||||
continue;
|
||||
}
|
||||
std::string target_type = "UNKNOWN";
|
||||
|
||||
xml.StartElement("Target");
|
||||
xml.Attribute("name", target_name);
|
||||
@@ -644,19 +643,23 @@ void cmCTestBuildHandler::GenerateInstrumentationXML(cmXMLWriter& xml)
|
||||
target_data = cmake_content["targets"];
|
||||
}
|
||||
}
|
||||
// Extract targetType and targetLabels
|
||||
if (target_data.isObject() && target_data.isMember(target_name)) {
|
||||
bool target_has_data =
|
||||
target_data.isObject() && target_data.isMember(target_name);
|
||||
// Extract targetType
|
||||
std::string target_type = "UNKNOWN";
|
||||
if (target_has_data) {
|
||||
target_type = target_data[target_name]["type"].asString();
|
||||
if (!target_data[target_name]["labels"].empty()) {
|
||||
xml.StartElement("Labels");
|
||||
for (auto const& json_label_item :
|
||||
target_data[target_name]["labels"]) {
|
||||
xml.Element("Label", json_label_item.asString());
|
||||
}
|
||||
xml.EndElement(); // Labels
|
||||
}
|
||||
}
|
||||
xml.Attribute("type", target_type);
|
||||
// Extract targetLabels
|
||||
if (target_has_data && !target_data[target_name]["labels"].empty()) {
|
||||
xml.StartElement("Labels");
|
||||
for (auto const& json_label_item :
|
||||
target_data[target_name]["labels"]) {
|
||||
xml.Element("Label", json_label_item.asString());
|
||||
}
|
||||
xml.EndElement(); // Labels
|
||||
}
|
||||
|
||||
// Write instrumendation data for this target.
|
||||
std::string target_subdir = cmStrCat("build/targets/", target_name);
|
||||
|
||||
Reference in new issue
Block a user