/*============================================================================ CMake - Cross Platform Makefile Generator Copyright 2000-2009 Kitware, Inc. Distributed under the OSI-approved BSD License (the "License"); see accompanying file Copyright.txt for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ #include "cmCTestUploadHandler.h" #include "cmGeneratedFileStream.h" #include "cmVersion.h" #include "cmXMLSafe.h" //---------------------------------------------------------------------------- cmCTestUploadHandler::cmCTestUploadHandler() { this->Initialize(); } //---------------------------------------------------------------------------- void cmCTestUploadHandler::Initialize() { this->Superclass::Initialize(); this->Files.clear(); } void cmCTestUploadHandler::SetFiles(const cmCTest::SetOfStrings& files) { this->Files = files; } //---------------------------------------------------------------------------- int cmCTestUploadHandler::ProcessHandler() { cmGeneratedFileStream ofs; if ( !this->CTest->OpenOutputFile(this->CTest->GetCurrentTag(), "Upload.xml", ofs)) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open Upload.xml file" << std::endl); return -1; } cmCTest::SetOfStrings::const_iterator it; ofs << "\n" << " \"?>\n" << "CTest->GetCTestConfiguration("BuildName") << "\" BuildStamp=\"" << this->CTest->GetCurrentTag() << "-" << this->CTest->GetTestModelString() << "\" Name=\"" << this->CTest->GetCTestConfiguration("Site") << "\" Generator=\"ctest" << cmVersion::GetCMakeVersion() << "\">\n"; this->CTest->AddSiteProperties(ofs); ofs << "\n"; for ( it = this->Files.begin(); it != this->Files.end(); it ++ ) { cmCTestLog(this->CTest, OUTPUT, "\tUpload file: " << it->c_str() << std::endl); ofs << "\n" << "\n"; ofs << this->CTest->Base64EncodeFile(*it); ofs << "\n\n" << "\n"; } ofs << "\n" << "\n"; return 0; }