ENH: Refactor Build.xml generation

This divides cmCTestBuildHandler::GenerateDartBuildOutput into three
methods to generate the header, content, and footer components of
Build.xml files.  It will allow the content generation to be replaced
later.
This commit is contained in:
Brad King 2009-02-04 14:34:12 -05:00
parent c6d499aba5
commit 5f65e04ea2
2 changed files with 19 additions and 11 deletions

View File

@ -473,16 +473,14 @@ int cmCTestBuildHandler::ProcessHandler()
<< std::endl); << std::endl);
return -1; return -1;
} }
this->GenerateDartBuildOutput( this->GenerateXMLHeader(xofs);
xofs, this->ErrorsAndWarnings, elapsed_build_time); this->GenerateXMLLogScraped(xofs);
this->GenerateXMLFooter(xofs, elapsed_build_time);
return retVal; return retVal;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmCTestBuildHandler::GenerateDartBuildOutput( void cmCTestBuildHandler::GenerateXMLHeader(std::ostream& os)
std::ostream& os,
std::vector<cmCTestBuildErrorWarning> ew,
double elapsed_build_time)
{ {
this->CTest->StartXML(os, this->AppendXML); this->CTest->StartXML(os, this->AppendXML);
os << "<Build>\n" os << "<Build>\n"
@ -494,7 +492,12 @@ void cmCTestBuildHandler::GenerateDartBuildOutput(
<< this->CTest->MakeXMLSafe( << this->CTest->MakeXMLSafe(
this->CTest->GetCTestConfiguration("MakeCommand")) this->CTest->GetCTestConfiguration("MakeCommand"))
<< "</BuildCommand>" << std::endl; << "</BuildCommand>" << std::endl;
}
//----------------------------------------------------------------------------
void cmCTestBuildHandler::GenerateXMLLogScraped(std::ostream& os)
{
std::vector<cmCTestBuildErrorWarning>& ew = this->ErrorsAndWarnings;
std::vector<cmCTestBuildErrorWarning>::iterator it; std::vector<cmCTestBuildErrorWarning>::iterator it;
// only report the first 50 warnings and first 50 errors // only report the first 50 warnings and first 50 errors
@ -591,6 +594,12 @@ void cmCTestBuildHandler::GenerateDartBuildOutput(
<< std::endl; << std::endl;
} }
} }
}
//----------------------------------------------------------------------------
void cmCTestBuildHandler::GenerateXMLFooter(std::ostream& os,
double elapsed_build_time)
{
os << "\t<Log Encoding=\"base64\" Compression=\"/bin/gzip\">\n\t</Log>\n" os << "\t<Log Encoding=\"base64\" Compression=\"/bin/gzip\">\n\t</Log>\n"
<< "\t<EndDateTime>" << this->EndBuild << "</EndDateTime>\n" << "\t<EndDateTime>" << this->EndBuild << "</EndDateTime>\n"
<< "\t<EndBuildTime>" << static_cast<unsigned int>(this->EndBuildTime) << "\t<EndBuildTime>" << static_cast<unsigned int>(this->EndBuildTime)

View File

@ -86,10 +86,9 @@ private:
}; };
// generate the XML output // generate the XML output
void GenerateDartBuildOutput(std::ostream& os, void GenerateXMLHeader(std::ostream& os);
std::vector<cmCTestBuildErrorWarning>, void GenerateXMLLogScraped(std::ostream& os);
double elapsed_time); void GenerateXMLFooter(std::ostream& os, double elapsed_build_time);
std::string StartBuild; std::string StartBuild;
std::string EndBuild; std::string EndBuild;