Added: #1440 Read previous successful process result

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 13 years ago
parent f9de7ed616
commit 60fdb1c23e

@ -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
}

@ -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<std::string> MacroPaths;
struct CFileResult
{
@ -124,6 +126,7 @@ public:
std::vector<CFileResult> FileResults;
void serial(NLMISC::IStream &stream) throw (NLMISC::EStream);
void clear();
};
/**

@ -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<std::string, CFileStatus> 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<bool>::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<bool>::CAccessor(&m_StatusUpdateMasterDone).value() == false);
nlassert(NLMISC::CSynchronized<bool>::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);

Loading…
Cancel
Save