diff --git a/code/nel/tools/pipeline/plugin_library/process_info.h b/code/nel/tools/pipeline/plugin_library/process_info.h index 0495af92e..50a1fbef4 100644 --- a/code/nel/tools/pipeline/plugin_library/process_info.h +++ b/code/nel/tools/pipeline/plugin_library/process_info.h @@ -63,9 +63,9 @@ public: /// A process handler is not allowed to depend on any files it does not list here. /// Must return all directories on which the process handler depends, these are NOT RECURSIVE. - virtual void getDependentDirectories(std::vector &result) = 0; + virtual void getDependentDirectories(std::vector &resultAppend) = 0; /// Must return all files on which the process handler depends, ONLY if these are not in dependent directories. - virtual void getDependentFiles(std::vector &result) = 0; + virtual void getDependentFiles(std::vector &resultAppend) = 0; }; /* class IProcessInfo */ diff --git a/code/nel/tools/pipeline/service/database_status.cpp b/code/nel/tools/pipeline/service/database_status.cpp index 50d1dcf0b..071813b55 100644 --- a/code/nel/tools/pipeline/service/database_status.cpp +++ b/code/nel/tools/pipeline/service/database_status.cpp @@ -251,17 +251,18 @@ public: IRunnable *CDatabaseStatus::updateFileStatus(const TFileStatusCallback &callback, const std::string &filePath) { -#if defined(PIPELINE_MASTER) + if (!g_IsMaster) + { + nlerror("Not master, not allowed."); + return NULL; + } + CUpdateFileStatus *ufs = new CUpdateFileStatus(); ufs->StatusMutex = &m_StatusMutex; ufs->FilePath = unMacroPath(filePath); ufs->Callback = callback; CAsyncFileManager::getInstance().addLoadTask(ufs); return ufs; -#else - nlerror("Not master, not allowed."); - return NULL; -#endif } // ****************************************************************** @@ -386,6 +387,11 @@ void updateDirectoryStatus(CDatabaseStatus* ds, CDatabaseStatusUpdater &updater, void CDatabaseStatus::updateDatabaseStatus(const CCallback &callback) { + if (!g_IsMaster) + { + nlerror("Not master, not allowed."); + } + std::vector paths; paths.push_back(g_DatabaseDirectory); updateDatabaseStatus(callback, paths, false, true); @@ -393,6 +399,11 @@ void CDatabaseStatus::updateDatabaseStatus(const CCallback &callback) void CDatabaseStatus::updateDatabaseStatus(const CCallback &callback, const std::vector &paths, bool wait, bool recurse) { + if (!g_IsMaster) + { + nlerror("Not master, not allowed."); + } + CDatabaseStatusUpdater *updater = new CDatabaseStatusUpdater(); updater->Callback = callback; updater->FilesRequested = 0; diff --git a/code/nel/tools/pipeline/service/module_pipeline_master.cpp b/code/nel/tools/pipeline/service/module_pipeline_master.cpp index a43f2e7d2..30de28ea5 100644 --- a/code/nel/tools/pipeline/service/module_pipeline_master.cpp +++ b/code/nel/tools/pipeline/service/module_pipeline_master.cpp @@ -37,6 +37,8 @@ // Project includes #include "module_pipeline_slave_itf.h" +#include "pipeline_service.h" +#include "database_status.h" using namespace std; using namespace NLMISC; @@ -57,12 +59,19 @@ class CModulePipelineMaster : struct CSlave { public: - CSlave(IModuleProxy *moduleProxy) - : Proxy(moduleProxy), - ActiveTaskId(0) { } - + CSlave(CModulePipelineMaster *master, IModuleProxy *moduleProxy) + : Master(master), + Proxy(moduleProxy), + ActiveTaskId(0) { } + CModulePipelineMaster *Master; CModulePipelineSlaveProxy Proxy; + std::vector Vector; uint32 ActiveTaskId; + + void cbUpdateDatabaseStatus() + { + + } }; protected: @@ -73,11 +82,13 @@ protected: public: CModulePipelineMaster() { - + g_IsMaster = true; } virtual ~CModulePipelineMaster() { + g_IsMaster = false; + m_SlavesMutex.lock(); for (TSlaveMap::iterator it = m_Slaves.begin(), end = m_Slaves.end(); it != end; ++it) @@ -104,7 +115,7 @@ public: m_SlavesMutex.lock(); - CSlave *slave = new CSlave(moduleProxy); + CSlave *slave = new CSlave(this, moduleProxy); m_Slaves[moduleProxy] = slave; m_SlavesMutex.unlock(); @@ -149,6 +160,19 @@ public: // TODO } + virtual void vectorPushString(NLNET::IModuleProxy *sender, const std::string &str) + { + CSlave *slave = m_Slaves[sender]; + slave->Vector.push_back(str); + } + + virtual void updateDatabaseStatusByVector(NLNET::IModuleProxy *sender) + { + CSlave *slave = m_Slaves[sender]; + g_DatabaseStatus->updateDatabaseStatus(CCallback(slave, &CSlave::cbUpdateDatabaseStatus), slave->Vector, false, false); + slave->Vector.clear(); + } + }; /* class CModulePipelineMaster */ void module_pipeline_master_forceLink() { } diff --git a/code/nel/tools/pipeline/service/module_pipeline_master_itf.cpp b/code/nel/tools/pipeline/service/module_pipeline_master_itf.cpp index 171c2ccf8..9da26b338 100644 Binary files a/code/nel/tools/pipeline/service/module_pipeline_master_itf.cpp and b/code/nel/tools/pipeline/service/module_pipeline_master_itf.cpp differ diff --git a/code/nel/tools/pipeline/service/module_pipeline_master_itf.h b/code/nel/tools/pipeline/service/module_pipeline_master_itf.h index 2e120f439..3f14d5c69 100644 Binary files a/code/nel/tools/pipeline/service/module_pipeline_master_itf.h and b/code/nel/tools/pipeline/service/module_pipeline_master_itf.h differ diff --git a/code/nel/tools/pipeline/service/module_pipeline_master_itf.xml b/code/nel/tools/pipeline/service/module_pipeline_master_itf.xml index 24162135c..8f8126c64 100644 --- a/code/nel/tools/pipeline/service/module_pipeline_master_itf.xml +++ b/code/nel/tools/pipeline/service/module_pipeline_master_itf.xml @@ -4,18 +4,28 @@ - + - + + + + + + + + + + + diff --git a/code/nel/tools/pipeline/service/module_pipeline_slave.cpp b/code/nel/tools/pipeline/service/module_pipeline_slave.cpp index 5817d6ec4..09cc7a9ee 100644 --- a/code/nel/tools/pipeline/service/module_pipeline_slave.cpp +++ b/code/nel/tools/pipeline/service/module_pipeline_slave.cpp @@ -104,6 +104,11 @@ public: CModulePipelineMasterProxy master(sender); master.slaveRefusedBuildTask(this, taskId); } + + virtual void masterUpdatedDatabaseStatus(NLNET::IModuleProxy *sender) + { + + } }; /* class CModulePipelineSlave */ diff --git a/code/nel/tools/pipeline/service/module_pipeline_slave_itf.cpp b/code/nel/tools/pipeline/service/module_pipeline_slave_itf.cpp index e26d319d0..829328a04 100644 Binary files a/code/nel/tools/pipeline/service/module_pipeline_slave_itf.cpp and b/code/nel/tools/pipeline/service/module_pipeline_slave_itf.cpp differ diff --git a/code/nel/tools/pipeline/service/module_pipeline_slave_itf.h b/code/nel/tools/pipeline/service/module_pipeline_slave_itf.h index 6d031f5b2..05a534a5b 100644 Binary files a/code/nel/tools/pipeline/service/module_pipeline_slave_itf.h and b/code/nel/tools/pipeline/service/module_pipeline_slave_itf.h differ diff --git a/code/nel/tools/pipeline/service/module_pipeline_slave_itf.xml b/code/nel/tools/pipeline/service/module_pipeline_slave_itf.xml index a718e1078..987196f8e 100644 --- a/code/nel/tools/pipeline/service/module_pipeline_slave_itf.xml +++ b/code/nel/tools/pipeline/service/module_pipeline_slave_itf.xml @@ -4,7 +4,7 @@ - + @@ -12,6 +12,10 @@ + + + + diff --git a/code/nel/tools/pipeline/service/pipeline_service.cpp b/code/nel/tools/pipeline/service/pipeline_service.cpp index b1027842c..c7470bca3 100644 --- a/code/nel/tools/pipeline/service/pipeline_service.cpp +++ b/code/nel/tools/pipeline/service/pipeline_service.cpp @@ -65,9 +65,11 @@ namespace PIPELINE { std::string g_DatabaseDirectory; std::string g_PipelineDirectory; bool g_IsExiting = false; +bool g_IsMaster = false; NLGEORGES::UFormLoader *g_FormLoader = NULL; -CPipelineWorkspace *g_PipelineWorkspace; +CPipelineWorkspace *g_PipelineWorkspace = NULL; +CDatabaseStatus *g_DatabaseStatus = NULL; std::string unMacroPath(const std::string &path) { @@ -112,7 +114,6 @@ enum EState /// Data CTaskManager *s_TaskManager = NULL; -CDatabaseStatus *s_DatabaseStatus = NULL; CPipelineInterfaceImpl *s_PipelineInterfaceImpl = NULL; CPipelineProcessImpl *s_PipelineProcessImpl = NULL; @@ -253,7 +254,7 @@ class CUpdateDatabaseStatus : public IRunnable virtual void run() { - s_DatabaseStatus->updateDatabaseStatus(CCallback(this, &CUpdateDatabaseStatus::databaseStatusUpdated)); + g_DatabaseStatus->updateDatabaseStatus(CCallback(this, &CUpdateDatabaseStatus::databaseStatusUpdated)); } }; CUpdateDatabaseStatus s_UpdateDatabaseStatus; @@ -315,7 +316,7 @@ public: initSheets(); - s_DatabaseStatus = new CDatabaseStatus(); + g_DatabaseStatus = new CDatabaseStatus(); s_PipelineInterfaceImpl = new CPipelineInterfaceImpl(); s_PipelineProcessImpl = new CPipelineProcessImpl(NULL); // Create a singleton impl for global usage without running project for test purposes. @@ -364,8 +365,8 @@ public: delete s_PipelineInterfaceImpl; s_PipelineInterfaceImpl = NULL; - delete s_DatabaseStatus; - s_DatabaseStatus = NULL; + delete g_DatabaseStatus; + g_DatabaseStatus = NULL; releaseSheets(); diff --git a/code/nel/tools/pipeline/service/pipeline_service.h b/code/nel/tools/pipeline/service/pipeline_service.h index 2d018132d..8e6f4e885 100644 --- a/code/nel/tools/pipeline/service/pipeline_service.h +++ b/code/nel/tools/pipeline/service/pipeline_service.h @@ -46,21 +46,12 @@ namespace NLGEORGES { namespace PIPELINE { class CPipelineWorkspace; - -/* -#if defined(PIPELINE_MASTER) -# if defined(PIPELINE_SLAVE) -# error Cannot define both PIPELINE_MASTER and PIPELINE_SLAVE at the same time. -# endif -#elif defined (PIPELINE_SLAVE) -#else -# error Must define either PIPELINE_MASTER or PIPELINE_SLAVE. Create 2 projects that output pipeline_service_master and pipeline_service_slave executables. -#endif -*/ + class CDatabaseStatus; #define PIPELINE_MASTER extern bool g_IsExiting; +extern bool g_IsMaster; extern std::string g_DatabaseDirectory; extern std::string g_PipelineDirectory; @@ -81,6 +72,7 @@ void endedRunnableTask(); extern NLGEORGES::UFormLoader *g_FormLoader; extern CPipelineWorkspace *g_PipelineWorkspace; +extern CDatabaseStatus *g_DatabaseStatus; } /* namespace PIPELINE */