| 2292 | //----------------------------------------------------------------------------- |
| 2293 | |
| 2294 | bool ModuleManager::resolveModuleDependencies( StringTableEntry moduleId, const U32 versionId, StringTableEntry moduleGroup, bool synchronizedOnly, typeModuleLoadEntryVector& moduleResolvingQueue, typeModuleLoadEntryVector& moduleReadyQueue ) |
| 2295 | { |
| 2296 | // Fetch the module Id ready entry. |
| 2297 | ModuleLoadEntry* pLoadReadyEntry = findModuleReady( moduleId, moduleReadyQueue ); |
| 2298 | |
| 2299 | // Is there a load entry? |
| 2300 | if ( pLoadReadyEntry ) |
| 2301 | { |
| 2302 | // Yes, so finish if the version Id is not important, |
| 2303 | if ( versionId == 0 ) |
| 2304 | return true; |
| 2305 | |
| 2306 | // Finish if the version Id are compatible. |
| 2307 | if ( versionId == pLoadReadyEntry->mpModuleDefinition->getVersionId() ) |
| 2308 | return true; |
| 2309 | |
| 2310 | // Is it a strict version Id? |
| 2311 | if ( pLoadReadyEntry->mStrictVersionId ) |
| 2312 | { |
| 2313 | // Yes, so warn. |
| 2314 | Con::warnf( "Module Manager: A module dependency was detected loading module Id '%s' at version Id '%d' in group '%s' but an version Id '%d' is also required.", |
| 2315 | moduleId, versionId, pLoadReadyEntry->mpModuleDefinition->getVersionId(), moduleGroup ); |
| 2316 | return false; |
| 2317 | } |
| 2318 | |
| 2319 | // No, so find the required module version Id. |
| 2320 | ModuleDefinitionEntry::iterator definitionItr = findModuleDefinition( moduleId, versionId ); |
| 2321 | |
| 2322 | // Did we find the requested module definition. |
| 2323 | if ( definitionItr == NULL ) |
| 2324 | { |
| 2325 | // No, so we can safely ignore the missing dependency if we're not enforcing dependencies. |
| 2326 | if ( !mEnforceDependencies ) |
| 2327 | return true; |
| 2328 | |
| 2329 | // Warn! |
| 2330 | Con::warnf( "Module Manager: A missing module dependency was detected loading module Id '%s' at version Id '%d' in group '%s'.", |
| 2331 | moduleId, versionId, moduleGroup ); |
| 2332 | return false; |
| 2333 | } |
| 2334 | |
| 2335 | // Set the new module definition. |
| 2336 | pLoadReadyEntry->mpModuleDefinition = *definitionItr; |
| 2337 | |
| 2338 | // Set strict version Id. |
| 2339 | pLoadReadyEntry->mStrictVersionId = true; |
| 2340 | |
| 2341 | return true; |
| 2342 | } |
| 2343 | |
| 2344 | // Is the module Id load resolving? |
| 2345 | if ( findModuleResolving( moduleId, moduleResolvingQueue ) != NULL ) |
| 2346 | { |
| 2347 | // Yes, so a cycle has been detected so warn. |
| 2348 | Con::warnf( "Module Manager: A cyclic dependency was detected resolving module Id '%s' at version Id '%d' in group '%s'.", |
| 2349 | moduleId, versionId, moduleGroup ); |
| 2350 | return false; |
| 2351 | } |
nothing calls this directly
no test coverage detected