| 40 | } |
| 41 | |
| 42 | int cmCPackExternalGenerator::PackageFiles() |
| 43 | { |
| 44 | Json::StreamWriterBuilder builder; |
| 45 | builder["indentation"] = " "; |
| 46 | |
| 47 | std::string filename = "package.json"; |
| 48 | if (!this->packageFileNames.empty()) { |
| 49 | filename = this->packageFileNames[0]; |
| 50 | } |
| 51 | |
| 52 | { |
| 53 | cmGeneratedFileStream fout(filename); |
| 54 | std::unique_ptr<Json::StreamWriter> jout(builder.newStreamWriter()); |
| 55 | |
| 56 | Json::Value root(Json::objectValue); |
| 57 | |
| 58 | if (!this->Generator->WriteToJSON(root)) { |
| 59 | return 0; |
| 60 | } |
| 61 | |
| 62 | if (jout->write(root, &fout)) { |
| 63 | return 0; |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | cmValue packageScript = this->GetOption("CPACK_EXTERNAL_PACKAGE_SCRIPT"); |
| 68 | if (cmNonempty(packageScript)) { |
| 69 | if (!cmSystemTools::FileIsFullPath(*packageScript)) { |
| 70 | cmCPackLogger( |
| 71 | cmCPackLog::LOG_ERROR, |
| 72 | "CPACK_EXTERNAL_PACKAGE_SCRIPT does not contain a full file path" |
| 73 | << std::endl); |
| 74 | return 0; |
| 75 | } |
| 76 | |
| 77 | bool res = this->MakefileMap->ReadListFile(*packageScript); |
| 78 | |
| 79 | if (cmSystemTools::GetErrorOccurredFlag() || !res) { |
| 80 | return 0; |
| 81 | } |
| 82 | |
| 83 | cmValue builtPackages = this->GetOption("CPACK_EXTERNAL_BUILT_PACKAGES"); |
| 84 | if (builtPackages) { |
| 85 | cmExpandList(builtPackages, this->packageFileNames); |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | return 1; |
| 90 | } |
| 91 | |
| 92 | bool cmCPackExternalGenerator::SupportsComponentInstallation() const |
| 93 | { |
nothing calls this directly
no test coverage detected