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

Gradle plugin support for dependencies in plugin descriptor properties #17178

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

Conversation

abseth-amzn
Copy link
Contributor

Description

#11441 added support for semver ranges in dependencies of plugins. This commit updates the opensearchplugin (from org.opensearch.gradle:build-tools) to support dependencies property when building plugins. Without this support, plugin's plugin-descriptor.properties file would require manual update to add dependencies property. With this support, it would be possible to build plugins with semver range support for opensearch using gradle code. Example usage:

opensearchplugin {
  description = '<Plugin description>'
  classname = '<Plugin class name>'
  dependencies = '{opensearch: "3.0.0"}'
}

Since no plugin is currently using dependencies property, this change would simply add empty dependencies property to plugin-descriptor.properties file. Example:

description=The Mapper Murmur3 plugin allows to compute hashes of a field's values at index-time and to store them in the index.
version=3.0.0-SNAPSHOT
name=mapper-murmur3
classname=org.opensearch.plugin.mapper.MapperMurmur3Plugin
java.version=21
opensearch.version=3.0.0
custom.foldername=
extended.plugins=
has.native.controller=false
dependencies=

Note - before this commit, opensearch process would reject above mentioned plugin-descriptor.properties file since it contains both opensearch.version and dependencies 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 empty opensearch.version property):

description=The Mapper Murmur3 plugin allows to compute hashes of a field's values at index-time and to store them in the index.
version=3.0.0-SNAPSHOT
name=mapper-murmur3
classname=org.opensearch.plugin.mapper.MapperMurmur3Plugin
java.version=21
opensearch.version=
custom.foldername=
extended.plugins=
has.native.controller=false
dependencies={opensearch: "3.0.0"}

Related Issues

Resolves #13187

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

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.

@github-actions github-actions bot added Build Build Tasks/Gradle Plugin, groovy scripts, build tools, Javadoc enforcement. Build Libraries & Interfaces enhancement Enhancement or improvement to existing feature or request Plugins labels Jan 29, 2025
Copy link
Contributor

✅ Gradle check result for 9814445: SUCCESS

Copy link

codecov bot commented Jan 29, 2025

Codecov Report

Attention: Patch coverage is 54.54545% with 5 lines in your changes missing coverage. Please review.

Project coverage is 72.40%. Comparing base (3c55a31) to head (9814445).
Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
.../opensearch/gradle/plugin/PluginBuildPlugin.groovy 0.00% 2 Missing and 1 partial ⚠️
...earch/gradle/plugin/PluginPropertiesExtension.java 50.00% 2 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

@rursprung
Copy link
Contributor

thanks @abseth-amzn!
may i (strongly) suggest backporting it to 2.x (namely 2.19 as it's supposed to be the last 2.x release)? that way future 2.19.x fix releases don't need re-releases of 3rd party plugins (if they start using the semver feature for their 2.19.0 release).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Libraries & Interfaces Build Build Tasks/Gradle Plugin, groovy scripts, build tools, Javadoc enforcement. enhancement Enhancement or improvement to existing feature or request Plugins skip-changelog
Projects
None yet
3 participants