| 789 | } |
| 790 | |
| 791 | Json::Value CodemodelConfig::DumpDirectory(Directory& d) |
| 792 | { |
| 793 | Json::Value directory = this->DumpDirectoryObject(d); |
| 794 | |
| 795 | std::string sourceDir = d.Snapshot.GetDirectory().GetCurrentSource(); |
| 796 | directory["source"] = RelativeIfUnder(this->TopSource, sourceDir); |
| 797 | |
| 798 | std::string buildDir = d.Snapshot.GetDirectory().GetCurrentBinary(); |
| 799 | directory["build"] = RelativeIfUnder(this->TopBuild, buildDir); |
| 800 | |
| 801 | cmStateSnapshot parentDir = d.Snapshot.GetBuildsystemDirectoryParent(); |
| 802 | if (parentDir.IsValid()) { |
| 803 | directory["parentIndex"] = this->GetDirectoryIndex(parentDir); |
| 804 | } |
| 805 | |
| 806 | Json::Value childIndexes = Json::arrayValue; |
| 807 | for (cmStateSnapshot const& child : d.Snapshot.GetChildren()) { |
| 808 | childIndexes.append( |
| 809 | this->GetDirectoryIndex(child.GetBuildsystemDirectory())); |
| 810 | } |
| 811 | if (!childIndexes.empty()) { |
| 812 | directory["childIndexes"] = std::move(childIndexes); |
| 813 | } |
| 814 | |
| 815 | directory["projectIndex"] = d.ProjectIndex; |
| 816 | |
| 817 | if (!d.BuildSystemTargetIndexes.empty()) { |
| 818 | directory["targetIndexes"] = std::move(d.BuildSystemTargetIndexes); |
| 819 | } |
| 820 | if (!d.AbstractTargetIndexes.empty()) { |
| 821 | directory["abstractTargetIndexes"] = std::move(d.AbstractTargetIndexes); |
| 822 | } |
| 823 | |
| 824 | Json::Value minimumCMakeVersion = this->DumpMinimumCMakeVersion(d.Snapshot); |
| 825 | if (!minimumCMakeVersion.isNull()) { |
| 826 | directory["minimumCMakeVersion"] = std::move(minimumCMakeVersion); |
| 827 | } |
| 828 | |
| 829 | if (d.HasInstallRule) { |
| 830 | directory["hasInstallRule"] = true; |
| 831 | } |
| 832 | |
| 833 | return directory; |
| 834 | } |
| 835 | |
| 836 | Json::Value CodemodelConfig::DumpDirectoryObject(Directory& d) |
| 837 | { |
no test coverage detected