| 108 | } |
| 109 | |
| 110 | void cmCPackPKGGenerator::WriteDistributionFile(char const* metapackageFile, |
| 111 | char const* genName) |
| 112 | { |
| 113 | std::string distributionTemplate = |
| 114 | this->FindTemplate("CPack.distribution.dist.in"); |
| 115 | if (distributionTemplate.empty()) { |
| 116 | cmCPackLogger(cmCPackLog::LOG_ERROR, |
| 117 | "Cannot find input file: " << distributionTemplate |
| 118 | << std::endl); |
| 119 | return; |
| 120 | } |
| 121 | |
| 122 | std::string distributionFile = |
| 123 | cmStrCat(metapackageFile, "/Contents/distribution.dist"); |
| 124 | |
| 125 | std::ostringstream xContents; |
| 126 | cmXMLWriter xout(xContents, 1); |
| 127 | |
| 128 | // Installer-wide options and domains. These need to be separate from the |
| 129 | // choices and background elements added further below so that we can |
| 130 | // preserve backward compatibility. |
| 131 | xout.StartElement("options"); |
| 132 | xout.Attribute("allow-external-scripts", "no"); |
| 133 | xout.Attribute("customize", "allow"); |
| 134 | if (cmIsOff(this->GetOption("CPACK_PRODUCTBUILD_DOMAINS"))) { |
| 135 | xout.Attribute("rootVolumeOnly", "false"); |
| 136 | } |
| 137 | xout.EndElement(); |
| 138 | this->CreateDomains(xout); |
| 139 | |
| 140 | // In order to preserve backward compatibility, all elements added below |
| 141 | // here need to be made available in a variable named |
| 142 | // CPACK_PACKAGEMAKER_CHOICES. The above elements are new and only appear |
| 143 | // in the CPACK_APPLE_PKG_INSTALLER_CONTENT variable, which is a superset |
| 144 | // of what CPACK_PACKAGEMAKER_CHOICES used to provide. The renaming reflects |
| 145 | // the fact that CMake has deprecated the PackageMaker generator. |
| 146 | |
| 147 | // Create the choice outline, which provides a tree-based view of |
| 148 | // the components in their groups. |
| 149 | std::ostringstream choiceOut; |
| 150 | cmXMLWriter xChoiceOut(choiceOut, 1); |
| 151 | xChoiceOut.StartElement("choices-outline"); |
| 152 | |
| 153 | // Emit the outline for the groups |
| 154 | for (auto const& group : this->ComponentGroups) { |
| 155 | if (!group.second.ParentGroup) { |
| 156 | CreateChoiceOutline(group.second, xChoiceOut); |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | // Emit the outline for the non-grouped components |
| 161 | for (auto const& comp : this->Components) { |
| 162 | if (!comp.second.Group) { |
| 163 | xChoiceOut.StartElement("line"); |
| 164 | xChoiceOut.Attribute("choice", cmStrCat(comp.first, "Choice")); |
| 165 | xChoiceOut.Content(""); // Avoid self-closing tag. |
| 166 | xChoiceOut.EndElement(); |
| 167 | } |
nothing calls this directly
no test coverage detected