Issue #4628 - Ensuring checkEnabledModules is required dependency aware
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
parent
f150062fde
commit
dbaf0bf69d
|
@ -487,17 +487,19 @@ public class Modules implements Iterable<Module>
|
|||
_modules.stream().filter(Module::isEnabled).forEach(m ->
|
||||
{
|
||||
// Check dependencies
|
||||
m.getDepends().forEach(d ->
|
||||
{
|
||||
Set<Module> providers = getAvailableProviders(d);
|
||||
if (providers.stream().filter(Module::isEnabled).count() == 0)
|
||||
m.getDepends().stream()
|
||||
.filter(Module::isRequiredDependency)
|
||||
.forEach(d ->
|
||||
{
|
||||
if (unsatisfied.length() > 0)
|
||||
unsatisfied.append(',');
|
||||
unsatisfied.append(m.getName());
|
||||
StartLog.error("Module %s requires a module providing %s from one of %s%n", m.getName(), d, providers);
|
||||
}
|
||||
});
|
||||
Set<Module> providers = getAvailableProviders(d);
|
||||
if (providers.stream().noneMatch(Module::isEnabled))
|
||||
{
|
||||
if (unsatisfied.length() > 0)
|
||||
unsatisfied.append(',');
|
||||
unsatisfied.append(m.getName());
|
||||
StartLog.error("Module %s requires a module providing %s from one of %s%n", m.getName(), d, providers);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (unsatisfied.length() > 0)
|
||||
|
|
|
@ -234,6 +234,7 @@ public class ModulesTest
|
|||
|
||||
// Collect active module list
|
||||
List<Module> active = modules.getEnabled();
|
||||
modules.checkEnabledModules();
|
||||
|
||||
// Assert names are correct, and in the right order
|
||||
List<String> expectedNames = new ArrayList<>();
|
||||
|
@ -282,6 +283,7 @@ public class ModulesTest
|
|||
|
||||
// Collect active module list
|
||||
List<Module> active = modules.getEnabled();
|
||||
modules.checkEnabledModules();
|
||||
|
||||
// Assert names are correct, and in the right order
|
||||
List<String> expectedNames = new ArrayList<>();
|
||||
|
@ -331,6 +333,7 @@ public class ModulesTest
|
|||
|
||||
// Collect active module list
|
||||
List<Module> active = modules.getEnabled();
|
||||
modules.checkEnabledModules();
|
||||
|
||||
// Assert names are correct, and in the right order
|
||||
List<String> expectedNames = new ArrayList<>();
|
||||
|
|
Loading…
Reference in New Issue