cmake/Source/CTest/cmCTestUploadCommand.cxx

69 lines
1.9 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"
2017-04-14 19:02:05 +02:00
#include <sstream>
#include <vector>
2011-06-19 15:41:06 +03:00
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
#include "cmCTestUploadHandler.h"
2016-10-30 18:24:19 +01:00
#include "cmMakefile.h"
#include "cmSystemTools.h"
#include "cmake.h"
2011-06-19 15:41:06 +03:00
cmCTestGenericHandler* cmCTestUploadCommand::InitializeHandler()
{
2016-07-09 11:21:54 +02:00
cmCTestGenericHandler* handler =
this->CTest->GetInitializedHandler("upload");
if (!handler) {
2011-06-19 15:41:06 +03:00
this->SetError("internal CTest error. Cannot instantiate upload handler");
2016-10-30 18:24:19 +01:00
return CM_NULLPTR;
2016-07-09 11:21:54 +02:00
}
2011-06-19 15:41:06 +03:00
static_cast<cmCTestUploadHandler*>(handler)->SetFiles(this->Files);
2015-08-17 11:37:30 +02:00
handler->SetQuiet(this->Quiet);
2011-06-19 15:41:06 +03:00
return handler;
}
bool cmCTestUploadCommand::CheckArgumentKeyword(std::string const& arg)
{
2016-07-09 11:21:54 +02:00
if (arg == "FILES") {
2011-06-19 15:41:06 +03:00
this->ArgumentDoing = ArgumentDoingFiles;
return true;
2016-07-09 11:21:54 +02:00
}
if (arg == "QUIET") {
2015-08-17 11:37:30 +02:00
this->ArgumentDoing = ArgumentDoingNone;
this->Quiet = true;
return true;
2016-07-09 11:21:54 +02:00
}
2016-10-30 18:24:19 +01:00
if (arg == "CAPTURE_CMAKE_ERROR") {
this->ArgumentDoing = ArgumentDoingCaptureCMakeError;
return true;
}
2011-06-19 15:41:06 +03:00
return false;
}
bool cmCTestUploadCommand::CheckArgumentValue(std::string const& arg)
{
2016-10-30 18:24:19 +01:00
if (this->ArgumentDoing == ArgumentDoingCaptureCMakeError) {
this->Values[ct_CAPTURE_CMAKE_ERROR] = arg.c_str();
return true;
}
2016-07-09 11:21:54 +02:00
if (this->ArgumentDoing == ArgumentDoingFiles) {
if (cmSystemTools::FileExists(arg.c_str())) {
this->Files.insert(arg);
2011-06-19 15:41:06 +03:00
return true;
}
2016-10-30 18:24:19 +01:00
std::ostringstream e;
e << "File \"" << arg << "\" does not exist. Cannot submit "
<< "a non-existent file.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
this->ArgumentDoing = ArgumentDoingError;
return false;
2016-07-09 11:21:54 +02:00
}
2011-06-19 15:41:06 +03:00
// Look for other arguments.
return this->Superclass::CheckArgumentValue(arg);
}