cmCTestUploadCommand.cxx 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #include "cmCTestUploadCommand.h"
  11. #include "cmCTest.h"
  12. #include "cmCTestGenericHandler.h"
  13. #include "cmCTestUploadHandler.h"
  14. cmCTestGenericHandler* cmCTestUploadCommand::InitializeHandler()
  15. {
  16. cmCTestGenericHandler* handler =
  17. this->CTest->GetInitializedHandler("upload");
  18. if (!handler) {
  19. this->SetError("internal CTest error. Cannot instantiate upload handler");
  20. return CM_NULLPTR;
  21. }
  22. static_cast<cmCTestUploadHandler*>(handler)->SetFiles(this->Files);
  23. handler->SetQuiet(this->Quiet);
  24. return handler;
  25. }
  26. bool cmCTestUploadCommand::CheckArgumentKeyword(std::string const& arg)
  27. {
  28. if (arg == "FILES") {
  29. this->ArgumentDoing = ArgumentDoingFiles;
  30. return true;
  31. }
  32. if (arg == "QUIET") {
  33. this->ArgumentDoing = ArgumentDoingNone;
  34. this->Quiet = true;
  35. return true;
  36. }
  37. return false;
  38. }
  39. bool cmCTestUploadCommand::CheckArgumentValue(std::string const& arg)
  40. {
  41. if (this->ArgumentDoing == ArgumentDoingFiles) {
  42. if (cmSystemTools::FileExists(arg.c_str())) {
  43. this->Files.insert(arg);
  44. return true;
  45. } else {
  46. std::ostringstream e;
  47. e << "File \"" << arg << "\" does not exist. Cannot submit "
  48. << "a non-existent file.";
  49. this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
  50. this->ArgumentDoing = ArgumentDoingError;
  51. return false;
  52. }
  53. }
  54. // Look for other arguments.
  55. return this->Superclass::CheckArgumentValue(arg);
  56. }