From 60fdb1c23e95124ae97900b2238ab64ac51646bb Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 1 Aug 2012 13:52:05 +0200 Subject: [PATCH] Added: #1440 Read previous successful process result --HG-- branch : build_pipeline_v3 --- .../pipeline/service/metadata_storage.cpp | 13 +++++++--- .../tools/pipeline/service/metadata_storage.h | 5 +++- .../service/module_pipeline_slave.cpp | 26 ++++++++++++++++--- 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/code/nel/tools/pipeline/service/metadata_storage.cpp b/code/nel/tools/pipeline/service/metadata_storage.cpp index fed910d07..3a5595bde 100644 --- a/code/nel/tools/pipeline/service/metadata_storage.cpp +++ b/code/nel/tools/pipeline/service/metadata_storage.cpp @@ -82,11 +82,18 @@ void CProcessResult::CFileResult::serial(NLMISC::IStream &stream) throw (NLMISC: void CProcessResult::serial(NLMISC::IStream &stream) throw (NLMISC::EStream) { uint version = stream.serialVersion(1); - stream.serial(LastSuccessfulBuildStart); + stream.serial(BuildStart); stream.serialCont(MacroPaths); stream.serialCont(FileResults); } +void CProcessResult::clear() +{ + BuildStart = 0; + MacroPaths.clear(); + FileResults.clear(); +} + /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// @@ -147,9 +154,7 @@ std::string CMetadataStorage::getResultPath(const std::string &projectName, cons void CMetadataStorage::readProcessResult(CProcessResult &result, const std::string &path) { // TODO - result.LastSuccessfulBuildStart = 0; - result.MacroPaths.clear(); - result.FileResults.clear(); + result.clear(); // TODO } diff --git a/code/nel/tools/pipeline/service/metadata_storage.h b/code/nel/tools/pipeline/service/metadata_storage.h index 9b8f55458..9729a19b1 100644 --- a/code/nel/tools/pipeline/service/metadata_storage.h +++ b/code/nel/tools/pipeline/service/metadata_storage.h @@ -112,7 +112,9 @@ public: // In that case, the last successfulbuild start is 0, and no output files will be known. // This is the same situation as if the project never built before. // It must be handled sanely. - uint32 LastSuccessfulBuildStart; + // This file is only stored when the build completed successfully. + // If it did not, bad output files can be noticed by having a different CRC32. + uint32 BuildStart; std::vector MacroPaths; struct CFileResult { @@ -124,6 +126,7 @@ public: std::vector FileResults; void serial(NLMISC::IStream &stream) throw (NLMISC::EStream); + void clear(); }; /** diff --git a/code/nel/tools/pipeline/service/module_pipeline_slave.cpp b/code/nel/tools/pipeline/service/module_pipeline_slave.cpp index 4c9c379cb..bbea02c01 100644 --- a/code/nel/tools/pipeline/service/module_pipeline_slave.cpp +++ b/code/nel/tools/pipeline/service/module_pipeline_slave.cpp @@ -43,6 +43,7 @@ #include "pipeline_workspace.h" #include "pipeline_process_impl.h" #include "database_status.h" +#include "pipeline_project.h" using namespace std; using namespace NLMISC; @@ -105,7 +106,9 @@ public: bool m_AbortRequested; + CProcessResult m_ResultPreviousSuccess; std::map m_FileStatusCache; + CProcessResult m_ResultCurrent; public: CModulePipelineSlave() : m_Master(NULL), m_TestCommand(false), m_ReloadSheetsState(REQUEST_NONE), m_BuildReadyState(false), m_SlaveTaskState(IDLE_WAIT_MASTER), m_TaskManager(NULL), m_StatusUpdateMasterDone("StatusUpdateMasterDone"), m_StatusUpdateSlaveDone("StatusUpdateSlaveDone"), m_ActiveProject(NULL), m_ActiveProcess(NULL), m_AbortRequested(false) @@ -114,6 +117,8 @@ public: NLMISC::CSynchronized::CAccessor(&m_StatusUpdateSlaveDone).value() = false; m_TaskManager = new NLMISC::CTaskManager(); + m_ResultPreviousSuccess.clear(); + m_ResultCurrent.clear(); } virtual ~CModulePipelineSlave() @@ -314,6 +319,14 @@ public: nlassert(NLMISC::CSynchronized::CAccessor(&m_StatusUpdateMasterDone).value() == false); nlassert(NLMISC::CSynchronized::CAccessor(&m_StatusUpdateSlaveDone).value() == false); } + nlassert(m_ResultCurrent.BuildStart == 0); + nlassert(m_ResultPreviousSuccess.BuildStart == 0); + + // Set start time + m_ResultCurrent.BuildStart = NLMISC::CTime::getSecondsSince1970(); + + // Read the previous process result + CMetadataStorage::readProcessResult(m_ResultPreviousSuccess, CMetadataStorage::getResultPath(m_ActiveProject->getName(), m_ActivePlugin.Handler)); // Start the client update CInfoFlags::getInstance()->addFlag(PIPELINE_INFO_STATUS_UPDATE_SLAVE); @@ -372,11 +385,18 @@ public: beginTaskStatusUpdate(); } - void finalizeAbort() + void clearActiveProcess() { m_ActiveProject = NULL; m_ActiveProcess = NULL; + m_ResultPreviousSuccess.clear(); m_FileStatusCache.clear(); + m_ResultCurrent.clear(); + } + + void finalizeAbort() + { + clearActiveProcess(); m_SlaveTaskState = IDLE_WAIT_MASTER; if (m_Master) // else was disconnect m_Master->slaveAbortedBuildTask(this); @@ -387,9 +407,7 @@ public: void finishedTask(TProcessResult errorLevel, const std::string &errorMessage) { - m_ActiveProject = NULL; - m_ActiveProcess = NULL; - m_FileStatusCache.clear(); + clearActiveProcess(); m_SlaveTaskState = IDLE_WAIT_MASTER; if (m_Master) // else was disconnect m_Master->slaveFinishedBuildTask(this, (uint8)errorLevel, errorMessage);