Changed: #1440 Correct encoding for generated itf. Change pipeline config for Linux

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 13 years ago
parent 70c7dd27cd
commit b159cd2502

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
cd /home/nevrax/build/devl/bin cd /home/kaetemi/core/pipeline_v3/build/devl/bin
./pipeline_service -C/home/nevrax/code/nel/tools/pipeline/service/example_cfg/master_gtk/ ./pipeline_service -C/home/kaetemi/core/pipeline_v3/code/nel/tools/pipeline/service/example_cfg/master_gtk/

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
cd /home/nevrax/build/devl/bin cd /home/kaetemi/core/pipeline_v3/build/devl/bin
./pipeline_service -C/home/nevrax/code/nel/tools/pipeline/service/example_cfg/master_linux/ ./pipeline_service -C/home/kaetemi/core/pipeline_v3/code/nel/tools/pipeline/service/example_cfg/master_linux/

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
cd /home/nevrax/build/devl/bin cd /home/kaetemi/core/pipeline_v3/build/devl/bin
./pipeline_service -C/home/nevrax/code/nel/tools/pipeline/service/example_cfg/master_slave/ ./pipeline_service -C/home/kaetemi/core/pipeline_v3/code/nel/tools/pipeline/service/example_cfg/master_slave/

@ -2,5 +2,5 @@
SharedWork = "/srv/work"; // W: on Win SharedWork = "/srv/work"; // W: on Win
SharedLeveldesign = "/srv/leveldesign"; // L: on Win SharedLeveldesign = "/srv/leveldesign"; // L: on Win
UsedPlugins = { }; UsedPlugins = { "" }; // CConfigFile BUG: Need dummy value to += afterwards!!!

