cmCTestUploadCommand.cxx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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/string_view>
  7. #include <cm/vector>
  8. #include <cmext/string_view>
  9. #include "cmCTest.h"
  10. #include "cmCTestUploadHandler.h"
  11. #include "cmMakefile.h"
  12. #include "cmMessageType.h"
  13. #include "cmSystemTools.h"
  14. void cmCTestUploadCommand::BindArguments()
  15. {
  16. this->Bind("FILES"_s, this->Files);
  17. this->Bind("QUIET"_s, this->Quiet);
  18. this->Bind("CAPTURE_CMAKE_ERROR"_s, this->CaptureCMakeError);
  19. }
  20. void cmCTestUploadCommand::CheckArguments(std::vector<cm::string_view> const&)
  21. {
  22. cm::erase_if(this->Files, [this](std::string const& arg) -> bool {
  23. if (!cmSystemTools::FileExists(arg)) {
  24. std::ostringstream e;
  25. e << "File \"" << arg << "\" does not exist. Cannot submit "
  26. << "a non-existent file.";
  27. this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
  28. return true;
  29. }
  30. return false;
  31. });
  32. }
  33. cmCTestGenericHandler* cmCTestUploadCommand::InitializeHandler()
  34. {
  35. cmCTestUploadHandler* handler = this->CTest->GetUploadHandler();
  36. handler->Initialize();
  37. handler->SetFiles(
  38. std::set<std::string>(this->Files.begin(), this->Files.end()));
  39. handler->SetQuiet(this->Quiet);
  40. return handler;
  41. }