cmCTestUpdateCommand.cxx 3.9 KB

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