@ -6,20 +6,20 @@
* CMetadataStorage * CMetadataStorage
*/ */
/* /*
* Copyright (C) 2012 by authors * Copyright (C) 2012 by authors
* *
* This file is part of RYZOM CORE PIPELINE. * This file is part of RYZOM CORE PIPELINE.
* RYZOM CORE PIPELINE is free software: you can redistribute it * RYZOM CORE PIPELINE is free software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public * and/or modify it under the terms of the GNU Affero General Public
* License as published by the Free Software Foundation, either * License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version. * version 3 of the License, or (at your option) any later version.
* *
* RYZOM CORE PIPELINE is distributed in the hope that it will be * RYZOM CORE PIPELINE is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public * You should have received a copy of the GNU Affero General Public
* License along with RYZOM CORE PIPELINE. If not, see * License along with RYZOM CORE PIPELINE. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
@ -32,6 +32,7 @@
// STL includes // STL includes
// NeL includes // NeL includes
#include <vector>
// Project includes // Project includes
#include "workspace_storage.h" #include "workspace_storage.h"
@ -106,6 +107,7 @@ public:
#define PIPELINE_DATABASE_RESULT_SUFFIX ".result" #define PIPELINE_DATABASE_RESULT_SUFFIX ".result"
struct CProjectResult struct CProjectResult
{ {
public:
std::vector<std::string> FilePaths; std::vector<std::string> FilePaths;
struct CFileResult struct CFileResult
{ {
@ -115,7 +117,7 @@ struct CProjectResult
void serial(NLMISC::IStream &stream) throw (NLMISC::EStream); void serial(NLMISC::IStream &stream) throw (NLMISC::EStream);
}; };
std::vector<CFileResult> FileResults; std::vector<CFileResult> FileResults;
void serial(NLMISC::IStream &stream) throw (NLMISC::EStream); void serial(NLMISC::IStream &stream) throw (NLMISC::EStream);
}; };
@ -135,7 +137,7 @@ public:
static bool readStatus(CFileStatus &status, const std::string &path); static bool readStatus(CFileStatus &status, const std::string &path);
static void writeStatus(const CFileStatus &status, const std::string &path); static void writeStatus(const CFileStatus &status, const std::string &path);
static void eraseStatus(const std::string &path); static void eraseStatus(const std::string &path);
/// Format like .../something.somedirectory.meta/path/file.remove /// Format like .../something.somedirectory.meta/path/file.remove
// static std::string getRemovePath(const std::string &file); // static std::string getRemovePath(const std::string &file);
// static bool readRemove(CFileRemove &remove, const std::string & path); // static bool readRemove(CFileRemove &remove, const std::string & path);

@ -6,20 +6,20 @@
* CModulePipelineMaster * CModulePipelineMaster
*/ */
/* /*
* Copyright (C) 2012 by authors * Copyright (C) 2012 by authors
* *
* This file is part of RYZOM CORE PIPELINE. * This file is part of RYZOM CORE PIPELINE.
* RYZOM CORE PIPELINE is free software: you can redistribute it * RYZOM CORE PIPELINE is free software: you can redistribute it
* and/or modify it under the terms of the GNU General Public License * and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 2 of * as published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version. * the License, or (at your option) any later version.
* *
* RYZOM CORE PIPELINE is distributed in the hope that it will be * RYZOM CORE PIPELINE is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RYZOM CORE PIPELINE; see the file COPYING. If not, see * along with RYZOM CORE PIPELINE; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
@ -72,15 +72,15 @@ namespace PIPELINE {
* CModulePipelineMaster * CModulePipelineMaster
*/ */
class CModulePipelineMaster : class CModulePipelineMaster :
public CModulePipelineMasterSkel, public CModulePipelineMasterSkel,
public CEmptyModuleServiceBehav<CEmptyModuleCommBehav<CEmptySocketBehav<CModuleBase> > > public CEmptyModuleServiceBehav<CEmptyModuleCommBehav<CEmptySocketBehav<CModuleBase> > >
{ {
struct CSlave struct CSlave
{ {
public: public:
CSlave(CModulePipelineMaster *master, IModuleProxy *moduleProxy) CSlave(CModulePipelineMaster *master, IModuleProxy *moduleProxy)
: Master(master), : Master(master),
Proxy(moduleProxy), Proxy(moduleProxy),
ActiveTaskId(0), ActiveTaskId(0),
SheetsOk(true), SheetsOk(true),
SaneBehaviour(3), SaneBehaviour(3),
@ -95,7 +95,7 @@ class CModulePipelineMaster :
sint SaneBehaviour; sint SaneBehaviour;
uint BuildReadyState; uint BuildReadyState;
uint32 TimeOutStamp; uint32 TimeOutStamp;
~CSlave() ~CSlave()
{ {
if (!SheetsOk) if (!SheetsOk)
@ -109,7 +109,7 @@ class CModulePipelineMaster :
return SheetsOk && (ActiveTaskId == 0) && SaneBehaviour > 0 && BuildReadyState == 2 && TimeOutStamp < NLMISC::CTime::getSecondsSince1970(); return SheetsOk && (ActiveTaskId == 0) && SaneBehaviour > 0 && BuildReadyState == 2 && TimeOutStamp < NLMISC::CTime::getSecondsSince1970();
} }
}; };
protected: protected:
typedef std::map<IModuleProxy *, CSlave *> TSlaveMap; typedef std::map<IModuleProxy *, CSlave *> TSlaveMap;
TSlaveMap m_Slaves; TSlaveMap m_Slaves;
@ -120,7 +120,7 @@ protected:
bool m_AbortRequested; bool m_AbortRequested;
NLMISC::CTaskManager *m_TaskManager; // Manages tasks requested by a slave. NLMISC::CTaskManager *m_TaskManager; // Manages tasks requested by a slave.
NLMISC::CSynchronized<std::list<IRunnable *>> m_WaitingCallbacks; NLMISC::CSynchronized<std::list<IRunnable *> > m_WaitingCallbacks;
// A runnable that's executed at next update state used as a callback. // A runnable that's executed at next update state used as a callback.
// Override runnable as normal as the callback function. // Override runnable as normal as the callback function.
@ -128,8 +128,8 @@ protected:
{ {
public: public:
CDelayedCallback(CModulePipelineMaster *master) : Master(master) CDelayedCallback(CModulePipelineMaster *master) : Master(master)
{ {
NLMISC::CSynchronized<std::list<IRunnable *>>::CAccessor waitingCallbacks(&Master->m_WaitingCallbacks); NLMISC::CSynchronized<std::list<IRunnable *> >::CAccessor waitingCallbacks(&Master->m_WaitingCallbacks);
waitingCallbacks.value().push_back(this); waitingCallbacks.value().push_back(this);
} }
inline CCallback<void> getCallback() { return CCallback<void>(this, &CDelayedCallback::callback); } inline CCallback<void> getCallback() { return CCallback<void>(this, &CDelayedCallback::callback); }
@ -142,7 +142,7 @@ protected:
Master->addUpdateTask(this); Master->addUpdateTask(this);
} }
{ {
NLMISC::CSynchronized<std::list<IRunnable *>>::CAccessor waitingCallbacks(&Master->m_WaitingCallbacks); NLMISC::CSynchronized<std::list<IRunnable *> >::CAccessor waitingCallbacks(&Master->m_WaitingCallbacks);
waitingCallbacks.value().remove(this); waitingCallbacks.value().remove(this);
} }
} }
@ -150,7 +150,7 @@ protected:
// Runnable tasks that are ran on the next update cycle. // Runnable tasks that are ran on the next update cycle.
// The IRunnable instance is deleted by the update cycle. // The IRunnable instance is deleted by the update cycle.
NLMISC::CSynchronized<std::deque<IRunnable *>> m_UpdateTasks; NLMISC::CSynchronized<std::deque<IRunnable *> > m_UpdateTasks;
// build command // build command
bool m_BypassErrors; bool m_BypassErrors;
@ -181,11 +181,11 @@ public:
for (; ; ) for (; ; )
{ {
{ {
NLMISC::CSynchronized<std::list<IRunnable *>>::CAccessor waitingCallbacks(&m_WaitingCallbacks); NLMISC::CSynchronized<std::list<IRunnable *> >::CAccessor waitingCallbacks(&m_WaitingCallbacks);
if (waitingCallbacks.value().size() == 0) if (waitingCallbacks.value().size() == 0)
break; break;
} }
nlwarning("Waiting for callbacks on the master to be called..."); nlwarning("Waiting for callbacks on the master to be called...");
nlSleep(1000); nlSleep(1000);
} }
@ -194,11 +194,11 @@ public:
handleUpdateTasks(); handleUpdateTasks();
m_SlavesMutex.lock(); m_SlavesMutex.lock();
for (TSlaveMap::iterator it = m_Slaves.begin(), end = m_Slaves.end(); it != end; ++it) for (TSlaveMap::iterator it = m_Slaves.begin(), end = m_Slaves.end(); it != end; ++it)
delete it->second; delete it->second;
m_Slaves.clear(); m_Slaves.clear();
m_SlavesMutex.unlock(); m_SlavesMutex.unlock();
nldebug("END ~CModulePipelineMaster"); nldebug("END ~CModulePipelineMaster");
} }
@ -242,7 +242,7 @@ public:
if (moduleProxy->getModuleClassName() == "ModulePipelineSlave") if (moduleProxy->getModuleClassName() == "ModulePipelineSlave")
{ {
nlinfo("Slave UP (%s)", moduleProxy->getModuleName().c_str()); nlinfo("Slave UP (%s)", moduleProxy->getModuleName().c_str());
nlassert(m_Slaves.find(moduleProxy) == m_Slaves.end()); nlassert(m_Slaves.find(moduleProxy) == m_Slaves.end());
/* /*
if (m_AbortRequested) if (m_AbortRequested)
@ -263,7 +263,7 @@ public:
} }
} }
} }
virtual void onModuleDown(IModuleProxy *moduleProxy) virtual void onModuleDown(IModuleProxy *moduleProxy)
{ {
if (moduleProxy->getModuleClassName() == "ModulePipelineSlave") if (moduleProxy->getModuleClassName() == "ModulePipelineSlave")
@ -277,9 +277,9 @@ public:
m_ModuleUpDelay.erase(findDelay); m_ModuleUpDelay.erase(findDelay);
} }
else*/ else*/
{ {
nlassert(m_Slaves.find(moduleProxy) != m_Slaves.end()); nlassert(m_Slaves.find(moduleProxy) != m_Slaves.end());
m_SlavesMutex.lock(); m_SlavesMutex.lock();
TSlaveMap::iterator slaveIt = m_Slaves.find(moduleProxy); TSlaveMap::iterator slaveIt = m_Slaves.find(moduleProxy);
@ -292,11 +292,11 @@ public:
// ... TODO ... // ... TODO ...
slaveAbortedBuildTask(moduleProxy); // see if this works slaveAbortedBuildTask(moduleProxy); // see if this works
} }
m_Slaves.erase(slaveIt); m_Slaves.erase(slaveIt);
delete slave; delete slave;
// nldebug("Now %i slaves remaining", m_Slaves.size()); // nldebug("Now %i slaves remaining", m_Slaves.size());
m_SlavesMutex.unlock(); m_SlavesMutex.unlock();
} }
} }
@ -310,7 +310,7 @@ public:
// The IRunnable will be deleted // The IRunnable will be deleted
void addUpdateTask(IRunnable *runnable) void addUpdateTask(IRunnable *runnable)
{ {
NLMISC::CSynchronized<std::deque<IRunnable *>>::CAccessor updateTasks(&m_UpdateTasks); NLMISC::CSynchronized<std::deque<IRunnable *> >::CAccessor updateTasks(&m_UpdateTasks);
updateTasks.value().push_back(runnable); updateTasks.value().push_back(runnable);
} }
@ -322,7 +322,7 @@ public:
{ {
IRunnable *currentRunnable; IRunnable *currentRunnable;
{ {
NLMISC::CSynchronized<std::deque<IRunnable *>>::CAccessor updateTasks(&m_UpdateTasks); NLMISC::CSynchronized<std::deque<IRunnable *> >::CAccessor updateTasks(&m_UpdateTasks);
if (updateTasks.value().size() == 0) if (updateTasks.value().size() == 0)
return; return;
currentRunnable = updateTasks.value().front(); currentRunnable = updateTasks.value().front();
@ -331,7 +331,7 @@ public:
{ {
currentRunnable->run(); currentRunnable->run();
{ {
NLMISC::CSynchronized<std::deque<IRunnable *>>::CAccessor updateTasks(&m_UpdateTasks); NLMISC::CSynchronized<std::deque<IRunnable *> >::CAccessor updateTasks(&m_UpdateTasks);
updateTasks.value().pop_front(); updateTasks.value().pop_front();
if (updateTasks.value().size() == 0) if (updateTasks.value().size() == 0)
break; break;
@ -357,7 +357,7 @@ public:
{ {
it->second->BuildReadyState = 1; it->second->BuildReadyState = 1;
it->second->Proxy.enterBuildReadyState(this); it->second->Proxy.enterBuildReadyState(this);
} }
// wait for confirmation, set BuildReadyState = 2 in that callback! // wait for confirmation, set BuildReadyState = 2 in that callback!
} }
m_SlavesMutex.unlock(); m_SlavesMutex.unlock();
@ -393,9 +393,9 @@ public:
else if (nbWorking == 0) else if (nbWorking == 0)
{ {
// done (or stuck) // done (or stuck)
m_BuildWorking = false; m_BuildWorking = false;
m_SlavesMutex.lock(); m_SlavesMutex.lock();
// Iterate trough all slaves to tell them to end build_ready state. // 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) for (TSlaveMap::iterator it = m_Slaves.begin(), end = m_Slaves.end(); it != end; ++it)
@ -415,7 +415,7 @@ public:
for (std::vector<IModuleProxy *>::iterator it = m_ModuleUpDelay.begin(), end = m_ModuleUpDelay.end(); it != end; ++it) for (std::vector<IModuleProxy *>::iterator it = m_ModuleUpDelay.begin(), end = m_ModuleUpDelay.end(); it != end; ++it)
onModuleUp(*it);*/ onModuleUp(*it);*/
} }
PIPELINE::endedBuildReadyMaster(); PIPELINE::endedBuildReadyMaster();
} }
} }
@ -447,7 +447,7 @@ public:
nlerror("Slave returned bad error level"); nlerror("Slave returned bad error level");
break; break;
} }
notifyTerminalTaskState(slave->ActiveTaskId, (TProcessResult)errorLevel, errorMessage); notifyTerminalTaskState(slave->ActiveTaskId, (TProcessResult)errorLevel, errorMessage);
slave->ActiveTaskId = 0; slave->ActiveTaskId = 0;
@ -466,7 +466,7 @@ public:
notifyTerminalTaskState(slave->ActiveTaskId, FINISH_ABORT, "The task has been aborted"); notifyTerminalTaskState(slave->ActiveTaskId, FINISH_ABORT, "The task has been aborted");
slave->ActiveTaskId = 0; 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 // 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) virtual void slaveRefusedBuildTask(NLNET::IModuleProxy *sender)
{ {
@ -494,7 +494,7 @@ public:
slave->SheetsOk = true; slave->SheetsOk = true;
CInfoFlags::getInstance()->removeFlag(PIPELINE_INFO_MASTER_RELOAD_SHEETS); CInfoFlags::getInstance()->removeFlag(PIPELINE_INFO_MASTER_RELOAD_SHEETS);
} }
virtual void slaveBuildReadySuccess(NLNET::IModuleProxy *sender) virtual void slaveBuildReadySuccess(NLNET::IModuleProxy *sender)
{ {
//m_SlavesMutex.lock(); //m_SlavesMutex.lock();
@ -504,7 +504,7 @@ public:
//m_SlavesMutex.unlock(); //m_SlavesMutex.unlock();
slave->BuildReadyState = 2; slave->BuildReadyState = 2;
} }
virtual void slaveBuildReadyFail(NLNET::IModuleProxy *sender) virtual void slaveBuildReadyFail(NLNET::IModuleProxy *sender)
{ {
//m_SlavesMutex.lock(); //m_SlavesMutex.lock();
@ -546,7 +546,7 @@ public:
{ {
public: public:
CUpdateDatabaseStatusSlaveCallback(CModulePipelineMaster *master, NLNET::IModuleProxy *slaveProxy) : CDelayedCallback(master), m_SlaveProxy(slaveProxy) { } CUpdateDatabaseStatusSlaveCallback(CModulePipelineMaster *master, NLNET::IModuleProxy *slaveProxy) : CDelayedCallback(master), m_SlaveProxy(slaveProxy) { }
virtual void run() // this is sanely run from the update thread virtual void run() // this is sanely run from the update thread
{ {
Master->m_SlavesMutex.lock(); Master->m_SlavesMutex.lock();
@ -568,7 +568,7 @@ public:
delete this; delete this;
} }
private: private:
NLNET::IModuleProxy *m_SlaveProxy; NLNET::IModuleProxy *m_SlaveProxy;
}; };
@ -576,8 +576,8 @@ public:
class CUpdateDatabaseStatusByVectorTask : public IRunnable class CUpdateDatabaseStatusByVectorTask : public IRunnable
{ {
public: public:
CUpdateDatabaseStatusByVectorTask(CModulePipelineMaster *master, NLNET::IModuleProxy *sender, std::vector<std::string> &slaveVector) : m_Master(master), m_Sender(sender) CUpdateDatabaseStatusByVectorTask(CModulePipelineMaster *master, NLNET::IModuleProxy *sender, std::vector<std::string> &slaveVector) : m_Master(master), m_Sender(sender)
{ {
std::swap(slaveVector, m_Vector); std::swap(slaveVector, m_Vector);
} }
virtual void run() // run from the master process task manager virtual void run() // run from the master process task manager
@ -592,7 +592,7 @@ public:
NLNET::IModuleProxy *m_Sender; NLNET::IModuleProxy *m_Sender;
std::vector<std::string> m_Vector; std::vector<std::string> m_Vector;
}; };
virtual void updateDatabaseStatusByVector(NLNET::IModuleProxy *sender) virtual void updateDatabaseStatusByVector(NLNET::IModuleProxy *sender)
{ {
// FIXME: THIS MUST BE DONE ON A SEPERATE THREAD, IT HANGS WHILE ITERATING // FIXME: THIS MUST BE DONE ON A SEPERATE THREAD, IT HANGS WHILE ITERATING
@ -620,7 +620,7 @@ public:
break; break;
} }
} }
if (ok) if (ok)
{ {
if (g_IsExiting) 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. // Yes, we effectively send the abort again to the slaves, it makes for a more epic abort button hammering experience.
m_BuildTaskQueue.abortQueue(); m_BuildTaskQueue.abortQueue();
m_SlavesMutex.lock(); m_SlavesMutex.lock();
@ -693,7 +693,7 @@ public:
return false; return false;
} }
} }
protected: protected:
NLMISC_COMMAND_HANDLER_TABLE_EXTEND_BEGIN(CModulePipelineMaster, CModuleBase) NLMISC_COMMAND_HANDLER_TABLE_EXTEND_BEGIN(CModulePipelineMaster, CModuleBase)
NLMISC_COMMAND_HANDLER_ADD(CModulePipelineMaster, reloadSheets, "Reload sheets across all services", "") NLMISC_COMMAND_HANDLER_ADD(CModulePipelineMaster, reloadSheets, "Reload sheets across all services", "")
@ -717,11 +717,11 @@ protected:
return false; return false;
} }
} }
void cbMasterSheetReloadUpdate() void cbMasterSheetReloadUpdate()
{ {
m_SlavesMutex.lock(); m_SlavesMutex.lock();
for (TSlaveMap::iterator it = m_Slaves.begin(), end = m_Slaves.end(); it != end; ++it) for (TSlaveMap::iterator it = m_Slaves.begin(), end = m_Slaves.end(); it != end; ++it)
{ {
CSlave *slave = it->second; CSlave *slave = it->second;
@ -730,7 +730,7 @@ protected:
slave->Proxy.reloadSheets(this); slave->Proxy.reloadSheets(this);
CInfoFlags::getInstance()->addFlag(PIPELINE_INFO_MASTER_RELOAD_SHEETS); CInfoFlags::getInstance()->addFlag(PIPELINE_INFO_MASTER_RELOAD_SHEETS);
} }
m_SlavesMutex.unlock(); m_SlavesMutex.unlock();
PIPELINE::endedDirectTask(); PIPELINE::endedDirectTask();

@ -6,20 +6,20 @@
* CPipelineService * CPipelineService
*/ */
/* /*
* Copyright (C) 2012 by authors * Copyright (C) 2012 by authors
* *
* This file is part of RYZOM CORE PIPELINE. * This file is part of RYZOM CORE PIPELINE.
* RYZOM CORE PIPELINE is free software: you can redistribute it * RYZOM CORE PIPELINE is free software: you can redistribute it
* and/or modify it under the terms of the GNU General Public License * and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 2 of * as published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version. * the License, or (at your option) any later version.
* *
* RYZOM CORE PIPELINE is distributed in the hope that it will be * RYZOM CORE PIPELINE is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RYZOM CORE PIPELINE; see the file COPYING. If not, see * along with RYZOM CORE PIPELINE; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
@ -100,7 +100,7 @@ std::string macroPath(const std::string &path)
std::string result = standardizePath(path, false); std::string result = standardizePath(path, false);
strFindReplace(result, g_WorkDir, PIPELINE_MACRO_WORKSPACE_DIRECTORY "/"); strFindReplace(result, g_WorkDir, PIPELINE_MACRO_WORKSPACE_DIRECTORY "/");
CConfigFile::CVar &rootDirectories = NLNET::IService::getInstance()->ConfigFile.getVar("RootDirectories"); CConfigFile::CVar &rootDirectories = NLNET::IService::getInstance()->ConfigFile.getVar("RootDirectories");
for (uint i = 0; i < rootDirectories.size(); ++i) for (uint i = 0; i < rootDirectories.size(); ++i)
{ {
@ -178,14 +178,14 @@ namespace {
/// Enum /// Enum
enum EState enum EState
{ {
STATE_IDLE, STATE_IDLE,
STATE_RELOAD_SHEETS, STATE_RELOAD_SHEETS,
STATE_DATABASE_STATUS, STATE_DATABASE_STATUS,
STATE_RUNNABLE_TASK, STATE_RUNNABLE_TASK,
STATE_BUSY_TEST, STATE_BUSY_TEST,
STATE_DIRECT_CODE, STATE_DIRECT_CODE,
STATE_BUILD_READY, STATE_BUILD_READY,
STATE_BUILD_PROCESS, STATE_BUILD_PROCESS,
}; };
/// Data /// Data
@ -211,7 +211,7 @@ void cbNull(CMessage & /* msgin */, const std::string & /* serviceName */, TServ
/// Callbacks from shard /// Callbacks from shard
TUnifiedCallbackItem s_ShardCallbacks[] = // pipeline_server TUnifiedCallbackItem s_ShardCallbacks[] = // pipeline_server
{ {
{ "N", cbNull }, { "N", cbNull },
}; };
bool tryStateTask(EState state, IRunnable *task) bool tryStateTask(EState state, IRunnable *task)
@ -227,9 +227,9 @@ bool tryStateTask(EState state, IRunnable *task)
if (!result) return false; if (!result) return false;
nlassert(s_State != STATE_IDLE); nlassert(s_State != STATE_IDLE);
s_TaskManager->addTask(task); s_TaskManager->addTask(task);
return true; return true;
} }
@ -256,9 +256,9 @@ bool tryRunnableTask(const std::string &stateName, IRunnable *task)
if (!result) return false; if (!result) return false;
nlassert(s_State == STATE_RUNNABLE_TASK); nlassert(s_State == STATE_RUNNABLE_TASK);
s_TaskManager->addTask(task); s_TaskManager->addTask(task);
return true; return true;
} }
@ -294,7 +294,7 @@ bool tryDirectTask(const std::string &stateName)
if (!result) return false; if (!result) return false;
nlassert(s_State == STATE_DIRECT_CODE); nlassert(s_State == STATE_DIRECT_CODE);
return true; return true;
} }
@ -317,7 +317,7 @@ bool tryBuildReadyMaster()
if (!result) return false; if (!result) return false;
nlassert((s_State == STATE_BUILD_READY) && (s_BuildReadyRecursive > 0)); nlassert((s_State == STATE_BUILD_READY) && (s_BuildReadyRecursive > 0));
return true; return true;
} }
@ -348,7 +348,7 @@ bool tryBuildReady()
if (!result) return false; if (!result) return false;
nlassert((s_State == STATE_BUILD_READY) && (s_BuildReadyRecursive > 0)); nlassert((s_State == STATE_BUILD_READY) && (s_BuildReadyRecursive > 0));
return true; return true;
} }
@ -377,7 +377,7 @@ bool tryBuildProcess(const std::string &stateName)
if (!result) return false; if (!result) return false;
nlassert(s_State == STATE_BUILD_PROCESS); nlassert(s_State == STATE_BUILD_PROCESS);
return true; return true;
} }
@ -400,11 +400,11 @@ void initSheets()
IService::getInstance()->ConfigFile.getVar("WorkspaceDfnDirectory").setAsString(dfnDirectory); IService::getInstance()->ConfigFile.getVar("WorkspaceDfnDirectory").setAsString(dfnDirectory);
std::string sheetDirectory = standardizePath(IService::getInstance()->ConfigFile.getVar("WorkspaceSheetDirectory").asString(), true); std::string sheetDirectory = standardizePath(IService::getInstance()->ConfigFile.getVar("WorkspaceSheetDirectory").asString(), true);
IService::getInstance()->ConfigFile.getVar("WorkspaceSheetDirectory").setAsString(sheetDirectory); IService::getInstance()->ConfigFile.getVar("WorkspaceSheetDirectory").setAsString(sheetDirectory);
if (!CFile::isDirectory(dfnDirectory)) nlerror("'WorkspaceDfnDirectory' does not exist! (%s)", dfnDirectory.c_str()); if (!CFile::isDirectory(dfnDirectory)) nlerror("'WorkspaceDfnDirectory' does not exist! (%s)", dfnDirectory.c_str());
nlinfo("Adding 'WorkspaceDfnDirectory' to search path (%s)", dfnDirectory.c_str()); nlinfo("Adding 'WorkspaceDfnDirectory' to search path (%s)", dfnDirectory.c_str());
CPath::addSearchPath(dfnDirectory, true, false); CPath::addSearchPath(dfnDirectory, true, false);
if (!CFile::isDirectory(sheetDirectory)) nlerror("'WorkspaceSheetDirectory' does not exist! (%s)", sheetDirectory.c_str()); if (!CFile::isDirectory(sheetDirectory)) nlerror("'WorkspaceSheetDirectory' does not exist! (%s)", sheetDirectory.c_str());
nlinfo("Adding 'WorkspaceSheetDirectory' to search path (%s)", sheetDirectory.c_str()); nlinfo("Adding 'WorkspaceSheetDirectory' to search path (%s)", sheetDirectory.c_str());
CPath::addSearchPath(sheetDirectory, true, false); 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()); if (!CFile::isDirectory(dirName)) nlerror("'%s' does not exist! (%s)", rootName.c_str(), dirName.c_str());
CPath::addSearchPath(dirName, true, false); CPath::addSearchPath(dirName, true, false);
} }
g_FormLoader = UFormLoader::createLoader(); g_FormLoader = UFormLoader::createLoader();
g_PipelineWorkspace = new CPipelineWorkspace(g_FormLoader, IService::getInstance()->ConfigFile.getVar("WorkspaceSheet").asString()); g_PipelineWorkspace = new CPipelineWorkspace(g_FormLoader, IService::getInstance()->ConfigFile.getVar("WorkspaceSheet").asString());
} }
@ -437,14 +437,14 @@ void releaseSheets()
class CReloadSheets : public IRunnable class CReloadSheets : public IRunnable
{ {
virtual void getName(std::string &result) const virtual void getName(std::string &result) const
{ result = "CReloadSheets"; } { result = "CReloadSheets"; }
virtual void run() virtual void run()
{ {
releaseSheets(); releaseSheets();
initSheets(); initSheets();
endedRunnableTask(STATE_RELOAD_SHEETS); endedRunnableTask(STATE_RELOAD_SHEETS);
} }
}; };
@ -463,9 +463,9 @@ namespace {
class CUpdateDatabaseStatus : public IRunnable class CUpdateDatabaseStatus : public IRunnable
{ {
virtual void getName(std::string &result) const virtual void getName(std::string &result) const
{ result = "CUpdateDatabaseStatus"; } { result = "CUpdateDatabaseStatus"; }
void databaseStatusUpdated() void databaseStatusUpdated()
{ {
endedRunnableTask(STATE_DATABASE_STATUS); endedRunnableTask(STATE_DATABASE_STATUS);
@ -489,7 +489,7 @@ bool updateDatabaseStatus()
class CBusyTestStatus : public IRunnable class CBusyTestStatus : public IRunnable
{ {
virtual void getName(std::string &result) const virtual void getName(std::string &result) const
{ result = "CBusyTestStatus"; } { result = "CBusyTestStatus"; }
virtual void run() virtual void run()
@ -523,15 +523,15 @@ public:
module_pipeline_master_forceLink(); module_pipeline_master_forceLink();
module_pipeline_slave_forceLink(); module_pipeline_slave_forceLink();
} }
virtual ~CPipelineService() virtual ~CPipelineService()
{ {
} }
/** Called before the displayer is created, no displayer or network connection are built. /** 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 */ Use this callback to check some args and perform some command line based stuff */
virtual void commandStart() virtual void commandStart()
{ {
// setup the randomizer properly // setup the randomizer properly
{ {
@ -542,7 +542,7 @@ public:
srand(s); srand(s);
} }
} }
/// Initializes the service (must be called before the first call to update()) /// Initializes the service (must be called before the first call to update())
virtual void init() virtual void init()
{ {
@ -569,7 +569,7 @@ public:
} }
s_TaskManager = new CTaskManager(); s_TaskManager = new CTaskManager();
initSheets(); initSheets();
g_DatabaseStatus = new CDatabaseStatus(); 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. s_PipelineProcessImpl = new CPipelineProcessImpl(NULL); // Create a singleton impl for global usage without running project for test purposes.
// Load libraries // Load libraries
s_InfoFlags->addFlag("PLUGIN");
const CConfigFile::CVar &usedPlugins = ConfigFile.getVar("UsedPlugins"); const CConfigFile::CVar &usedPlugins = ConfigFile.getVar("UsedPlugins");
s_LoadedLibraries.reserve(usedPlugins.size()); s_LoadedLibraries.reserve(usedPlugins.size());
for (uint i = 0; i < usedPlugins.size(); ++i) for (uint i = 0; i < usedPlugins.size(); ++i)
{ {
CLibrary *library = new CLibrary(); std::string pluginName = usedPlugins.asString(i);
if (library->loadLibrary(usedPlugins.asString(i), true, true, true)) 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"); s_InfoFlags->removeFlag("INIT");
} }
/// This function is called every "frame" (you must call init() before). It returns false if the service is stopped. /// This function is called every "frame" (you must call init() before). It returns false if the service is stopped.
virtual bool update() virtual bool update()
{ {
return true; return true;
} }
/// Finalization. Release the service. For example, this function frees all allocations made in the init() function. /// Finalization. Release the service. For example, this function frees all allocations made in the init() function.
virtual void release() virtual void release()
{ {
@ -611,9 +622,9 @@ public:
nlSleep(10); nlSleep(10);
} }
NLMISC::CAsyncFileManager::terminate(); NLMISC::CAsyncFileManager::terminate();
NLNET::IModuleManager::releaseInstance(); NLNET::IModuleManager::releaseInstance();
for (std::vector<NLMISC::CLibrary *>::iterator it = s_LoadedLibraries.begin(), end = s_LoadedLibraries.end(); it != end; ++it) for (std::vector<NLMISC::CLibrary *>::iterator it = s_LoadedLibraries.begin(), end = s_LoadedLibraries.end(); it != end; ++it)
{ {
(*it)->freeLibrary(); (*it)->freeLibrary();
@ -642,7 +653,7 @@ public:
delete s_InfoFlags; delete s_InfoFlags;
s_InfoFlags = NULL; s_InfoFlags = NULL;
} }
}; /* class CPipelineService */ }; /* class CPipelineService */
} /* anonymous namespace */ } /* anonymous namespace */
@ -869,7 +880,7 @@ NLMISC_COMMAND(showDependencies, "Show dependencies.", "<projectName> <processNa
NLMISC_COMMAND(dumpTestTaskQueueLoad, "Test task queue generation. You MUST NOT reload workspace sheets while running this.", "") NLMISC_COMMAND(dumpTestTaskQueueLoad, "Test task queue generation. You MUST NOT reload workspace sheets while running this.", "")
{ {
if(args.size() != 0) return false; if(args.size() != 0) return false;
log.displayNL("**********************************************************************"); log.displayNL("**********************************************************************");
PIPELINE::CBuildTaskQueue taskQueue; PIPELINE::CBuildTaskQueue taskQueue;
@ -879,7 +890,7 @@ NLMISC_COMMAND(dumpTestTaskQueueLoad, "Test task queue generation. You MUST NOT
taskQueue.listTaskQueueByMostDependents(tasks); taskQueue.listTaskQueueByMostDependents(tasks);
log.displayNL("COUNT: %i", tasks.size()); log.displayNL("COUNT: %i", tasks.size());
for (std::vector<PIPELINE::CBuildTaskInfo *>::iterator it = tasks.begin(), end = tasks.end(); it != end; ++it) for (std::vector<PIPELINE::CBuildTaskInfo *>::iterator it = tasks.begin(), end = tasks.end(); it != end; ++it)
{ {
PIPELINE::CBuildTaskInfo *task = *it; PIPELINE::CBuildTaskInfo *task = *it;
@ -889,9 +900,9 @@ NLMISC_COMMAND(dumpTestTaskQueueLoad, "Test task queue generation. You MUST NOT
} }
taskQueue.abortQueue(); taskQueue.abortQueue();
log.displayNL("**********************************************************************"); log.displayNL("**********************************************************************");
return true; return true;
} }

Loading…
Cancel
Save