cmCTestUpdateCommand.cxx 3.9 KB

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