| 1268 | } |
| 1269 | |
| 1270 | void cmNinjaTargetGenerator::GenerateSwiftOutputFileMap( |
| 1271 | std::string const& config, std::string& flags) |
| 1272 | { |
| 1273 | if (this->Configs[config].SwiftOutputMap.empty()) { |
| 1274 | return; |
| 1275 | } |
| 1276 | |
| 1277 | std::string const targetSwiftDepsPath = [this, config]() -> std::string { |
| 1278 | cmGeneratorTarget const* target = this->GeneratorTarget; |
| 1279 | if (cmValue name = target->GetProperty("Swift_DEPENDENCIES_FILE")) { |
| 1280 | return *name; |
| 1281 | } |
| 1282 | return this->ConvertToNinjaPath(cmStrCat(target->GetSupportDirectory(), |
| 1283 | '/', config, '/', |
| 1284 | target->GetName(), ".swiftdeps")); |
| 1285 | }(); |
| 1286 | |
| 1287 | std::string mapFilePath = |
| 1288 | cmStrCat(this->GeneratorTarget->GetSupportDirectory(), '/', config, |
| 1289 | "/" |
| 1290 | "output-file-map.json"); |
| 1291 | |
| 1292 | // build the global target dependencies |
| 1293 | // https://github.com/apple/swift/blob/master/docs/Driver.md#output-file-maps |
| 1294 | Json::Value deps(Json::objectValue); |
| 1295 | deps["swift-dependencies"] = targetSwiftDepsPath; |
| 1296 | this->Configs[config].SwiftOutputMap[""] = deps; |
| 1297 | |
| 1298 | cmGeneratedFileStream output(mapFilePath); |
| 1299 | output << this->Configs[config].SwiftOutputMap; |
| 1300 | |
| 1301 | // Add flag |
| 1302 | this->LocalGenerator->AppendFlags(flags, "-output-file-map"); |
| 1303 | this->LocalGenerator->AppendFlags( |
| 1304 | flags, |
| 1305 | this->ConvertToOutputFormatForShell(ConvertToNinjaPath(mapFilePath))); |
| 1306 | } |
| 1307 | |
| 1308 | namespace { |
| 1309 | cmNinjaBuild GetScanBuildStatement(std::string const& ruleName, |
no test coverage detected