diff --git a/test/core/ExamplesUnitTests/TribitsHelloWorld_Tests.cmake b/test/core/ExamplesUnitTests/TribitsHelloWorld_Tests.cmake index 1da097ed0..cc20316c8 100644 --- a/test/core/ExamplesUnitTests/TribitsHelloWorld_Tests.cmake +++ b/test/core/ExamplesUnitTests/TribitsHelloWorld_Tests.cmake @@ -66,6 +66,7 @@ tribits_add_advanced_test( TribitsHelloWorld_config_git_version_single_repo_one_ -DTribitsHelloWorld_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR} -DTribitsHelloWorld_ENABLE_TESTS=ON -DTribitsHelloWorld_GENERATE_REPO_VERSION_FILE=ON + -DTribitsHelloWorld_TRACE_DEPENDENCY_HANDLING_ONLY=ON -DGIT_EXECUTABLE=${${PROJECT_NAME}_TRIBITS_DIR}/python_utils/mockprogram.py ../TribitsHelloWorld PASS_REGULAR_EXPRESSION_ALL @@ -122,6 +123,7 @@ tribits_add_advanced_test( TribitsHelloWorld_config_git_version_single_repo_two_ -DTribitsHelloWorld_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR} -DTribitsHelloWorld_ENABLE_TESTS=ON -DTribitsHelloWorld_GENERATE_REPO_VERSION_FILE=ON + -DTribitsHelloWorld_TRACE_DEPENDENCY_HANDLING_ONLY=ON -DTribitsHelloWorld_SHOW_GIT_COMMIT_PARENTS=ON -DGIT_EXECUTABLE=${${PROJECT_NAME}_TRIBITS_DIR}/python_utils/mockprogram.py ../TribitsHelloWorld diff --git a/test/ctest_driver/TribitsExampleMetaProject/CMakeLists.txt b/test/ctest_driver/TribitsExampleMetaProject/CMakeLists.txt index b07cf610e..d2e02af84 100644 --- a/test/ctest_driver/TribitsExampleMetaProject/CMakeLists.txt +++ b/test/ctest_driver/TribitsExampleMetaProject/CMakeLists.txt @@ -124,6 +124,7 @@ tribits_add_advanced_test( CTestDriver_TribitsExMetaProj_clone_default_branch_re ${COMMON_ENV_ARGS} TribitsExMetaProj_ENABLE_SECONDARY_TESTED_CODE=TRUE CTEST_BUILD_NAME=CTestDriver_TribitsExMetaProj_clone_default_branch_remote + TribitsExMetaProj_EXTRA_CONFIGURE_OPTIONS=-DTribitsExMetaProj_SHOW_GIT_COMMIT_PARENTS=ON CTEST_SITE=CustomSite ${CTEST_S_SCRIPT_ARGS} PASS_REGULAR_EXPRESSION_ALL @@ -262,7 +263,7 @@ tribits_add_advanced_test( CTestDriver_TribitsExMetaProj_clone_default_branch_re TEST_8 MESSAGE "Make sure that the file TribitsExMetaProjRepoVersion.txt is correct" CMND diff ARGS - "${CMAKE_CURRENT_LIST_DIR}/data/TribitsExMetaProjRepoVersion.for-testing.txt" + "${CMAKE_CURRENT_LIST_DIR}/data/TribitsExMetaProjRepoVersion.for-testing.with-parents.txt" BUILD/TribitsExMetaProjRepoVersion.txt ALWAYS_FAIL_ON_NONZERO_RETURN @@ -320,7 +321,7 @@ tribits_add_advanced_test( CTestDriver_TribitsExMetaProj_clone_default_branch_re TEST_12 MESSAGE "Make sure that the file TribitsExMetaProjRepoVersion.txt is correct" CMND diff ARGS - "${CMAKE_CURRENT_LIST_DIR}/data/TribitsExMetaProjRepoVersion.for-testing.txt" + "${CMAKE_CURRENT_LIST_DIR}/data/TribitsExMetaProjRepoVersion.for-testing.with-parents.txt" BUILD/TribitsExMetaProjRepoVersion.txt ALWAYS_FAIL_ON_NONZERO_RETURN diff --git a/test/ctest_driver/TribitsExampleMetaProject/data/TribitsExMetaProjRepoVersion.for-testing.with-parents.txt b/test/ctest_driver/TribitsExampleMetaProject/data/TribitsExMetaProjRepoVersion.for-testing.with-parents.txt new file mode 100644 index 000000000..7876d61b3 --- /dev/null +++ b/test/ctest_driver/TribitsExampleMetaProject/data/TribitsExMetaProjRepoVersion.for-testing.with-parents.txt @@ -0,0 +1,27 @@ +*** Base Git Repo: TribitsExMetaProj +863461e [Tue Sep 14 15:05:31 2021 -0600] +Merge branch 'tribits-github-snapshot' (TriBITSPub/TriBITS#299) + *** Parent 1: + e12aad9 [Fri Dec 11 16:17:18 2020 -0700] + Merge branch 'tribits-github-snapshot' (TriBITSPub/TriBITS#309) + *** Parent 2: + ed38a1f [Tue Sep 14 15:04:06 2021 -0600] + Automatic snapshot commit from TribitsExampleMetaProject at d1e4913 +*** Git Repo: TribitsExampleProject +94c2b12 [Tue Sep 14 15:18:55 2021 -0600] +Merge branch 'tribits-github-snapshot' (TriBITSPub/TriBITS#299) + *** Parent 1: + 59c7057 [Fri Dec 11 16:23:46 2020 -0700] + Merge branch 'tribits-github-snapshot' + *** Parent 2: + da4197f [Tue Sep 14 15:11:39 2021 -0600] + Automatic snapshot commit from TribitsExampleProject at d95ddbd +*** Git Repo: TribitsExampleProjectAddons +d846ae1 [Tue Sep 14 15:23:39 2021 -0600] +Merge branch 'tribits-github-snapshot' (TriBITSPub/TriBITS#299) + *** Parent 1: + 226a17e [Tue Feb 19 06:33:23 2019 -0700] + Update README file (tribitspub/tribits#278) + *** Parent 2: + 08f06bb [Tue Sep 14 15:20:24 2021 -0600] + Automatic snapshot commit from TribitsExampleProjectAddons at abb6694 diff --git a/tribits/core/package_arch/TribitsGlobalMacros.cmake b/tribits/core/package_arch/TribitsGlobalMacros.cmake index 739d1a53d..83c60cd5b 100644 --- a/tribits/core/package_arch/TribitsGlobalMacros.cmake +++ b/tribits/core/package_arch/TribitsGlobalMacros.cmake @@ -39,6 +39,8 @@ # Standard TriBITS system includes +include("${CMAKE_CURRENT_LIST_DIR}/../utils/TribitsGitRepoVersionInfo.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/../common/TribitsConstants.cmake") include("${CMAKE_CURRENT_LIST_DIR}/../test_support/TribitsTestCategories.cmake") @@ -53,7 +55,6 @@ include(TribitsGetVersionDate) include(TribitsReportInvalidTribitsUsage) include(TribitsReadAllProjectDepsFilesCreateDepsGraph) include(TribitsAdjustPackageEnables) -include(TribitsGitRepoVersionInfo) include(TribitsSetUpEnabledOnlyDependencies) include(TribitsConfigureTiming) @@ -685,13 +686,8 @@ macro(tribits_define_global_options_and_define_extra_repos) CACHE BOOL "Generate the ${PROJECT_NAME}RepoVersion.txt file.") - if ("${${PROJECT_NAME}_SHOW_GIT_COMMIT_PARENTS_DEFAULT}" STREQUAL "") - set(${PROJECT_NAME}_SHOW_GIT_COMMIT_PARENTS_DEFAULT OFF) - endif() - advanced_set(${PROJECT_NAME}_SHOW_GIT_COMMIT_PARENTS - ${${PROJECT_NAME}_SHOW_GIT_COMMIT_PARENTS_DEFAULT} - CACHE BOOL - "Show parents' commit info in the repo version output.") + tribits_advanced_set_cache_var_and_default(${PROJECT_NAME}_SHOW_GIT_COMMIT_PARENTS + BOOL OFF "Show parents' commit info in the repo version output.") if ("${${PROJECT_NAME}_GENERATE_VERSION_DATE_FILES_DEFAULT}" STREQUAL "") set(${PROJECT_NAME}_GENERATE_VERSION_DATE_FILES_DEFAULT OFF) @@ -1215,53 +1211,41 @@ endmacro() # Get the versions of all the git repos # -function(tribits_generate_repo_version_file_string PROJECT_REPO_VERSION_FILE_STRING_OUT) +function(tribits_generate_repo_version_file_string projectRepoVersionFileStrOut) - set(REPO_VERSION_FILE_STR "") + set(projectRepoVersionFileStr "") - if (${${PROJECT_NAME}_SHOW_GIT_COMMIT_PARENTS}) - tribits_generate_single_repo_version_string( - ${CMAKE_CURRENT_SOURCE_DIR} - SINGLE_REPO_VERSION INCLUDE_COMMIT_PARENTS) - else() - tribits_generate_single_repo_version_string( - ${CMAKE_CURRENT_SOURCE_DIR} SINGLE_REPO_VERSION) - endif() - string(APPEND REPO_VERSION_FILE_STR + tribits_generate_single_repo_version_string( + ${CMAKE_CURRENT_SOURCE_DIR} singleRepoVersionStr + INCLUDE_COMMIT_PARENTS ${${PROJECT_NAME}_SHOW_GIT_COMMIT_PARENTS}) + string(APPEND projectRepoVersionFileStr "*** Base Git Repo: ${PROJECT_NAME}\n" - "${SINGLE_REPO_VERSION}\n" ) + "${singleRepoVersionStr}\n" ) - set(EXTRAREPO_IDX 0) - foreach(EXTRA_REPO ${${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES}) - - #print_var(EXTRA_REPO) - #print_var(EXTRAREPO_IDX) - #print_var(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS) + set(extraRepoIdx 0) + foreach(extraRepo ${${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES}) if (${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS) # Read from an extra repo file with potentially different dir. - list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS ${EXTRAREPO_IDX} - EXTRAREPO_DIR ) + list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS ${extraRepoIdx} + extraRepoDir ) else() # Not read from extra repo file so dir is same as name - set(EXTRAREPO_DIR ${EXTRA_REPO}) + set(extraRepoDir ${extraRepo}) endif() - #print_var(EXTRAREPO_DIR) tribits_generate_single_repo_version_string( - "${CMAKE_CURRENT_SOURCE_DIR}/${EXTRAREPO_DIR}" - SINGLE_REPO_VERSION) - string(APPEND REPO_VERSION_FILE_STR - "*** Git Repo: ${EXTRAREPO_DIR}\n" - "${SINGLE_REPO_VERSION}\n" ) - - #print_var(REPO_VERSION_FILE_STR) + "${CMAKE_CURRENT_SOURCE_DIR}/${extraRepoDir}" singleRepoVersionStr + INCLUDE_COMMIT_PARENTS ${${PROJECT_NAME}_SHOW_GIT_COMMIT_PARENTS}) + string(APPEND projectRepoVersionFileStr + "*** Git Repo: ${extraRepoDir}\n" + "${singleRepoVersionStr}\n" ) - math(EXPR EXTRAREPO_IDX "${EXTRAREPO_IDX}+1") + math(EXPR extraRepoIdx "${extraRepoIdx}+1") endforeach() - set(${PROJECT_REPO_VERSION_FILE_STRING_OUT} ${REPO_VERSION_FILE_STR} PARENT_SCOPE) + set(${projectRepoVersionFileStrOut} ${projectRepoVersionFileStr} PARENT_SCOPE) endfunction() @@ -1273,17 +1257,17 @@ endfunction() # function(tribits_generate_repo_version_output_and_file) # Get the repos versions - tribits_generate_repo_version_file_string(PROJECT_REPO_VERSION_FILE_STRING) + tribits_generate_repo_version_file_string(projectRepoVersionFileStr) # Print the versions message("\n${PROJECT_NAME} repos versions:\n" "--------------------------------------------------------------------------------\n" - "${PROJECT_REPO_VERSION_FILE_STRING}" + "${projectRepoVersionFileStr}" " --------------------------------------------------------------------------------\n" ) #) Write out the version file file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${${PROJECT_NAME}_REPO_VERSION_FILE_NAME}" - "${PROJECT_REPO_VERSION_FILE_STRING}") + "${projectRepoVersionFileStr}") endfunction() diff --git a/tribits/core/package_arch/TribitsGitRepoVersionInfo.cmake b/tribits/core/utils/TribitsGitRepoVersionInfo.cmake similarity index 96% rename from tribits/core/package_arch/TribitsGitRepoVersionInfo.cmake rename to tribits/core/utils/TribitsGitRepoVersionInfo.cmake index 588ee720b..f7b20ff5b 100644 --- a/tribits/core/package_arch/TribitsGitRepoVersionInfo.cmake +++ b/tribits/core/utils/TribitsGitRepoVersionInfo.cmake @@ -106,16 +106,16 @@ function(tribits_git_repo_sha1 gitRepoDir gitRepoSha1Out) endfunction() -# @FUNCTION: tribits_generate_single_repo_version_string +# @FUNCTION: tribits_generate_single_repo_version_string() # # Get the formatted string containing the current git repo version. # # Usage: # # tribits_generate_single_repo_version_string( -# INCLUDE_PARENT_COMMITS [ON|OFF]) +# [INCLUDE_PARENT_COMMITS ON|OFF]) # -# If the optional argument ``INCLUDE_PARENT_COMMITS`` is passed, +# If the optional argument ``INCLUDE_PARENT_COMMITS `` is passed, # then the head commit's parent(s) info will be be included in # the repo version output string formatted. # @@ -124,8 +124,8 @@ function(tribits_generate_single_repo_version_string gitRepoDir ) cmake_parse_arguments( PARSE_ARGV 2 - PARSE "INCLUDE_COMMIT_PARENTS" # prefix, optional - "" "" # one_value_keywords, multi_value_keyword + PARSE "" # prefix, optional + "INCLUDE_COMMIT_PARENTS" "" # one_value_keywords, multi_value_keyword ) tribits_check_for_unparsed_arguments() tribits_assert_parse_arg_zero_or_one_value(PARSE INCLUDE_COMMIT_PARENTS) diff --git a/tribits/ctest_driver/TribitsAddDashboardTarget.cmake b/tribits/ctest_driver/TribitsAddDashboardTarget.cmake index 52851ce3c..6b60d3912 100644 --- a/tribits/ctest_driver/TribitsAddDashboardTarget.cmake +++ b/tribits/ctest_driver/TribitsAddDashboardTarget.cmake @@ -45,7 +45,7 @@ # ################################################################################ -include(TribitsGitRepoVersionInfo) +include("${CMAKE_CURRENT_LIST_DIR}/../core/utils/TribitsGitRepoVersionInfo.cmake") # # Macro that drives a experimental 'dashboard' target diff --git a/tribits/ctest_driver/TribitsCTestDriverCore.cmake b/tribits/ctest_driver/TribitsCTestDriverCore.cmake index 1666f5755..8e6ecfde5 100644 --- a/tribits/ctest_driver/TribitsCTestDriverCore.cmake +++ b/tribits/ctest_driver/TribitsCTestDriverCore.cmake @@ -669,11 +669,11 @@ include(TribitsCTestDriverCoreHelpers) # **Setting variables in the inner CMake configure:** # # It is important to understand that none of the CMake vars that get set in -# the other CTest -S program that calls ``tribits_ctest_driver()`` +# the outer CTest -S program that calls ``tribits_ctest_driver()`` # automatically get passed into the inner configure of the TriBITS CMake # project using the ``ctest_configure()`` command by CMake. From the # perspective of raw CTest and CMake, these are completely separate programs. -# However, the ``tribits_ctest_driver()`` function will forward subset of +# However, the ``tribits_ctest_driver()`` function will forward subset a of # variables documented below into the inner CMake configure. The following # variables that are set in the outer CTest -S program will be passed into the # inner CMake configure by default (but their values they can be overridden by @@ -684,7 +684,7 @@ include(TribitsCTestDriverCoreHelpers) # # Missing extra repos are always ignored in the inner CMake configure. # This is because any problems reading an extra repo will be caught in the -# outer CTest -S drivers script. +# outer CTest -S driver script. # # ``-D${PROJECT_NAME}_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=ON`` # @@ -699,7 +699,7 @@ include(TribitsCTestDriverCoreHelpers) # may be disabled. (This set may be removed in the future for the # all-at-once mode.) # -# The following variables set in the CTest -S driver script will be passed +# The following variables set in the outer CTest -S driver script will be passed # down into the inner CMake configure through the ``OPTIONS`` variable to the # ``ctest_configure()`` command: # @@ -758,7 +758,7 @@ include(TribitsCTestDriverCoreHelpers) # These configure options are passed into the ``ctest_configure()`` command in # the order:: # -# ${EXTRA_SYSTEM_CONFIGURE_OPTIONS}} \ +# ${EXTRA_SYSTEM_CONFIGURE_OPTIONS}} \ # ${EXTRA_CONFIGURE_OPTIONS} ${${PROJECT_NAME}_EXTRA_CONFIGURE_OPTIONS} # # **WARNING:** The options listed in ``EXTRA_SYSTEM_CONFIGURE_OPTIONS``, diff --git a/tribits/doc/build_ref/TribitsBuildReferenceBody.rst b/tribits/doc/build_ref/TribitsBuildReferenceBody.rst index 92817594c..3ab4ce13f 100644 --- a/tribits/doc/build_ref/TribitsBuildReferenceBody.rst +++ b/tribits/doc/build_ref/TribitsBuildReferenceBody.rst @@ -376,6 +376,7 @@ See the following use cases: * `Enable all packages (and optionally all tests)`_ * `Disable a package and all its dependencies`_ * `Remove all package enables in the cache`_ +* `Speed up debugging dependency handling`_ Determine the list of packages that can be enabled @@ -656,6 +657,22 @@ For example, one would want to do this to avoid more expensive compiler and TPL checks. +Speed up debugging dependency handling ++++++++++++++++++++++++++++++++++++++++ + +To speed up debugging the package enable/disable dependency handling, set the +cache variable:: + + -D _TRACE_DEPENDENCY_HANDLING_ONLY=ON + +This will result in only performing the package enable/disable dependency +handling logic and tracing what would be done to configure the compilers and +configure the various enabled packages but not actually do that work. This +can greatly speed up the time to complete the ``cmake`` configure command when +debugging the dependency handling (or when creating tests that check that +behavior). + + Selecting compiler and linker options ------------------------------------- diff --git a/tribits/doc/guides/TribitsCoreDetailedReference.rst b/tribits/doc/guides/TribitsCoreDetailedReference.rst index 7fbad8103..aa443415c 100644 --- a/tribits/doc/guides/TribitsCoreDetailedReference.rst +++ b/tribits/doc/guides/TribitsCoreDetailedReference.rst @@ -88,6 +88,7 @@ a given TriBITS project are: * `${PROJECT_NAME}_MUST_FIND_ALL_TPL_LIBS`_ * `${PROJECT_NAME}_REQUIRES_PYTHON`_ * `${PROJECT_NAME}_SET_INSTALL_RPATH`_ +* `${PROJECT_NAME}_SHOW_GIT_COMMIT_PARENTS`_ * `${PROJECT_NAME}_SHOW_TEST_START_END_DATE_TIME`_ * `${PROJECT_NAME}_SKIP_INSTALL_PROJECT_CMAKE_CONFIG_FILES`_ * `${PROJECT_NAME}_TEST_CATEGORIES`_ @@ -651,6 +652,21 @@ These options are described below. Handling`_). +.. _${PROJECT_NAME}_SHOW_GIT_COMMIT_PARENTS: + +**${PROJECT_NAME}_SHOW_GIT_COMMIT_PARENTS** + + The cache variable ``${PROJECT_NAME}_SHOW_GIT_COMMIT_PARENTS`` results in + the repo version file showing the parent commits for each repo commit. By + default, this variable is set to ``OFF`` but projects can set to to ``ON`` + by default by setting:: + + set(${PROJECT_NAME}_SHOW_GIT_COMMIT_PARENTS_DEFAULT ON) + + in the project's ``ProjectName.cmake`` file. (That way, it will also impact + ``cmake -P`` scripts don't configure the project itself to be built.) + + .. _${PROJECT_NAME}_SHOW_TEST_START_END_DATE_TIME: **${PROJECT_NAME}_SHOW_TEST_START_END_DATE_TIME**