cmCTestUpdateCommand.cxx 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 "cmCTestUpdateCommand.h"
  4. #include "cmCTest.h"
  5. #include "cmCTestUpdateHandler.h"
  6. #include "cmMakefile.h"
  7. #include "cmSystemTools.h"
  8. #include <vector>
  9. cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler()
  10. {
  11. if (this->Values[ct_SOURCE]) {
  12. this->CTest->SetCTestConfiguration(
  13. "SourceDirectory",
  14. cmSystemTools::CollapseFullPath(this->Values[ct_SOURCE]).c_str(),
  15. this->Quiet);
  16. } else {
  17. this->CTest->SetCTestConfiguration(
  18. "SourceDirectory",
  19. cmSystemTools::CollapseFullPath(
  20. this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY"))
  21. .c_str(),
  22. this->Quiet);
  23. }
  24. std::string source_dir =
  25. this->CTest->GetCTestConfiguration("SourceDirectory");
  26. this->CTest->SetCTestConfigurationFromCMakeVariable(
  27. this->Makefile, "UpdateCommand", "CTEST_UPDATE_COMMAND", this->Quiet);
  28. this->CTest->SetCTestConfigurationFromCMakeVariable(
  29. this->Makefile, "UpdateOptions", "CTEST_UPDATE_OPTIONS", this->Quiet);
  30. this->CTest->SetCTestConfigurationFromCMakeVariable(
  31. this->Makefile, "CVSCommand", "CTEST_CVS_COMMAND", this->Quiet);
  32. this->CTest->SetCTestConfigurationFromCMakeVariable(
  33. this->Makefile, "CVSUpdateOptions", "CTEST_CVS_UPDATE_OPTIONS",
  34. this->Quiet);
  35. this->CTest->SetCTestConfigurationFromCMakeVariable(
  36. this->Makefile, "SVNCommand", "CTEST_SVN_COMMAND", this->Quiet);
  37. this->CTest->SetCTestConfigurationFromCMakeVariable(
  38. this->Makefile, "SVNUpdateOptions", "CTEST_SVN_UPDATE_OPTIONS",
  39. this->Quiet);
  40. this->CTest->SetCTestConfigurationFromCMakeVariable(
  41. this->Makefile, "SVNOptions", "CTEST_SVN_OPTIONS", this->Quiet);
  42. this->CTest->SetCTestConfigurationFromCMakeVariable(
  43. this->Makefile, "BZRCommand", "CTEST_BZR_COMMAND", this->Quiet);
  44. this->CTest->SetCTestConfigurationFromCMakeVariable(
  45. this->Makefile, "BZRUpdateOptions", "CTEST_BZR_UPDATE_OPTIONS",
  46. this->Quiet);
  47. this->CTest->SetCTestConfigurationFromCMakeVariable(
  48. this->Makefile, "GITCommand", "CTEST_GIT_COMMAND", this->Quiet);
  49. this->CTest->SetCTestConfigurationFromCMakeVariable(
  50. this->Makefile, "GITUpdateOptions", "CTEST_GIT_UPDATE_OPTIONS",
  51. this->Quiet);
  52. this->CTest->SetCTestConfigurationFromCMakeVariable(
  53. this->Makefile, "GITInitSubmodules", "CTEST_GIT_INIT_SUBMODULES",
  54. this->Quiet);
  55. this->CTest->SetCTestConfigurationFromCMakeVariable(
  56. this->Makefile, "GITUpdateCustom", "CTEST_GIT_UPDATE_CUSTOM", this->Quiet);
  57. this->CTest->SetCTestConfigurationFromCMakeVariable(
  58. this->Makefile, "UpdateVersionOnly", "CTEST_UPDATE_VERSION_ONLY",
  59. this->Quiet);
  60. this->CTest->SetCTestConfigurationFromCMakeVariable(
  61. this->Makefile, "UpdateVersionOverride", "CTEST_UPDATE_VERSION_OVERRIDE",
  62. this->Quiet);
  63. this->CTest->SetCTestConfigurationFromCMakeVariable(
  64. this->Makefile, "HGCommand", "CTEST_HG_COMMAND", this->Quiet);
  65. this->CTest->SetCTestConfigurationFromCMakeVariable(
  66. this->Makefile, "HGUpdateOptions", "CTEST_HG_UPDATE_OPTIONS", this->Quiet);
  67. this->CTest->SetCTestConfigurationFromCMakeVariable(
  68. this->Makefile, "P4Command", "CTEST_P4_COMMAND", this->Quiet);
  69. this->CTest->SetCTestConfigurationFromCMakeVariable(
  70. this->Makefile, "P4UpdateOptions", "CTEST_P4_UPDATE_OPTIONS", this->Quiet);
  71. this->CTest->SetCTestConfigurationFromCMakeVariable(
  72. this->Makefile, "P4Client", "CTEST_P4_CLIENT", this->Quiet);
  73. this->CTest->SetCTestConfigurationFromCMakeVariable(
  74. this->Makefile, "P4Options", "CTEST_P4_OPTIONS", this->Quiet);
  75. cmCTestUpdateHandler* handler = this->CTest->GetUpdateHandler();
  76. handler->Initialize();
  77. handler->SetCommand(this);
  78. if (source_dir.empty()) {
  79. this->SetError("source directory not specified. Please use SOURCE tag");
  80. return nullptr;
  81. }
  82. handler->SetOption("SourceDirectory", source_dir.c_str());
  83. handler->SetQuiet(this->Quiet);
  84. return handler;
  85. }