diff --git a/code/nel/tools/pipeline/service/example_cfg/gtk_run_master.sh b/code/nel/tools/pipeline/service/example_cfg/gtk_run_master.sh old mode 100644 new mode 100755 index 1b5d31b45..3adb32d8b --- a/code/nel/tools/pipeline/service/example_cfg/gtk_run_master.sh +++ b/code/nel/tools/pipeline/service/example_cfg/gtk_run_master.sh @@ -1,5 +1,5 @@ #!/bin/sh -cd /home/nevrax/build/devl/bin -./pipeline_service -C/home/nevrax/code/nel/tools/pipeline/service/example_cfg/master_gtk/ +cd /home/kaetemi/core/pipeline_v3/build/devl/bin +./pipeline_service -C/home/kaetemi/core/pipeline_v3/code/nel/tools/pipeline/service/example_cfg/master_gtk/ diff --git a/code/nel/tools/pipeline/service/example_cfg/linux_run_master.sh b/code/nel/tools/pipeline/service/example_cfg/linux_run_master.sh old mode 100644 new mode 100755 index df59e643a..e624a9ba0 --- a/code/nel/tools/pipeline/service/example_cfg/linux_run_master.sh +++ b/code/nel/tools/pipeline/service/example_cfg/linux_run_master.sh @@ -1,5 +1,5 @@ #!/bin/sh -cd /home/nevrax/build/devl/bin -./pipeline_service -C/home/nevrax/code/nel/tools/pipeline/service/example_cfg/master_linux/ +cd /home/kaetemi/core/pipeline_v3/build/devl/bin +./pipeline_service -C/home/kaetemi/core/pipeline_v3/code/nel/tools/pipeline/service/example_cfg/master_linux/ diff --git a/code/nel/tools/pipeline/service/example_cfg/linux_run_slave.sh b/code/nel/tools/pipeline/service/example_cfg/linux_run_slave.sh old mode 100644 new mode 100755 index a60d1cd94..b70759e20 --- a/code/nel/tools/pipeline/service/example_cfg/linux_run_slave.sh +++ b/code/nel/tools/pipeline/service/example_cfg/linux_run_slave.sh @@ -1,5 +1,5 @@ #!/bin/sh -cd /home/nevrax/build/devl/bin -./pipeline_service -C/home/nevrax/code/nel/tools/pipeline/service/example_cfg/master_slave/ +cd /home/kaetemi/core/pipeline_v3/build/devl/bin +./pipeline_service -C/home/kaetemi/core/pipeline_v3/code/nel/tools/pipeline/service/example_cfg/master_slave/ diff --git a/code/nel/tools/pipeline/service/example_cfg/pipeline_service_linux.cfg b/code/nel/tools/pipeline/service/example_cfg/pipeline_service_linux.cfg index 03eef4fa4..d044b6f38 100644 --- a/code/nel/tools/pipeline/service/example_cfg/pipeline_service_linux.cfg +++ b/code/nel/tools/pipeline/service/example_cfg/pipeline_service_linux.cfg @@ -2,5 +2,5 @@ SharedWork = "/srv/work"; // W: on Win SharedLeveldesign = "/srv/leveldesign"; // L: on Win -UsedPlugins = { }; +UsedPlugins = { "" }; // CConfigFile BUG: Need dummy value to += afterwards!!! diff --git a/code/nel/tools/pipeline/service/metadata_storage.h b/code/nel/tools/pipeline/service/metadata_storage.h index c64d2a0ed..eb2150433 100644 --- a/code/nel/tools/pipeline/service/metadata_storage.h +++ b/code/nel/tools/pipeline/service/metadata_storage.h @@ -6,20 +6,20 @@ * CMetadataStorage */ -/* +/* * Copyright (C) 2012 by authors - * + * * This file is part of RYZOM CORE PIPELINE. * RYZOM CORE PIPELINE is free software: you can redistribute it * and/or modify it under the terms of the GNU Affero General Public * License as published by the Free Software Foundation, either * version 3 of the License, or (at your option) any later version. - * + * * RYZOM CORE PIPELINE is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. - * + * * You should have received a copy of the GNU Affero General Public * License along with RYZOM CORE PIPELINE. If not, see * . @@ -32,6 +32,7 @@ // STL includes // NeL includes +#include // Project includes #include "workspace_storage.h" @@ -106,6 +107,7 @@ public: #define PIPELINE_DATABASE_RESULT_SUFFIX ".result" struct CProjectResult { +public: std::vector FilePaths; struct CFileResult { @@ -115,7 +117,7 @@ struct CProjectResult void serial(NLMISC::IStream &stream) throw (NLMISC::EStream); }; std::vector FileResults; - + void serial(NLMISC::IStream &stream) throw (NLMISC::EStream); }; @@ -135,7 +137,7 @@ public: static bool readStatus(CFileStatus &status, const std::string &path); static void writeStatus(const CFileStatus &status, const std::string &path); static void eraseStatus(const std::string &path); - + /// Format like .../something.somedirectory.meta/path/file.remove // static std::string getRemovePath(const std::string &file); // static bool readRemove(CFileRemove &remove, const std::string & path); diff --git a/code/nel/tools/pipeline/service/module_pipeline_master.cpp b/code/nel/tools/pipeline/service/module_pipeline_master.cpp index c4567012f..ff0161544 100644 --- a/code/nel/tools/pipeline/service/module_pipeline_master.cpp +++ b/code/nel/tools/pipeline/service/module_pipeline_master.cpp @@ -6,20 +6,20 @@ * CModulePipelineMaster */ -/* +/* * Copyright (C) 2012 by authors - * + * * This file is part of RYZOM CORE PIPELINE. * RYZOM CORE PIPELINE is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 2 of * the License, or (at your option) any later version. - * + * * RYZOM CORE PIPELINE is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with RYZOM CORE PIPELINE; see the file COPYING. If not, see * . @@ -72,15 +72,15 @@ namespace PIPELINE { * CModulePipelineMaster */ class CModulePipelineMaster : - public CModulePipelineMasterSkel, + public CModulePipelineMasterSkel, public CEmptyModuleServiceBehav > > { struct CSlave { public: - CSlave(CModulePipelineMaster *master, IModuleProxy *moduleProxy) - : Master(master), - Proxy(moduleProxy), + CSlave(CModulePipelineMaster *master, IModuleProxy *moduleProxy) + : Master(master), + Proxy(moduleProxy), ActiveTaskId(0), SheetsOk(true), SaneBehaviour(3), @@ -95,7 +95,7 @@ class CModulePipelineMaster : sint SaneBehaviour; uint BuildReadyState; uint32 TimeOutStamp; - + ~CSlave() { if (!SheetsOk) @@ -109,7 +109,7 @@ class CModulePipelineMaster : return SheetsOk && (ActiveTaskId == 0) && SaneBehaviour > 0 && BuildReadyState == 2 && TimeOutStamp < NLMISC::CTime::getSecondsSince1970(); } }; - + protected: typedef std::map TSlaveMap; TSlaveMap m_Slaves; @@ -120,7 +120,7 @@ protected: bool m_AbortRequested; NLMISC::CTaskManager *m_TaskManager; // Manages tasks requested by a slave. - NLMISC::CSynchronized> m_WaitingCallbacks; + NLMISC::CSynchronized > m_WaitingCallbacks; // A runnable that's executed at next update state used as a callback. // Override runnable as normal as the callback function. @@ -128,8 +128,8 @@ protected: { public: CDelayedCallback(CModulePipelineMaster *master) : Master(master) - { - NLMISC::CSynchronized>::CAccessor waitingCallbacks(&Master->m_WaitingCallbacks); + { + NLMISC::CSynchronized >::CAccessor waitingCallbacks(&Master->m_WaitingCallbacks); waitingCallbacks.value().push_back(this); } inline CCallback getCallback() { return CCallback(this, &CDelayedCallback::callback); } @@ -142,7 +142,7 @@ protected: Master->addUpdateTask(this); } { - NLMISC::CSynchronized>::CAccessor waitingCallbacks(&Master->m_WaitingCallbacks); + NLMISC::CSynchronized >::CAccessor waitingCallbacks(&Master->m_WaitingCallbacks); waitingCallbacks.value().remove(this); } } @@ -150,7 +150,7 @@ protected: // Runnable tasks that are ran on the next update cycle. // The IRunnable instance is deleted by the update cycle. - NLMISC::CSynchronized> m_UpdateTasks; + NLMISC::CSynchronized > m_UpdateTasks; // build command bool m_BypassErrors; @@ -181,11 +181,11 @@ public: for (; ; ) { { - NLMISC::CSynchronized>::CAccessor waitingCallbacks(&m_WaitingCallbacks); + NLMISC::CSynchronized >::CAccessor waitingCallbacks(&m_WaitingCallbacks); if (waitingCallbacks.value().size() == 0) break; } - + nlwarning("Waiting for callbacks on the master to be called..."); nlSleep(1000); } @@ -194,11 +194,11 @@ public: handleUpdateTasks(); m_SlavesMutex.lock(); - + for (TSlaveMap::iterator it = m_Slaves.begin(), end = m_Slaves.end(); it != end; ++it) delete it->second; m_Slaves.clear(); - + m_SlavesMutex.unlock(); nldebug("END ~CModulePipelineMaster"); } @@ -242,7 +242,7 @@ public: if (moduleProxy->getModuleClassName() == "ModulePipelineSlave") { nlinfo("Slave UP (%s)", moduleProxy->getModuleName().c_str()); - + nlassert(m_Slaves.find(moduleProxy) == m_Slaves.end()); /* if (m_AbortRequested) @@ -263,7 +263,7 @@ public: } } } - + virtual void onModuleDown(IModuleProxy *moduleProxy) { if (moduleProxy->getModuleClassName() == "ModulePipelineSlave") @@ -277,9 +277,9 @@ public: m_ModuleUpDelay.erase(findDelay); } else*/ - { + { nlassert(m_Slaves.find(moduleProxy) != m_Slaves.end()); - + m_SlavesMutex.lock(); TSlaveMap::iterator slaveIt = m_Slaves.find(moduleProxy); @@ -292,11 +292,11 @@ public: // ... TODO ... slaveAbortedBuildTask(moduleProxy); // see if this works } - + m_Slaves.erase(slaveIt); delete slave; // nldebug("Now %i slaves remaining", m_Slaves.size()); - + m_SlavesMutex.unlock(); } } @@ -310,7 +310,7 @@ public: // The IRunnable will be deleted void addUpdateTask(IRunnable *runnable) { - NLMISC::CSynchronized>::CAccessor updateTasks(&m_UpdateTasks); + NLMISC::CSynchronized >::CAccessor updateTasks(&m_UpdateTasks); updateTasks.value().push_back(runnable); } @@ -322,7 +322,7 @@ public: { IRunnable *currentRunnable; { - NLMISC::CSynchronized>::CAccessor updateTasks(&m_UpdateTasks); + NLMISC::CSynchronized >::CAccessor updateTasks(&m_UpdateTasks); if (updateTasks.value().size() == 0) return; currentRunnable = updateTasks.value().front(); @@ -331,7 +331,7 @@ public: { currentRunnable->run(); { - NLMISC::CSynchronized>::CAccessor updateTasks(&m_UpdateTasks); + NLMISC::CSynchronized >::CAccessor updateTasks(&m_UpdateTasks); updateTasks.value().pop_front(); if (updateTasks.value().size() == 0) break; @@ -357,7 +357,7 @@ public: { it->second->BuildReadyState = 1; it->second->Proxy.enterBuildReadyState(this); - } + } // wait for confirmation, set BuildReadyState = 2 in that callback! } m_SlavesMutex.unlock(); @@ -393,9 +393,9 @@ public: else if (nbWorking == 0) { // done (or stuck) - + m_BuildWorking = false; - + m_SlavesMutex.lock(); // Iterate trough all slaves to tell them to end build_ready state. for (TSlaveMap::iterator it = m_Slaves.begin(), end = m_Slaves.end(); it != end; ++it) @@ -415,7 +415,7 @@ public: for (std::vector::iterator it = m_ModuleUpDelay.begin(), end = m_ModuleUpDelay.end(); it != end; ++it) onModuleUp(*it);*/ } - + PIPELINE::endedBuildReadyMaster(); } } @@ -447,7 +447,7 @@ public: nlerror("Slave returned bad error level"); break; } - + notifyTerminalTaskState(slave->ActiveTaskId, (TProcessResult)errorLevel, errorMessage); slave->ActiveTaskId = 0; @@ -466,7 +466,7 @@ public: notifyTerminalTaskState(slave->ActiveTaskId, FINISH_ABORT, "The task has been aborted"); slave->ActiveTaskId = 0; } - + // in fact slaves are not allowed to refuse tasks, but they may do this if the user is toying around with the slave service virtual void slaveRefusedBuildTask(NLNET::IModuleProxy *sender) { @@ -494,7 +494,7 @@ public: slave->SheetsOk = true; CInfoFlags::getInstance()->removeFlag(PIPELINE_INFO_MASTER_RELOAD_SHEETS); } - + virtual void slaveBuildReadySuccess(NLNET::IModuleProxy *sender) { //m_SlavesMutex.lock(); @@ -504,7 +504,7 @@ public: //m_SlavesMutex.unlock(); slave->BuildReadyState = 2; } - + virtual void slaveBuildReadyFail(NLNET::IModuleProxy *sender) { //m_SlavesMutex.lock(); @@ -546,7 +546,7 @@ public: { public: CUpdateDatabaseStatusSlaveCallback(CModulePipelineMaster *master, NLNET::IModuleProxy *slaveProxy) : CDelayedCallback(master), m_SlaveProxy(slaveProxy) { } - + virtual void run() // this is sanely run from the update thread { Master->m_SlavesMutex.lock(); @@ -568,7 +568,7 @@ public: delete this; } - + private: NLNET::IModuleProxy *m_SlaveProxy; }; @@ -576,8 +576,8 @@ public: class CUpdateDatabaseStatusByVectorTask : public IRunnable { public: - CUpdateDatabaseStatusByVectorTask(CModulePipelineMaster *master, NLNET::IModuleProxy *sender, std::vector &slaveVector) : m_Master(master), m_Sender(sender) - { + CUpdateDatabaseStatusByVectorTask(CModulePipelineMaster *master, NLNET::IModuleProxy *sender, std::vector &slaveVector) : m_Master(master), m_Sender(sender) + { std::swap(slaveVector, m_Vector); } virtual void run() // run from the master process task manager @@ -592,7 +592,7 @@ public: NLNET::IModuleProxy *m_Sender; std::vector m_Vector; }; - + virtual void updateDatabaseStatusByVector(NLNET::IModuleProxy *sender) { // FIXME: THIS MUST BE DONE ON A SEPERATE THREAD, IT HANGS WHILE ITERATING @@ -620,7 +620,7 @@ public: break; } } - + if (ok) { if (g_IsExiting) @@ -674,7 +674,7 @@ public: } // Yes, we effectively send the abort again to the slaves, it makes for a more epic abort button hammering experience. - + m_BuildTaskQueue.abortQueue(); m_SlavesMutex.lock(); @@ -693,7 +693,7 @@ public: return false; } } - + protected: NLMISC_COMMAND_HANDLER_TABLE_EXTEND_BEGIN(CModulePipelineMaster, CModuleBase) NLMISC_COMMAND_HANDLER_ADD(CModulePipelineMaster, reloadSheets, "Reload sheets across all services", "") @@ -717,11 +717,11 @@ protected: return false; } } - + void cbMasterSheetReloadUpdate() { m_SlavesMutex.lock(); - + for (TSlaveMap::iterator it = m_Slaves.begin(), end = m_Slaves.end(); it != end; ++it) { CSlave *slave = it->second; @@ -730,7 +730,7 @@ protected: slave->Proxy.reloadSheets(this); CInfoFlags::getInstance()->addFlag(PIPELINE_INFO_MASTER_RELOAD_SHEETS); } - + m_SlavesMutex.unlock(); PIPELINE::endedDirectTask(); 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 35cfa69aa..542c7c07d 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 cbdf02b64..9e2ca9ccb 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_slave_itf.cpp b/code/nel/tools/pipeline/service/module_pipeline_slave_itf.cpp index 529c8cd0a..7612489de 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 fd50c8fe9..c4d6156f1 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/pipeline_service.cpp b/code/nel/tools/pipeline/service/pipeline_service.cpp index 82da1a1cf..3748f9437 100644 --- a/code/nel/tools/pipeline/service/pipeline_service.cpp +++ b/code/nel/tools/pipeline/service/pipeline_service.cpp @@ -6,20 +6,20 @@ * CPipelineService */ -/* +/* * Copyright (C) 2012 by authors - * + * * This file is part of RYZOM CORE PIPELINE. * RYZOM CORE PIPELINE is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 2 of * the License, or (at your option) any later version. - * + * * RYZOM CORE PIPELINE is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with RYZOM CORE PIPELINE; see the file COPYING. If not, see * . @@ -100,7 +100,7 @@ std::string macroPath(const std::string &path) std::string result = standardizePath(path, false); strFindReplace(result, g_WorkDir, PIPELINE_MACRO_WORKSPACE_DIRECTORY "/"); - + CConfigFile::CVar &rootDirectories = NLNET::IService::getInstance()->ConfigFile.getVar("RootDirectories"); for (uint i = 0; i < rootDirectories.size(); ++i) { @@ -178,14 +178,14 @@ namespace { /// Enum enum EState { - STATE_IDLE, - STATE_RELOAD_SHEETS, - STATE_DATABASE_STATUS, - STATE_RUNNABLE_TASK, - STATE_BUSY_TEST, - STATE_DIRECT_CODE, - STATE_BUILD_READY, - STATE_BUILD_PROCESS, + STATE_IDLE, + STATE_RELOAD_SHEETS, + STATE_DATABASE_STATUS, + STATE_RUNNABLE_TASK, + STATE_BUSY_TEST, + STATE_DIRECT_CODE, + STATE_BUILD_READY, + STATE_BUILD_PROCESS, }; /// Data @@ -211,7 +211,7 @@ void cbNull(CMessage & /* msgin */, const std::string & /* serviceName */, TServ /// Callbacks from shard TUnifiedCallbackItem s_ShardCallbacks[] = // pipeline_server { - { "N", cbNull }, + { "N", cbNull }, }; bool tryStateTask(EState state, IRunnable *task) @@ -227,9 +227,9 @@ bool tryStateTask(EState state, IRunnable *task) if (!result) return false; nlassert(s_State != STATE_IDLE); - + s_TaskManager->addTask(task); - + return true; } @@ -256,9 +256,9 @@ bool tryRunnableTask(const std::string &stateName, IRunnable *task) if (!result) return false; nlassert(s_State == STATE_RUNNABLE_TASK); - + s_TaskManager->addTask(task); - + return true; } @@ -294,7 +294,7 @@ bool tryDirectTask(const std::string &stateName) if (!result) return false; nlassert(s_State == STATE_DIRECT_CODE); - + return true; } @@ -317,7 +317,7 @@ bool tryBuildReadyMaster() if (!result) return false; nlassert((s_State == STATE_BUILD_READY) && (s_BuildReadyRecursive > 0)); - + return true; } @@ -348,7 +348,7 @@ bool tryBuildReady() if (!result) return false; nlassert((s_State == STATE_BUILD_READY) && (s_BuildReadyRecursive > 0)); - + return true; } @@ -377,7 +377,7 @@ bool tryBuildProcess(const std::string &stateName) if (!result) return false; nlassert(s_State == STATE_BUILD_PROCESS); - + return true; } @@ -400,11 +400,11 @@ void initSheets() IService::getInstance()->ConfigFile.getVar("WorkspaceDfnDirectory").setAsString(dfnDirectory); std::string sheetDirectory = standardizePath(IService::getInstance()->ConfigFile.getVar("WorkspaceSheetDirectory").asString(), true); IService::getInstance()->ConfigFile.getVar("WorkspaceSheetDirectory").setAsString(sheetDirectory); - + if (!CFile::isDirectory(dfnDirectory)) nlerror("'WorkspaceDfnDirectory' does not exist! (%s)", dfnDirectory.c_str()); nlinfo("Adding 'WorkspaceDfnDirectory' to search path (%s)", dfnDirectory.c_str()); CPath::addSearchPath(dfnDirectory, true, false); - + if (!CFile::isDirectory(sheetDirectory)) nlerror("'WorkspaceSheetDirectory' does not exist! (%s)", sheetDirectory.c_str()); nlinfo("Adding 'WorkspaceSheetDirectory' to search path (%s)", sheetDirectory.c_str()); CPath::addSearchPath(sheetDirectory, true, false); @@ -418,9 +418,9 @@ void initSheets() if (!CFile::isDirectory(dirName)) nlerror("'%s' does not exist! (%s)", rootName.c_str(), dirName.c_str()); CPath::addSearchPath(dirName, true, false); } - + g_FormLoader = UFormLoader::createLoader(); - + g_PipelineWorkspace = new CPipelineWorkspace(g_FormLoader, IService::getInstance()->ConfigFile.getVar("WorkspaceSheet").asString()); } @@ -437,14 +437,14 @@ void releaseSheets() class CReloadSheets : public IRunnable { - virtual void getName(std::string &result) const + virtual void getName(std::string &result) const { result = "CReloadSheets"; } - + virtual void run() { releaseSheets(); initSheets(); - + endedRunnableTask(STATE_RELOAD_SHEETS); } }; @@ -463,9 +463,9 @@ namespace { class CUpdateDatabaseStatus : public IRunnable { - virtual void getName(std::string &result) const + virtual void getName(std::string &result) const { result = "CUpdateDatabaseStatus"; } - + void databaseStatusUpdated() { endedRunnableTask(STATE_DATABASE_STATUS); @@ -489,7 +489,7 @@ bool updateDatabaseStatus() class CBusyTestStatus : public IRunnable { - virtual void getName(std::string &result) const + virtual void getName(std::string &result) const { result = "CBusyTestStatus"; } virtual void run() @@ -523,15 +523,15 @@ public: module_pipeline_master_forceLink(); module_pipeline_slave_forceLink(); } - + virtual ~CPipelineService() { - + } - + /** Called before the displayer is created, no displayer or network connection are built. Use this callback to check some args and perform some command line based stuff */ - virtual void commandStart() + virtual void commandStart() { // setup the randomizer properly { @@ -542,7 +542,7 @@ public: srand(s); } } - + /// Initializes the service (must be called before the first call to update()) virtual void init() { @@ -569,7 +569,7 @@ public: } s_TaskManager = new CTaskManager(); - + initSheets(); g_DatabaseStatus = new CDatabaseStatus(); @@ -578,27 +578,38 @@ public: s_PipelineProcessImpl = new CPipelineProcessImpl(NULL); // Create a singleton impl for global usage without running project for test purposes. // Load libraries + s_InfoFlags->addFlag("PLUGIN"); const CConfigFile::CVar &usedPlugins = ConfigFile.getVar("UsedPlugins"); s_LoadedLibraries.reserve(usedPlugins.size()); for (uint i = 0; i < usedPlugins.size(); ++i) { - CLibrary *library = new CLibrary(); - if (library->loadLibrary(usedPlugins.asString(i), true, true, true)) + std::string pluginName = usedPlugins.asString(i); + if (pluginName.size() > 0) { - s_LoadedLibraries.push_back(library); + CLibrary *library = new CLibrary(); + if (library->loadLibrary(usedPlugins.asString(i), true, true, true)) + { + nlinfo("Loaded plugin '%s'", pluginName.c_str()); + s_LoadedLibraries.push_back(library); + } + else + { + nlwarning("Failed to load plugin '%s'", pluginName.c_str()); + delete library; + } } - else delete library; } + s_InfoFlags->removeFlag("PLUGIN"); s_InfoFlags->removeFlag("INIT"); } - + /// This function is called every "frame" (you must call init() before). It returns false if the service is stopped. virtual bool update() { return true; } - + /// Finalization. Release the service. For example, this function frees all allocations made in the init() function. virtual void release() { @@ -611,9 +622,9 @@ public: nlSleep(10); } NLMISC::CAsyncFileManager::terminate(); - + NLNET::IModuleManager::releaseInstance(); - + for (std::vector::iterator it = s_LoadedLibraries.begin(), end = s_LoadedLibraries.end(); it != end; ++it) { (*it)->freeLibrary(); @@ -642,7 +653,7 @@ public: delete s_InfoFlags; s_InfoFlags = NULL; } - + }; /* class CPipelineService */ } /* anonymous namespace */ @@ -869,7 +880,7 @@ NLMISC_COMMAND(showDependencies, "Show dependencies.", " ::iterator it = tasks.begin(), end = tasks.end(); it != end; ++it) { PIPELINE::CBuildTaskInfo *task = *it; @@ -889,9 +900,9 @@ NLMISC_COMMAND(dumpTestTaskQueueLoad, "Test task queue generation. You MUST NOT } taskQueue.abortQueue(); - + log.displayNL("**********************************************************************"); - + return true; }