Tango SPI is a Gradle plugin that is designed to automatically generate the provider-configuration file necessary for using the java.util.ServiceLoader functionality.
For a general introduction to the Service Provider Interface (SPI) see this Java tutorial, but at a high level this allows you to create a plugin system where you can add/remove plugins by adding jars to the classpath and not introducing a compile-time dependency.
- This plugin only supports Gradle versions >= 3.0 (and by extension Java 7)
- This plugin requires the Java Plugin to be applied to your project
- Import the plugin to gradle
plugins {
id "net.sjrx.tangospi" version "0.1"
}
- Configure the interfaces that you would like to auto generate:
tangospi {
interfaces = ['example.foo.interfaceName']
}
- Compile, and the necessary files should be generated.
Not supported at this time (probably have to manually apply the task, but I haven't tested that yet)
-
Previously the author used the unmantained Mango SDK package however because it uses annotation processing, it does not work with non Java languages like Scala. Additionally the annotation used has a Source.RetentionPolicy and so it could not be used.
-
Searching google found a Maven plugin META-INFO/services auto-generation, obviously however this is for Maven.