From 7d38c69820fc510f4fd1e72e9dbe250a9707e5b5 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 3 Aug 2012 21:46:33 +0200 Subject: [PATCH] Added: #1440 Enum for build and runtime dependencies for the tool dependency logger --HG-- branch : build_pipeline_v3 --- code/nel/include/nel/misc/tool_logger.h | 28 +++++++++++++++------- code/nel/tools/3d/build_interface/main.cpp | 8 +++---- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/code/nel/include/nel/misc/tool_logger.h b/code/nel/include/nel/misc/tool_logger.h index da75daee1..021e6fb0f 100644 --- a/code/nel/include/nel/misc/tool_logger.h +++ b/code/nel/include/nel/misc/tool_logger.h @@ -46,19 +46,21 @@ namespace { #ifdef ERROR #undef ERROR #endif -enum EError +enum TError { ERROR, WARNING, MESSAGE, }; -const std::string s_Error = "ERROR"; -const std::string s_Warning = "WARNING"; -const std::string s_Message = "MESSAGE"; +enum TDepend +{ + BUILD, + RUNTIME, +}; const std::string s_ErrorHeader = "type\tpath\ttime\terror"; -const std::string s_DependHeader = "output_file\tinput_file"; +const std::string s_DependHeader = "type\toutput_file\tinput_file"; /** * \brief CToolLogger @@ -104,7 +106,7 @@ public: fflush(m_DependLog); } - void writeError(EError type, const std::string &path, const std::string &error) + void writeError(TError type, const std::string &path, const std::string &error) { if (m_ErrorLog) { @@ -132,11 +134,21 @@ public: } } - /// inputFile can only be file. May be not-yet-existing file for expected input for future build runs. Directories are handled on process level. You should call this before calling writeError on inputFile, so the error is also linked from the outputFile. - void writeDepend(const std::string &outputFile, const std::string &inputFile) + /// inputFile can only be file. [? May be not-yet-existing file for expected input for future build runs. ?] Directories are handled on process level. [? You should call this before calling writeError on inputFile, so the error is also linked from the outputFile. ?] + void writeDepend(TDepend type, const std::string &outputFile, const std::string &inputFile) { if (m_DependLog) { + switch (type) + { + case BUILD: + fwrite("BUILD", 1, 5, m_DependLog); + break; + case RUNTIME: + fwrite("RUNTIME", 1, 7, m_DependLog); + break; + } + fwrite("\t", 1, 1, m_DependLog); fwrite(outputFile.c_str(), 1, outputFile.length(), m_DependLog); fwrite("\t", 1, 1, m_DependLog); fwrite(inputFile.c_str(), 1, inputFile.length(), m_DependLog); diff --git a/code/nel/tools/3d/build_interface/main.cpp b/code/nel/tools/3d/build_interface/main.cpp index 0e5b79a6b..3d822ec0a 100644 --- a/code/nel/tools/3d/build_interface/main.cpp +++ b/code/nel/tools/3d/build_interface/main.cpp @@ -270,8 +270,8 @@ int main(int nNbArg, char **ppArgs) { try { - ToolLogger.writeDepend(tgaName, AllMapNames[i]); // Write depend before error can occur. - ToolLogger.writeDepend(uvName, AllMapNames[i]); + ToolLogger.writeDepend(PIPELINE::BUILD, tgaName, AllMapNames[i]); // Write depend before error can occur. + ToolLogger.writeDepend(PIPELINE::BUILD, uvName, AllMapNames[i]); NLMISC::CBitmap *pBtmp = new NLMISC::CBitmap; NLMISC::CIFile inFile; @@ -436,8 +436,8 @@ int main(int nNbArg, char **ppArgs) CIFile iFile; string filename = CPath::lookup (existingUVfilename, false); - ToolLogger.writeDepend(tgaName, existingUVfilename); // Write depend before error can occur. - ToolLogger.writeDepend(uvName, existingUVfilename); + ToolLogger.writeDepend(PIPELINE::BUILD, tgaName, existingUVfilename); // Write depend before error can occur. + ToolLogger.writeDepend(PIPELINE::BUILD, uvName, existingUVfilename); if( (filename == "") || (!iFile.open(filename)) ) {