-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Add support in plugins for a separate spi classloader #76288
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
Add support in plugins for a separate spi classloader #76288
Conversation
SPI is how plugins provide extension points for other plugins to customize their behavior. Plugins may have a separate SPI jar, so as not to expose the internals of the plugin implementation. In essense, this system was built as a stopgap for Java modules, where implementation can be protected in the same jar. However, currently the plugins service loads both spi and plugin implementations into the same classloader. This means that although another plugin may only compile against spi, they could still get jar hell from a duplicate dependency. This commit adds support for plugins to contain an "spi" subdirectory which is loaded into a separate classloader. This spi classloader is a parent to the plugin implementation, as well as any other plugins which have extended it. Additionally as a demonstration of how this works in practice, lang-painless is setup as the first plugin to provide an spi jar, and sql's dependence on painless is changed to only spi, so that it now has an independent version of antlr. closes elastic#74448
Pinging @elastic/es-core-infra (Team:Core/Infra) |
@elasticmachine run elasticsearch-ci/packaging-tests-windows-sample |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
modules/lang-painless/build.gradle
Outdated
@@ -58,7 +63,7 @@ tasks.named("yamlRestCompatTest").configure { | |||
* Painless plugin */ | |||
tasks.register("apiJavadoc", Javadoc) { | |||
source = sourceSets.main.allJava | |||
classpath = sourceSets.main.runtimeClasspath | |||
classpath = sourceSets.main.runtimeClasspath + configurations.named("spi").classpath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can simplify this by just using configurations.spi
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. just minor style remark
💔 Backport failed
To backport manually run |
Following elastic#76288, upgrade ANTLR library to benefit from the various improvements made in most recent releases in particular better performance and error messages. Looking at the changelog, since version 4.7.2 most changes in ANTLR seem to have occurred in non-Java targets however this commit upgrades to ANTLR 4.9.2 to benefit from the dependency updates (such as StringTemplate). Additionally move the library into QL to consolidate its use across QL projects. Relates elastic#74448 Fix elastic#76354
SPI is how plugins provide extension points for other plugins to customize their behavior. Plugins may have a separate SPI jar, so as not to expose the internals of the plugin implementation. In essense, this system was built as a stopgap for Java modules, where implementation can be protected in the same jar. However, currently the plugins service loads both spi and plugin implementations into the same classloader. This means that although another plugin may only compile against spi, they could still get jar hell from a duplicate dependency. This commit adds support for plugins to contain an "spi" subdirectory which is loaded into a separate classloader. This spi classloader is a parent to the plugin implementation, as well as any other plugins which have extended it. Additionally as a demonstration of how this works in practice, lang-painless is setup as the first plugin to provide an spi jar, and sql's dependence on painless is changed to only spi, so that it now has an independent version of antlr. closes elastic#74448
SPI is how plugins provide extension points for other plugins to customize their behavior. Plugins may have a separate SPI jar, so as not to expose the internals of the plugin implementation. In essense, this system was built as a stopgap for Java modules, where implementation can be protected in the same jar. However, currently the plugins service loads both spi and plugin implementations into the same classloader. This means that although another plugin may only compile against spi, they could still get jar hell from a duplicate dependency. This commit adds support for plugins to contain an "spi" subdirectory which is loaded into a separate classloader. This spi classloader is a parent to the plugin implementation, as well as any other plugins which have extended it. Additionally as a demonstration of how this works in practice, lang-painless is setup as the first plugin to provide an spi jar, and sql's dependence on painless is changed to only spi, so that it now has an independent version of antlr. closes #74448
* QL: Upgrade ANTLR and move it into QL Following #76288, upgrade ANTLR library to benefit from the various improvements made in most recent releases in particular better performance and error messages. Looking at the changelog, since version 4.7.2 most changes in ANTLR seem to have occurred in non-Java targets however this commit upgrades to ANTLR 4.9.2 to benefit from the dependency updates (such as StringTemplate). Additionally move the library into QL to consolidate its use across QL projects. Relates #74448 Fix #76354 * Fix matching on error message Co-authored-by: Elastic Machine <[email protected]>
* QL: Upgrade ANTLR and move it into QL Following elastic#76288, upgrade ANTLR library to benefit from the various improvements made in most recent releases in particular better performance and error messages. Looking at the changelog, since version 4.7.2 most changes in ANTLR seem to have occurred in non-Java targets however this commit upgrades to ANTLR 4.9.2 to benefit from the dependency updates (such as StringTemplate). Additionally move the library into QL to consolidate its use across QL projects. Relates elastic#74448 Fix elastic#76354 * Fix matching on error message Co-authored-by: Elastic Machine <[email protected]>
* QL: Upgrade ANTLR and move it into QL Following #76288, upgrade ANTLR library to benefit from the various improvements made in most recent releases in particular better performance and error messages. Looking at the changelog, since version 4.7.2 most changes in ANTLR seem to have occurred in non-Java targets however this commit upgrades to ANTLR 4.9.2 to benefit from the dependency updates (such as StringTemplate). Additionally move the library into QL to consolidate its use across QL projects. Relates #74448 Fix #76354 * Fix matching on error message Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
SPI is how plugins provide extension points for other plugins to
customize their behavior. Plugins may have a separate SPI jar, so as not
to expose the internals of the plugin implementation. In essense, this
system was built as a stopgap for Java modules, where implementation can
be protected in the same jar. However, currently the plugins service
loads both spi and plugin implementations into the same classloader.
This means that although another plugin may only compile against spi,
they could still get jar hell from a duplicate dependency.
This commit adds support for plugins to contain an "spi" subdirectory
which is loaded into a separate classloader. This spi classloader is a
parent to the plugin implementation, as well as any other plugins which
have extended it. Additionally as a demonstration of how this works in
practice, lang-painless is setup as the first plugin to provide an spi
jar, and sql's dependence on painless is changed to only spi, so that
it now has an independent version of antlr.
closes #74448