Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support optional to optional extension dependencies #7729

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ricekot
Copy link
Member

@ricekot ricekot commented Feb 9, 2023

Allow optional extensions to depend on other optional extensions in the same add-on.

Signed-off-by: ricekot github@ricekot.com

Allow optional extensions to depend on other optional extensions in the
same add-on.

Signed-off-by: ricekot <github@ricekot.com>
@@ -126,6 +126,8 @@ public class AddOnLoader extends URLClassLoader {
*/
private Map<String, AddOnClassLoader> addOnLoaders = new HashMap<>();

private Map<String, Collection<AddOnClassLoader>> extensionLoaders = new HashMap<>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class loaders are being added but never removed from the map, when the extension/add-on is unloaded.

DEPENDENCIES_ELEMENT + "." + DEPENDENCIES_ADDONS_ALL_ELEMENTS;
private static final String EXTENSION_EXTENSION_DEPENDENCIES =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JavaDoc could be updated to mention the new element.

Comment on lines -378 to +390
List<HierarchicalConfiguration> fields =
List<HierarchicalConfiguration> addOnFields =
node.configurationsAt(DEPENDENCIES_ADDONS_ALL_ELEMENTS);
if (fields.isEmpty()) {
return new Dependencies(javaVersion, Collections.<AddOnDep>emptyList());
var extensionFields = node.configurationsAt(DEPENDENCIES_EXTENSIONS_ALL_ELEMENTS);
if (addOnFields.isEmpty() && extensionFields.isEmpty()) {
return new Dependencies(javaVersion, List.of(), List.of());
}

List<AddOnDep> addOns = readAddOnDependencies(fields);
return new Dependencies(javaVersion, addOns);
List<AddOnDep> addOns = readAddOnDependencies(addOnFields);
List<ExtensionDep> extensions = readExtensionDependencies(extensionFields);
return new Dependencies(javaVersion, addOns, extensions);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes (and in Dependencies) should not be needed, the add-on will not depend on extensions(?).

Comment on lines +1378 to +1380
if (classname == null) {
continue;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be needed, the name is required.

@@ -320,16 +328,12 @@ protected Class<?> findClass(String name) throws ClassNotFoundException {
}
}

try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep this the default behaviour (classes of the add-on should have priority over the ones in the dependencies) and allow to change it when needed.

if (classname == null) {
continue;
}
if (addOn.getExtensionsWithDeps().contains(classname)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should also check that it can be loaded (i.e. the transitive dependencies are all met).

@thc202 thc202 modified the milestones: 2.13.0, 2.14.0 Jun 30, 2023
@thc202 thc202 modified the milestones: 2.14.0, 2.15.0 Aug 18, 2023
@thc202 thc202 modified the milestones: 2.15.0, 2.16.0 Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants