| 743 | } |
| 744 | |
| 745 | Json::Value CodemodelConfig::DumpTarget(cmGeneratorTarget* gt, |
| 746 | Json::ArrayIndex ti) |
| 747 | { |
| 748 | Target t(gt, this->VersionMajor, this->VersionMinor, this->Config); |
| 749 | std::string safeTargetName = gt->GetName(); |
| 750 | std::replace(safeTargetName.begin(), safeTargetName.end(), ':', '_'); |
| 751 | std::string prefix = "target-" + safeTargetName; |
| 752 | if (!this->Config.empty()) { |
| 753 | prefix += "-" + this->Config; |
| 754 | } |
| 755 | Json::Value target = this->FileAPI.MaybeJsonFile(t.Dump(), prefix); |
| 756 | target["name"] = gt->GetName(); |
| 757 | target["id"] = TargetId(gt, this->TopBuild); |
| 758 | |
| 759 | // Cross-reference directory containing target. |
| 760 | Json::ArrayIndex di = this->GetDirectoryIndex(gt->GetLocalGenerator()); |
| 761 | target["directoryIndex"] = di; |
| 762 | if (gt->IsInBuildSystem()) { |
| 763 | this->Directories[di].BuildSystemTargetIndexes.append(ti); |
| 764 | } else { |
| 765 | this->Directories[di].AbstractTargetIndexes.append(ti); |
| 766 | } |
| 767 | |
| 768 | // Cross-reference project containing target. |
| 769 | Json::ArrayIndex pi = this->Directories[di].ProjectIndex; |
| 770 | target["projectIndex"] = pi; |
| 771 | if (gt->IsInBuildSystem()) { |
| 772 | this->Projects[pi].BuildSystemTargetIndexes.append(ti); |
| 773 | } else { |
| 774 | this->Projects[pi].AbstractTargetIndexes.append(ti); |
| 775 | } |
| 776 | |
| 777 | this->TargetIndexMap[gt] = ti; |
| 778 | |
| 779 | return target; |
| 780 | } |
| 781 | |
| 782 | Json::Value CodemodelConfig::DumpDirectories() |
| 783 | { |
no test coverage detected