-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Gradle plugin support for dependencies in plugin descriptor properties #17178
base: main
Are you sure you want to change the base?
Gradle plugin support for dependencies in plugin descriptor properties #17178
Conversation
Signed-off-by: Abhilasha Seth <abseth@amazon.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17178 +/- ##
============================================
+ Coverage 72.35% 72.40% +0.04%
- Complexity 65500 65662 +162
============================================
Files 5298 5306 +8
Lines 304603 304929 +326
Branches 44187 44256 +69
============================================
+ Hits 220397 220777 +380
+ Misses 66095 66035 -60
- Partials 18111 18117 +6 ☔ View full report in Codecov by Sentry. |
thanks @abseth-amzn! |
@@ -59,3 +59,6 @@ extended.plugins=${extendedPlugins} | |||
# | |||
# 'has.native.controller': whether or not the plugin has a native controller | |||
has.native.controller=${hasNativeController} | |||
# | |||
# 'dependencies': any dependencies specified by the plugin | |||
dependencies=${dependencies} |
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 see we are adding dependencies as another parameter to plugin-descriptor.properties. Why not re-use opensearch.version
?
PluginInfo.java[1] already processes semver range. May be we might have to change opensearch-plugin
install cli but thats pretty much it.
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.
Support for 'dependencies' as another parameter was already introduced in #11441. After that change, Opensearch expects either 'opensearch.version' or 'dependencies' parameter in the plugin descriptor properties file.
https://github.com/opensearch-project/OpenSearch/blame/e93791bc97b9791c422fa21e365df340cb8e2aa2/server/src/main/java/org/opensearch/plugins/PluginInfo.java#L291
Today, the semver support only works if plugin descriptor file has a 'dependencies' section with 'opensearch' as the only supported dependency.
Example test showing a sample plugin descriptor properties file - https://github.com/opensearch-project/OpenSearch/pull/11441/files#diff-1311b3459a8afb363dd9ff9d584421c3a8292fed4b0d25535f10a2b4a9c98bc7R94
With this commit (17178), we are adding capability for the opensearch-plugin to add this new parameter to the plugin-descriptor.properties file that it generates, so that users can leverage semver feature.
Here is the discussion from one of the discarded PRs regarding adding support for new 'dependencies' section - #6837 (review)
Description
#11441 added support for semver ranges in dependencies of plugins. This commit updates the
opensearchplugin
(fromorg.opensearch.gradle:build-tools
) to supportdependencies
property when building plugins. Without this support, plugin's plugin-descriptor.properties file would require manual update to adddependencies
property. With this support, it would be possible to build plugins with semver range support for opensearch using gradle code. Example usage:Since no plugin is currently using
dependencies
property, this change would simply add emptydependencies
property to plugin-descriptor.properties file. Example:Note - before this commit, opensearch process would reject above mentioned plugin-descriptor.properties file since it contains both
opensearch.version
anddependencies
property. With this commit, PluginInfo is being updated to allow files like above since one of these properties is empty.Hence this is a breaking change in opensearchplugin. The plugin-descriptor.properties file created by this plugin would not be accepted by older opensearch versions.
Following is an example of plugin-descriptor.properties file with
dependencies
property specified by the plugin in build.gradle (note emptyopensearch.version
property):Related Issues
Resolves #13187
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.