cmCTestUpdateCommand.cxx 4.2 KB

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