Skip to content

Commit

Permalink
Issue #4628 - Ensuring checkEnabledModules is required dependency aware
Browse files Browse the repository at this point in the history
Signed-off-by: Joakim Erdfelt <[email protected]>
  • Loading branch information
joakime committed Mar 3, 2020
1 parent f150062 commit dbaf0bf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
22 changes: 12 additions & 10 deletions jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java
Original file line number Diff line number Diff line change
Expand Up @@ -487,17 +487,19 @@ public void checkEnabledModules()
_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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ public void testResolveNotRequiredModuleNotFound() throws IOException

// 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<>();
Expand Down Expand Up @@ -282,6 +283,7 @@ public void testResolveNotRequiredModuleFound() throws IOException

// 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<>();
Expand Down Expand Up @@ -331,6 +333,7 @@ public void testResolveNotRequiredModuleFoundDynamic() throws IOException

// 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<>();
Expand Down

0 comments on commit dbaf0bf

Please sign in to comment.