2011-02-18 20:11:51 +03:00
|
|
|
/*============================================================================
|
|
|
|
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;
|
|
|
|
}
|
2014-08-14 01:58:05 +04:00
|
|
|
std::string buildname = cmCTest::SafeBuildIdField(
|
|
|
|
this->CTest->GetCTestConfiguration("BuildName"));
|
2011-02-18 20:11:51 +03:00
|
|
|
cmCTest::SetOfStrings::const_iterator it;
|
|
|
|
ofs << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
|
|
|
<< "<?xml-stylesheet type=\"text/xsl\" "
|
|
|
|
"href=\"Dart/Source/Server/XSL/Build.xsl "
|
|
|
|
"<file:///Dart/Source/Server/XSL/Build.xsl> \"?>\n"
|
|
|
|
<< "<Site BuildName=\""
|
2014-08-14 01:58:05 +04:00
|
|
|
<< buildname
|
2011-02-18 20:11:51 +03:00
|
|
|
<< "\" BuildStamp=\""
|
|
|
|
<< this->CTest->GetCurrentTag() << "-"
|
|
|
|
<< this->CTest->GetTestModelString() << "\" Name=\""
|
|
|
|
<< this->CTest->GetCTestConfiguration("Site") << "\" Generator=\"ctest"
|
|
|
|
<< cmVersion::GetCMakeVersion()
|
|
|
|
<< "\">\n";
|
|
|
|
this->CTest->AddSiteProperties(ofs);
|
2011-02-28 18:53:38 +03:00
|
|
|
ofs << "<Upload>\n";
|
2011-02-18 20:11:51 +03:00
|
|
|
|
|
|
|
for ( it = this->Files.begin(); it != this->Files.end(); it ++ )
|
|
|
|
{
|
|
|
|
cmCTestLog(this->CTest, OUTPUT,
|
2014-03-11 16:35:32 +04:00
|
|
|
"\tUpload file: " << *it << std::endl);
|
2011-02-18 20:11:51 +03:00
|
|
|
ofs << "<File filename=\"" << cmXMLSafe(*it) << "\">\n"
|
2011-02-28 23:26:24 +03:00
|
|
|
<< "<Content encoding=\"base64\">\n";
|
|
|
|
ofs << this->CTest->Base64EncodeFile(*it);
|
2011-02-18 20:11:51 +03:00
|
|
|
ofs << "\n</Content>\n"
|
|
|
|
<< "</File>\n";
|
|
|
|
}
|
2011-02-28 18:53:38 +03:00
|
|
|
ofs << "</Upload>\n"
|
2011-02-18 20:11:51 +03:00
|
|
|
<< "</Site>\n";
|
|
|
|
return 0;
|
|
|
|
}
|