Skip to content

Commit

Permalink
Improve printing and documentation on missing packages (TriBITSPub#63)
Browse files Browse the repository at this point in the history
Noticed this while working on earlier commits.
  • Loading branch information
bartlettroscoe committed Oct 9, 2023
1 parent ca31001 commit eaad800
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 25 deletions.
33 changes: 31 additions & 2 deletions test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ tribits_add_advanced_test( TribitsExampleProject_NoFortran_reduced_tarball
ARGS -E make_directory tribitsexproj-1.1-Source/packages/mixed_lang

TEST_5
MESSAGE "Configure from the untarred reduced source tree"
MESSAGE "Configure from the untarred reduced source tree warning about missing packages and test tribits_disable_optional_dependency()"
WORKING_DIRECTORY BUILD2
CMND ${CMAKE_COMMAND}
ARGS
Expand Down Expand Up @@ -652,6 +652,35 @@ tribits_add_advanced_test( TribitsExampleProject_NoFortran_reduced_tarball
ALWAYS_FAIL_ON_NONZERO_RETURN

TEST_6
MESSAGE "Configure from the untarred reduced source tree only noting missing packages to test that"
WORKING_DIRECTORY BUILD2
CMND ${CMAKE_COMMAND}
ARGS
${TribitsExampleProject_COMMON_CONFIG_ARGS}
-DTribitsExProj_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DTribitsExProj_ENABLE_Fortran=OFF
-DTribitsExProj_ENABLE_SECONDARY_TESTED_CODE=ON
-DTribitsExProj_ENABLE_ALL_PACKAGES=ON
-DTribitsExProj_ENABLE_TESTS=ON
-DTribitsExProj_ASSERT_DEFINED_DEPENDENCIES=OFF
-DTribitsExProj_WARN_ABOUT_MISSING_EXTERNAL_PACKAGES=ON
../tribitsexproj-1.1-Source
PASS_REGULAR_EXPRESSION_ALL
"-- NOTE: InsertedPkg is being ignored since its directory is missing and InsertedPkg_ALLOW_MISSING_EXTERNAL_PACKAGE = TRUE"
"-- NOTE: MixedLang is being ignored since its directory is missing and TribitsExProj_ASSERT_DEFINED_DEPENDENCIES = OFF"
"Final set of enabled top-level packages: SimpleCxx WithSubpackages 2"
"Final set of enabled packages: SimpleCxx WithSubpackagesA WithSubpackagesB WithSubpackages 4"
"Final set of non-enabled top-level packages: 0"
"Final set of non-enabled packages: 0"
"Processing enabled top-level package: SimpleCxx [(]Libs, Tests, Examples[)]"
"Processing enabled top-level package: WithSubpackages [(]A, B, Tests, Examples[)]"
"-- Configuring done"
"-- Generating done"
ALWAYS_FAIL_ON_NONZERO_RETURN

TEST_7
MESSAGE "Build reduced project default 'all' target using raw 'make'"
WORKING_DIRECTORY BUILD2
SKIP_CLEAN_WORKING_DIRECTORY
Expand All @@ -662,7 +691,7 @@ tribits_add_advanced_test( TribitsExampleProject_NoFortran_reduced_tarball
"Built target pws_b"
ALWAYS_FAIL_ON_NONZERO_RETURN

TEST_7
TEST_8
MESSAGE "Run all the tests in reduced project with raw 'ctest'"
WORKING_DIRECTORY BUILD2
SKIP_CLEAN_WORKING_DIRECTORY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ function(unittest_extra_repo_missing_optional_package_verbose)
tribits_read_deps_files_create_deps_graph()

unittest_compare_const(MESSAGE_WRAPPER_INPUT
"NOTE: MissingUpstreamPackage is being ignored since its directory; is missing and MissingUpstreamPackage_ALLOW_MISSING_EXTERNAL_PACKAGE =; TRUE!;-- ;Trilinos_NUM_DEFINED_INTERNAL_PACKAGES='4'")
"-- NOTE: MissingUpstreamPackage is being ignored since its directory; is missing and MissingUpstreamPackage_ALLOW_MISSING_EXTERNAL_PACKAGE =; TRUE!;-- ;Trilinos_NUM_DEFINED_INTERNAL_PACKAGES='4'")
unittest_compare_const( ${PROJECT_NAME}_DEFINED_INTERNAL_TOPLEVEL_PACKAGES
"Teuchos;RTOp;Ex2Package1;Ex2Package2")
unittest_compare_const(${PROJECT_NAME}_ENABLE_Ex2Package1 "")
Expand Down
40 changes: 27 additions & 13 deletions tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -571,19 +571,8 @@ macro(tribits_set_dep_packages__handle_undefined_pkg packageName depPkg
if (errorOutForUndefinedDepPkg)
tribits_abort_on_missing_package("${depPkg}" "${packageName}")
else()
if (${depPkg}_ALLOW_MISSING_EXTERNAL_PACKAGE)
if (${PROJECT_NAME}_WARN_ABOUT_MISSING_EXTERNAL_PACKAGES)
message_wrapper("NOTE: ${depPkg} is being ignored since its directory"
" is missing and ${depPkg}_ALLOW_MISSING_EXTERNAL_PACKAGE ="
" ${${depPkg}_ALLOW_MISSING_EXTERNAL_PACKAGE}!")
endif()
if ("${requiredOrOptional}" STREQUAL "REQUIRED")
message_wrapper("NOTE: Setting ${packageEnableVar}=OFF because"
" package ${packageName} has a required dependency on missing"
" package ${depPkg}!")
set(${packageEnableVar} OFF)
endif()
endif()
tribits_warn_about_ignored_missing_pkg_dep("${packageName}" "${depPkg}"
"${requiredOrOptional}" "${packageEnableVar}" )
# Must set enable vars for missing package to off so that logic in
# existing downstream packages that key off of these vars will still
# work.
Expand All @@ -596,6 +585,31 @@ macro(tribits_set_dep_packages__handle_undefined_pkg packageName depPkg
endmacro()


function(tribits_warn_about_ignored_missing_pkg_dep packageName depPkg
requiredOrOptional packageEnableVar
)
if (${PROJECT_NAME}_WARN_ABOUT_MISSING_EXTERNAL_PACKAGES)
if (${depPkg}_ALLOW_MISSING_EXTERNAL_PACKAGE)
message_wrapper("-- NOTE: ${depPkg} is being ignored since its directory"
" is missing and ${depPkg}_ALLOW_MISSING_EXTERNAL_PACKAGE ="
" ${${depPkg}_ALLOW_MISSING_EXTERNAL_PACKAGE}!")
elseif (NOT ${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES IN_LIST
${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES_ERROR_VALUES_LIST
)
message_wrapper("-- NOTE: ${depPkg} is being ignored since its directory"
" is missing and ${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES ="
" ${${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES}!")
endif()
if ("${requiredOrOptional}" STREQUAL "REQUIRED")
message_wrapper("NOTE: Setting ${packageEnableVar}=OFF because"
" package ${packageName} has a required dependency on missing"
" package ${depPkg}!")
set(${packageEnableVar} OFF)
endif()
endif()
endfunction()


# @MACRO: tribits_append_forward_dep_packages()
#
# Appends forward/downstream package dependency lists for the upstream
Expand Down
20 changes: 11 additions & 9 deletions tribits/doc/build_ref/TribitsBuildReferenceBody.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3023,9 +3023,9 @@ One of the CMake configure-time debug-mode checks performed as part of
``<Project>_ENABLE_DEVELOPMENT_MODE=ON`` is to assert the existence of TriBITS
package directories. In development mode, the failure to find a package
directory is usually a programming error (i.e. a miss-spelled package
directory name). But in a tarball release of the project, package directories
may be purposefully missing (see `Creating a tarball of the source tree`_) and
must be ignored.
directory name). But in a reduced tarball release of the project, package
directories may be purposefully missing (see `Creating a tarball of the source
tree`_) and must be ignored.

When building from a reduced source tarball created from the
development sources, set::
Expand All @@ -3043,15 +3043,17 @@ Another type of checking is for optional inserted/external packages
(e.g. packages who's source can optionally be included and is flagged with
``tribits_allow_missing_external_packages()``). Any of these package
directories that are missing result in the packages being silently ignored by
default. However, notes on what missing packages are being ignored can
printed by configuring with::
default. Also, when there are packages that are purposefully missing in a
reduced tarball build (which are allowed by setting
``<Project>_ASSERT_DEFINED_DEPENDENCIES=OFF``), these are also silently
ignored. However, notes on which of these packages are missing can be printed
to the CMAKE STDOUT by setting::

-D <Project>_WARN_ABOUT_MISSING_EXTERNAL_PACKAGES=TRUE

These warnings starting with 'NOTE' (not starting with 'WARNING' that would
otherwise trigger warnings in CDash) about missing inserted/external packages
will print regardless of the setting for
``<Project>_ASSERT_DEFINED_DEPENDENCIES``.
These STDOUT lines starting with 'NOTE' (not starting with 'WARNING' that
would otherwise trigger warnings in CDash) about missing packages will print
regardless of the setting for ``<Project>_ASSERT_DEFINED_DEPENDENCIES``.

Finally, ``<Project>_ENABLE_DEVELOPMENT_MODE=ON`` results in a number of
checks for invalid usage of TriBITS in the project's ``CMakeLists.txt`` files
Expand Down

0 comments on commit eaad800

Please sign in to comment.