Gradle plugin support for dependencies in plugin descriptor properties#22426
Gradle plugin support for dependencies in plugin descriptor properties#22426rursprung wants to merge 2 commits into
Conversation
so far, if a plugin provides a `plugin-descriptor.properties` with an empty `dependencies` entry this will fail if `opensearch.version` is also specified. however, an empty `dependencies` entry should not fail this - it should behave as if it were not present. Signed-off-by: Abhilasha Seth <abseth@amazon.com> Signed-off-by: Ralph Ursprung <Ralph.Ursprung@avaloq.com>
PR opensearch-project#11441 added support for semver ranges in dependencies of plugins. this now updates `opensearchplugin` (from `org.opensearch.gradle:build-tools`) to support `dependencies` property when building plugins. since most plugins do not create the `plugin-descriptor.properties` file manually but instead use this gradle plugin for it this means that so far `dependencies` was not really used. `dependencies` also allows depending on `opensearch` (i.e. the core) and it allows depending on a semver range - thus this finally allows decoupling plugin releases from OpenSearch releases, i.e. plugins using this instead of specifying an `opensearch.version` do not need a new release for every new OpenSearch minor/patch release. for existing plugins updating to the new gradle plugin version will just generate an empty `dependencies` entry. so far, this would have then caused the plugin to fail to load, however the previous commit has modified this behaviour. an alternative would be to not generate the entry at all if no dependencies are specified, but then `dependencies` would be handled differently to all other entries in the properties file. since the gradle plugin is generally only updated together with the OpenSearch version which the plugins support this should be ok to do (it's unlikely that a plugin will use the gradle plugin 3.8.0 and generate a plugin release for e.g. 3.7.0). resolves opensearch-project#13187 Signed-off-by: Abhilasha Seth <abseth@amazon.com> Signed-off-by: Ralph Ursprung <Ralph.Ursprung@avaloq.com>
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|
Thank you for this PR @rursprung ! I have something similar open at #19680 and I think between the 2 of these they can help ease the maintenance burden on plugins. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #22426 +/- ##
============================================
+ Coverage 73.44% 73.58% +0.13%
- Complexity 76423 76543 +120
============================================
Files 6102 6102
Lines 346523 346530 +7
Branches 49875 49876 +1
============================================
+ Hits 254504 254992 +488
+ Misses 71800 71256 -544
- Partials 20219 20282 +63 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
this is #17178 rebased and split in two commits, with better commit messages. all credits for the actual commit content go to @abseth-amzn (who doesn't seem to be working on OpenSearch anymore, thus the original PR has been abandoned for a long time).
the rest is copy & paste from the commit message:
PR #11441 added support for semver ranges in dependencies of plugins.
this now updates
opensearchplugin(fromorg.opensearch.gradle:build-tools) to supportdependenciespropertywhen building plugins. since most plugins do not create the
plugin-descriptor.propertiesfile manually but instead use this gradleplugin for it this means that so far
dependencieswas not really used.dependenciesalso allows depending onopensearch(i.e. the core) andit allows depending on a semver range - thus this finally allows
decoupling plugin releases from OpenSearch releases, i.e. plugins using
this instead of specifying an
opensearch.versiondo not need a newrelease for every new OpenSearch minor/patch release.
for existing plugins updating to the new gradle plugin version will just
generate an empty
dependenciesentry. so far, this would have thencaused the plugin to fail to load, however the previous commit has
modified this behaviour.
an alternative would be to not generate the entry at all if no
dependencies are specified, but then
dependencieswould be handleddifferently to all other entries in the properties file. since the
gradle plugin is generally only updated together with the OpenSearch
version which the plugins support this should be ok to do (it's unlikely
that a plugin will use the gradle plugin 3.8.0 and generate a plugin
release for e.g. 3.7.0).
plugin info: support empty
dependenciesso far, if a plugin provides a
plugin-descriptor.propertieswith anempty
dependenciesentry this will fail ifopensearch.versionisalso specified. however, an empty
dependenciesentry should not failthis - it should behave as if it were not present.
Related Issues
resolves #13187
related to #11441
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.