cmCTestUploadCommand.cxx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "cmCTestUploadCommand.h"
  4. #include <set>
  5. #include <sstream>
  6. #include <cm/vector>
  7. #include <cmext/string_view>
  8. #include "cmCTest.h"
  9. #include "cmCTestUploadHandler.h"
  10. #include "cmMakefile.h"
  11. #include "cmMessageType.h"
  12. #include "cmSystemTools.h"
  13. void cmCTestUploadCommand::BindArguments()
  14. {
  15. this->Bind("FILES"_s, this->Files);
  16. this->Bind("QUIET"_s, this->Quiet);
  17. this->Bind("CAPTURE_CMAKE_ERROR"_s, this->CaptureCMakeError);
  18. }
  19. void cmCTestUploadCommand::CheckArguments(std::vector<std::string> const&)
  20. {
  21. cm::erase_if(this->Files, [this](std::string const& arg) -> bool {
  22. if (!cmSystemTools::FileExists(arg)) {
  23. std::ostringstream e;
  24. e << "File \"" << arg << "\" does not exist. Cannot submit "
  25. << "a non-existent file.";
  26. this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
  27. return true;
  28. }
  29. return false;
  30. });
  31. }
  32. cmCTestGenericHandler* cmCTestUploadCommand::InitializeHandler()
  33. {
  34. cmCTestUploadHandler* handler = this->CTest->GetUploadHandler();
  35. handler->Initialize();
  36. handler->SetFiles(
  37. std::set<std::string>(this->Files.begin(), this->Files.end()));
  38. handler->SetQuiet(this->Quiet);
  39. return handler;
  40. }