cmake/Source/CTest/cmCTestUploadCommand.cxx

47 lines
1.3 KiB
C++
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
2011-06-19 15:41:06 +03:00
#include "cmCTestUploadCommand.h"
2020-02-01 23:06:01 +01:00
#include <set>
2017-04-14 19:02:05 +02:00
#include <sstream>
2020-08-30 11:54:41 +02:00
#include <cm/vector>
#include <cmext/string_view>
2020-02-01 23:06:01 +01:00
2011-06-19 15:41:06 +03:00
#include "cmCTest.h"
#include "cmCTestUploadHandler.h"
2016-10-30 18:24:19 +01:00
#include "cmMakefile.h"
2019-11-11 23:01:05 +01:00
#include "cmMessageType.h"
2016-10-30 18:24:19 +01:00
#include "cmSystemTools.h"
2020-02-01 23:06:01 +01:00
void cmCTestUploadCommand::BindArguments()
2011-06-19 15:41:06 +03:00
{
2020-02-01 23:06:01 +01:00
this->Bind("FILES"_s, this->Files);
this->Bind("QUIET"_s, this->Quiet);
this->Bind("CAPTURE_CMAKE_ERROR"_s, this->CaptureCMakeError);
2011-06-19 15:41:06 +03:00
}
2022-11-16 20:14:03 +01:00
void cmCTestUploadCommand::CheckArguments()
2011-06-19 15:41:06 +03:00
{
2020-08-30 11:54:41 +02:00
cm::erase_if(this->Files, [this](std::string const& arg) -> bool {
2020-02-01 23:06:01 +01:00
if (!cmSystemTools::FileExists(arg)) {
std::ostringstream e;
e << "File \"" << arg << "\" does not exist. Cannot submit "
<< "a non-existent file.";
this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
2011-06-19 15:41:06 +03:00
return true;
}
2016-10-30 18:24:19 +01:00
return false;
2020-02-01 23:06:01 +01:00
});
}
2011-06-19 15:41:06 +03:00
2020-02-01 23:06:01 +01:00
cmCTestGenericHandler* cmCTestUploadCommand::InitializeHandler()
{
cmCTestUploadHandler* handler = this->CTest->GetUploadHandler();
handler->Initialize();
handler->SetFiles(
std::set<std::string>(this->Files.begin(), this->Files.end()));
handler->SetQuiet(this->Quiet);
return handler;
2011-06-19 15:41:06 +03:00
}