Skip to content

Commit

Permalink
Change package existence logic based on exist3nce of Dependencies.cma…
Browse files Browse the repository at this point in the history
…ke file (trilinos/Trilinos#11976)

This fixes cases where a dirty/incomplete source directory for a package
remains but does not contain the Dependencies.cmake file.  This was a use case
I hit while experimenting with how to fix trilinos/Trilinos#11976.

This replaces a temp commit made to the Trilinos 'develop' branch.
  • Loading branch information
bartlettroscoe committed Jun 22, 2023
1 parent 99d3af8 commit b112e7f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
10 changes: 8 additions & 2 deletions test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,12 @@ tribits_add_advanced_test( TribitsExampleProject_NoFortran_reduced_tarball
-DTribitsExProj_ASSERT_DEFINED_DEPENDENCIES=OFF
../tribitsexproj-1.1-Source
PASS_REGULAR_EXPRESSION_ALL
"CMake Warning at .*/tribits/core/package_arch/TribitsProcessPackagesAndDirsLists.cmake"
"MixedLang: Package base directory"
"'.*/tribitsexproj-1.1-Source/packages/mixed_lang'"
"exists but the dependencies file"
"'.*/tribitsexproj-1.1-Source/packages/mixed_lang/cmake/Dependencies.cmake'"
"does [*]NOT[*] exist. Package is being ignored anyway."
"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"
Expand Down Expand Up @@ -2783,7 +2789,7 @@ tribits_add_advanced_test( TribitsExampleProject_InsertedPkg
XHOSTTYPE Darwin

TEST_0
MESSAGE "Copy TribitsExampleProject so that we can copy in ExteranlPkg."
MESSAGE "Copy TribitsExampleProject so that we can copy in ExternalPkg."
CMND cp
ARGS -r ${${PROJECT_NAME}_TRIBITS_DIR}/examples/TribitsExampleProject .

Expand All @@ -2807,7 +2813,7 @@ tribits_add_advanced_test( TribitsExampleProject_InsertedPkg
-DInsertedPkg_ALLOW_MISSING_EXTERNAL_PACKAGE=FALSE
.
PASS_REGULAR_EXPRESSION_ALL
"Error, the package InsertedPkg directory .+/TribitsExampleProject/InsertedPkg does not exist!"
"Error, the package InsertedPkg dependencies file '.+/TribitsExampleProject/InsertedPkg/cmake/Dependencies.cmake' does [*]NOT[*] exist!"
"CMake Error at .+/TribitsProcessPackagesAndDirsLists.cmake:[0-9]+ [(]message[)]:"
"Configuring incomplete, errors occurred!"

Expand Down
12 changes: 12 additions & 0 deletions tribits/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
ChangeLog for TriBITS
----------------------------------------

## 2023-06-22:

* **Added:** Packages are now determined to be missing if their dependencies
file `<packageDir>/cmake/Dependencies.cmake` is missing. If the package
directory `<packageDir>` exists but the dependencies file is missing, the
package is determined to be missing but a warning is printed. (This expands
behavior to gracefully deal with a situation where a package source
directory is only partially removed, such as with `git rm -r <packageDir>`,
but the base directory still exists. Therefore, this allows the project to
gracefully configure with the package being considered missing and avoids a
fatal error in this case.)

## 2023-06-02:

* **Added/Deprecated:** External packages/TPLs can now be (and should be)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,8 @@ macro(tribits_process_packages_and_dirs_lists REPOSITORY_NAME REPOSITORY_DIR)

endif()

if (EXISTS ${PACKAGE_ABS_DIR})
set(packageDependenciesFile "${PACKAGE_ABS_DIR}/cmake/Dependencies.cmake")
if (EXISTS "${packageDependenciesFile}")
set(PACKAGE_EXISTS TRUE)
else()
set(PACKAGE_EXISTS FALSE)
Expand All @@ -557,9 +558,14 @@ macro(tribits_process_packages_and_dirs_lists REPOSITORY_NAME REPOSITORY_DIR)
)
message(
"\n***"
"\n*** Error, the package ${TRIBITS_PACKAGE} directory ${PACKAGE_ABS_DIR} does not exist!"
"\n*** Error, the package ${TRIBITS_PACKAGE} dependencies file"
" '${packageDependenciesFile}' does *NOT* exist!"
"\n***\n" )
message(FATAL_ERROR "Stopping due to above error!")
elseif((NOT PACKAGE_EXISTS) AND (EXISTS "${PACKAGE_ABS_DIR}"))
message(WARNING "${TRIBITS_PACKAGE}: Package base directory '${PACKAGE_ABS_DIR}'"
" exists but the dependencies file '${packageDependenciesFile}' does *NOT*"
" exist! Package is being ignored anyway!")
endif()

if (PACKAGE_EXISTS OR ${PROJECT_NAME}_IGNORE_PACKAGE_EXISTS_CHECK)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ macro(tribits_read_all_package_deps_files_create_deps_graph)
set(${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES "") # Packages and subpackages

foreach(TRIBITS_PACKAGE IN LISTS ${PROJECT_NAME}_DEFINED_INTERNAL_TOPLEVEL_PACKAGES)
tribits_read_toplevel_package_deps_files_add_to_graph(${TRIBITS_PACKAGE}
${${TRIBITS_PACKAGE}_REL_SOURCE_DIR})
tribits_read_toplevel_package_deps_files_add_to_graph(${TRIBITS_PACKAGE})
endforeach()

list(LENGTH ${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES
Expand Down

0 comments on commit b112e7f

Please sign in to comment.