std::unique_ptr<Tool::SymlinkResolver> Tool::SymlinkResolver:: Create(pbxspec::Manager::shared_ptr const &specManager, std::vector<std::string> const &specDomains) { pbxspec::PBX::Tool::shared_ptr symlinkTool = specManager->tool(Tool::SymlinkResolver::ToolIdentifier(), specDomains); if (symlinkTool == nullptr) { fprintf(stderr, "warning: could not find symlink tool\n"); return nullptr; } return std::unique_ptr<Tool::SymlinkResolver>(new Tool::SymlinkResolver(symlinkTool)); }
std::unique_ptr<Tool::HeadermapResolver> Tool::HeadermapResolver:: Create(pbxspec::Manager::shared_ptr const &specManager, std::vector<std::string> const &specDomains, pbxspec::PBX::Compiler::shared_ptr const &compiler) { pbxspec::PBX::Tool::shared_ptr headermapTool = specManager->tool(Tool::HeadermapResolver::ToolIdentifier(), specDomains); if (headermapTool == nullptr) { fprintf(stderr, "warning: could not find headermap tool\n"); return nullptr; } return std::unique_ptr<Tool::HeadermapResolver>(new Tool::HeadermapResolver(headermapTool, compiler, specManager)); }
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>() )); }