LibOverride: Attempt to improve handling of cyclic deps between libraries.

Those cyclic dependencies (lib_A depends on a texture from lib_B, which
links geometry from lib_A) are bad, but previous code did not always
helped much in idendtifying to actuall issue point.

Now, reduce maximum 'recursion' level to 100 (this should already never
be reached in practice), and additionally report warnings when reaching
level 90, so that user gets more context data to identify more easily
the culprit.
This commit is contained in:
Bastien Montagne 2022-06-07 12:50:25 +02:00
parent 4412e14708
commit 16934c198a
1 changed files with 11 additions and 1 deletions

View File

@ -2423,7 +2423,7 @@ static int lib_override_sort_libraries_func(LibraryIDLinkCallbackData *cb_data)
if (id != nullptr && ID_IS_LINKED(id) && id->lib != id_owner->lib) {
const int owner_library_indirect_level = ID_IS_LINKED(id_owner) ? id_owner->lib->temp_index :
0;
if (owner_library_indirect_level > 200) {
if (owner_library_indirect_level > 100) {
CLOG_ERROR(&LOG,
"Levels of indirect usages of libraries is way too high, there are most likely "
"dependency loops, skipping further building loops (involves at least '%s' from "
@ -2434,6 +2434,16 @@ static int lib_override_sort_libraries_func(LibraryIDLinkCallbackData *cb_data)
id->lib->filepath);
return IDWALK_RET_NOP;
}
if (owner_library_indirect_level > 90) {
CLOG_WARN(
&LOG,
"Levels of indirect usages of libraries is suspiciously too high, there are most likely "
"dependency loops (involves at least '%s' from '%s' and '%s' from '%s')",
id_owner->name,
id_owner->lib->filepath,
id->name,
id->lib->filepath);
}
if (owner_library_indirect_level >= id->lib->temp_index) {
id->lib->temp_index = owner_library_indirect_level + 1;