static Target::BuildRules::BuildRule::shared_ptr ProjectBuildRule(pbxspec::Manager::shared_ptr const &specManager, std::vector<std::string> const &domains, pbxproj::PBX::BuildRule::shared_ptr const &projBuildRule) { pbxspec::PBX::Tool::shared_ptr tool = nullptr; std::string TS = projBuildRule->compilerSpec(); if (TS != "com.apple.compilers.proxy.script") { tool = specManager->tool(TS, domains); if (tool == nullptr) { tool = std::static_pointer_cast<pbxspec::PBX::Tool>(specManager->compiler(TS, domains)); } if (tool == nullptr) { tool = std::static_pointer_cast<pbxspec::PBX::Tool>(specManager->linker(TS, domains)); } if (tool == nullptr) { fprintf(stderr, "warning: couldn't find tool %s specified in build rule\n", TS.c_str()); return nullptr; } } pbxspec::PBX::FileType::vector fileTypes; std::string FT = projBuildRule->fileType(); if (FT != "pattern.proxy") { pbxspec::PBX::FileType::shared_ptr fileType = specManager->fileType(FT, domains); if (fileType == nullptr) { fprintf(stderr, "warning: couldn't find input file type %s specified in build rule\n", FT.c_str()); return nullptr; } fileTypes.push_back(fileType); } std::vector<pbxsetting::Value> outputFiles; for (std::string const &outputFile : projBuildRule->outputFiles()) { outputFiles.push_back(pbxsetting::Value::Parse(outputFile)); } return std::make_shared <Target::BuildRules::BuildRule> (Target::BuildRules::BuildRule( projBuildRule->filePatterns(), fileTypes, tool, projBuildRule->script(), outputFiles )); }
static Target::BuildRules::BuildRule::shared_ptr SpecificationBuildRule(pbxspec::Manager::shared_ptr const &specManager, std::vector<std::string> const &domains, pbxspec::PBX::BuildRule::shared_ptr const &specBuildRule) { if (!specBuildRule->compilerSpec()) { return nullptr; } std::string const &TS = *specBuildRule->compilerSpec(); pbxspec::PBX::Tool::shared_ptr tool = specManager->tool(TS, domains); if (tool == nullptr) { tool = std::static_pointer_cast<pbxspec::PBX::Tool>(specManager->compiler(TS, domains)); } if (tool == nullptr) { tool = std::static_pointer_cast<pbxspec::PBX::Tool>(specManager->linker(TS, domains)); } if (tool == nullptr) { return nullptr; } pbxspec::PBX::FileType::vector fileTypes; if (specBuildRule->fileTypes()) { for (std::string const &FT : *specBuildRule->fileTypes()) { pbxspec::PBX::FileType::shared_ptr fileType = specManager->fileType(FT, domains); if (fileType == nullptr) { return nullptr; } fileTypes.push_back(fileType); } } return std::make_shared <Target::BuildRules::BuildRule> (Target::BuildRules::BuildRule( std::string(), fileTypes, tool, std::string(), std::vector<pbxsetting::Value>() )); }