Added: #1440 Depend metafile

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 12 years ago
parent fc268d8765
commit cefc026b1c

@ -71,6 +71,20 @@ void CFileRemove::serial(NLMISC::IStream &stream) throw (NLMISC::EStream)
stream.serial(Lost);
}
void CFileDepend::CDependency::serial(NLMISC::IStream &stream) throw (NLMISC::EStream)
{
uint version = stream.serialVersion(1);
stream.serial(CRC32);
stream.serial(MacroPath);
}
void CFileDepend::serial(NLMISC::IStream &stream) throw (NLMISC::EStream)
{
uint version = stream.serialVersion(1);
stream.serial(CRC32);
stream.serialCont(Dependencies);
}
void CProcessResult::CFileResult::serial(NLMISC::IStream &stream) throw (NLMISC::EStream)
{
uint version = stream.serialVersion(1);
@ -225,6 +239,41 @@ void CMetadataStorage::eraseOutput(const std::string &metaPath)
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
std::string CMetadataStorage::getDependPath(const std::string &file)
{
return CWorkspaceStorage::getMetaFilePath(file, PIPELINE_DATABASE_DEPEND_SUFFIX);
}
bool CMetadataStorage::readDepend(CFileDepend &depend, const std::string &metaPath)
{
if (!NLMISC::CFile::fileExists(metaPath))
{
depend.CRC32 = 0;
depend.Dependencies.clear();
return false;
}
nlassert(!NLMISC::CFile::isDirectory(metaPath));
NLMISC::CIFile is(metaPath, false);
depend.serial(is);
is.close();
return true;
}
void CMetadataStorage::writeDepend(const CFileDepend &depend, const std::string &metaPath)
{
NLMISC::COFile os(metaPath, false, false, true);
const_cast<CFileDepend &>(depend).serial(os);
os.flush();
os.close();
}
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
} /* namespace PIPELINE */
/* end of file */

@ -101,7 +101,21 @@ public:
/// Suffix for metafiles that contain dependencies for a file
#define PIPELINE_DATABASE_DEPEND_SUFFIX ".depend"
// .......................
struct CFileDepend
{
public:
uint32 CRC32; // Checksum of the current file
struct CDependency
{
std::string MacroPath;
uint32 CRC32;
void serial(NLMISC::IStream &stream) throw (NLMISC::EStream);
};
std::vector<CDependency> Dependencies;
void serial(NLMISC::IStream &stream) throw (NLMISC::EStream);
};
/// Suffix for metafiles that contain the result of the last build of a process
#define PIPELINE_DATABASE_RESULT_SUFFIX ".result"
@ -163,6 +177,10 @@ public:
// static void createRemove(const CFileRemove &remove, const std::string &path); // Remove cannot be modified after creation, only erased.
// static void eraseRemove(const std::string &path);
static std::string getDependPath(const std::string &file);
static bool readDepend(CFileDepend &status, const std::string &metaPath);
static void writeDepend(const CFileDepend &status, const std::string &metaPath);
// Pathname for result metadata is like .../project.projectname.meta/pluginname.result
static std::string getResultPath(const std::string &projectName, const std::string &pluginName);
static void readProcessResult(CProcessResult &result, const std::string &metaPath);

Loading…
Cancel
Save