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 ->
|
_modules.stream().filter(Module::isEnabled).forEach(m ->
|
||||||
{
|
{
|
||||||
// Check dependencies
|
// Check dependencies
|
||||||
m.getDepends().forEach(d ->
|
m.getDepends().stream()
|
||||||
{
|
.filter(Module::isRequiredDependency)
|
||||||
Set<Module> providers = getAvailableProviders(d);
|
.forEach(d ->
|
||||||
if (providers.stream().filter(Module::isEnabled).count() == 0)
|
|
||||||
{
|
{
|
||||||
if (unsatisfied.length() > 0)
|
Set<Module> providers = getAvailableProviders(d);
|
||||||
unsatisfied.append(',');
|
if (providers.stream().noneMatch(Module::isEnabled))
|
||||||
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)
|
||||||
}
|
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)
|
if (unsatisfied.length() > 0)
|
||||||
|
|
|
@ -234,6 +234,7 @@ public class ModulesTest
|
||||||
|
|
||||||
// Collect active module list
|
// Collect active module list
|
||||||
List<Module> active = modules.getEnabled();
|
List<Module> active = modules.getEnabled();
|
||||||
|
modules.checkEnabledModules();
|
||||||
|
|
||||||
// Assert names are correct, and in the right order
|
// Assert names are correct, and in the right order
|
||||||
List<String> expectedNames = new ArrayList<>();
|
List<String> expectedNames = new ArrayList<>();
|
||||||
|
@ -282,6 +283,7 @@ public class ModulesTest
|
||||||
|
|
||||||
// Collect active module list
|
// Collect active module list
|
||||||
List<Module> active = modules.getEnabled();
|
List<Module> active = modules.getEnabled();
|
||||||
|
modules.checkEnabledModules();
|
||||||
|
|
||||||
// Assert names are correct, and in the right order
|
// Assert names are correct, and in the right order
|
||||||
List<String> expectedNames = new ArrayList<>();
|
List<String> expectedNames = new ArrayList<>();
|
||||||
|
@ -331,6 +333,7 @@ public class ModulesTest
|
||||||
|
|
||||||
// Collect active module list
|
// Collect active module list
|
||||||
List<Module> active = modules.getEnabled();
|
List<Module> active = modules.getEnabled();
|
||||||
|
modules.checkEnabledModules();
|
||||||
|
|
||||||
// Assert names are correct, and in the right order
|
// Assert names are correct, and in the right order
|
||||||
List<String> expectedNames = new ArrayList<>();
|
List<String> expectedNames = new ArrayList<>();
|
||||||
|
|
Loading…
Reference in New Issue