Added: #1440 Process dependencies

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 13 years ago
parent b389f36f7e
commit 9e39a5ffef

@ -95,14 +95,58 @@ void CBuildTaskQueue::loadQueue(CPipelineWorkspace *workspace, bool bypassDepend
m_Tasks.push_back(info); m_Tasks.push_back(info);
info->ProjectName = projectName; info->ProjectName = projectName;
info->ProcessPluginId = processHandlerId; info->ProcessPluginId = processHandlerId;
// info->Dependencies
nlassert(builtTaskByPlugin.find(processHandlerId) == builtTaskByPlugin.end());
builtTaskByPlugin[processHandlerId] = info;
}
if (processHandlers.size() == 0)
{
nlwarning("Project '%s' tries to use unknown process '%s'", projectName.c_str(), processName.c_str());
}
} }
// TODO: PROCESS DEPENDENCIES // Dependencies between processes inside a project
for (std::map<uint32, CBuildTaskInfo *>::iterator it = builtTaskByPlugin.begin(), end = builtTaskByPlugin.end(); it != end; ++it)
{
CBuildTaskInfo *task = it->second;
std::vector<std::string> processDependencies;
workspace->getProcessPluginDependencies(processDependencies, task->ProcessPluginId);
for (std::vector<std::string>::iterator dep_it = processDependencies.begin(), dep_end = processDependencies.end(); dep_it != dep_end; ++dep_it)
{
std::string &processName = (*dep_it);
std::vector<CProcessPluginInfo> processHandlers;
workspace->getProcessPlugins(processHandlers, processName);
for (std::vector<CProcessPluginInfo>::iterator h_it = processHandlers.begin(), h_end = processHandlers.end(); h_it != h_end; ++h_it)
{
uint32 processHandlerId = (*h_it).Id.Global;
std::map<uint32, CBuildTaskInfo *>::iterator depIt = builtTaskByPlugin.find(processHandlerId);
if (depIt != builtTaskByPlugin.end())
{
task->Dependencies.push_back(depIt->second->Id.Sub.Task);
}
else
{
CProcessPluginInfo badProcessPlugin;
workspace->getProcessPlugin(badProcessPlugin, task->ProcessPluginId);
nlwarning("Project '%s' task process handler '%s' depends on process '%s' which is not part of the project", projectName.c_str(), badProcessPlugin.Handler.c_str(), processName.c_str());
}
} }
// TODO: PROJECT DEPENDENCIES if (processHandlers.size() == 0)
{
CProcessPluginInfo badProcessPlugin;
workspace->getProcessPlugin(badProcessPlugin, task->ProcessPluginId);
nlwarning("Project '%s' task process handler '%s' depends on process '%s' which does not exist in any known plugin", projectName.c_str(), badProcessPlugin.Handler.c_str(), processName.c_str());
}
} }
}
}
// TODO_TODO_TODO Dependencies between projects *************************************************************************
m_Mutex.unlock(); m_Mutex.unlock();
} }

@ -205,6 +205,38 @@ bool CPipelineWorkspace::getProcessPlugin(CProcessPluginInfo &result, uint32 glo
else return false; else return false;
} }
bool CPipelineWorkspace::getProcessPluginDependencies(std::vector<std::string> &resultProcesses, uint32 globalId)
{
resultProcesses.clear();
CProcessPluginId id;
id.Global = globalId;
if (id.Sub.Plugin >= m_Plugins.size())
{
nlwarning("Plugin id out of range");
return false;
}
NLMISC::CRefPtr<NLGEORGES::UForm> pluginForm = m_Plugins[id.Sub.Plugin];
UFormElm *processHandlers;
if (!pluginForm->getRootNode().getNodeByName(&processHandlers, "ProcessHandlers")) return false;
UFormElm *handler;
if (!processHandlers->getArrayNode(&handler, id.Sub.Handler)) return false;
UFormElm *processDependencies;
if (!handler->getNodeByName(&processDependencies, "ProcessDependencies")) return false;
if (!processDependencies) return false;
uint nb;
if (!processDependencies->getArraySize(nb)) return false;
resultProcesses.resize(nb);
for (uint i = 0; i < nb; ++i)
{
if (!processDependencies->getArrayValue(resultProcesses[i], i))
{
resultProcesses.clear();
return false;
}
}
return true;
}
void CPipelineWorkspace::listAvailablePlugins(std::vector<uint32> &result) void CPipelineWorkspace::listAvailablePlugins(std::vector<uint32> &result)
{ {
result.clear(); result.clear();

@ -93,6 +93,7 @@ public:
void getProcessPlugins(std::vector<CProcessPluginInfo> &resultAppend, const std::string &process); void getProcessPlugins(std::vector<CProcessPluginInfo> &resultAppend, const std::string &process);
CPipelineProject *getProject(const std::string &project); CPipelineProject *getProject(const std::string &project);
bool getProcessPlugin(CProcessPluginInfo &result, uint32 globalId); bool getProcessPlugin(CProcessPluginInfo &result, uint32 globalId);
bool getProcessPluginDependencies(std::vector<std::string> &resultProcesses, uint32 globalId);
inline const std::map<std::string, CPipelineProject *> &getProjects() { return m_Projects; } inline const std::map<std::string, CPipelineProject *> &getProjects() { return m_Projects; }

Loading…
Cancel
Save