This message was deleted.
# plugin-development
s
This message was deleted.
v
One point is, that I would write it in plain Java and there in the lowest version supported by the lowest Gradle version you want to support, so most probably Java 8. If you write it in Groovy or Kotlin, you have hassles to ensure that it is compatible with all the runtimes included in the specific Gradle version running the plugin and you cannot build a "fat" jar working around that. Using only Java ensures best compatibility on that axis. Other than that, beginning with Gradle 7.0 you can indeed build feature variants for different Gradle versions using the attribute documented at https://docs.gradle.org/current/userguide/variant_attributes.html#sub:gradle_plugins_default_attributes. So you can build different feature variants as documented on https://docs.gradle.org/current/userguide/feature_variants.html with different values for the Gradle API compatibility attribute and Gradle will automatically pick the one with the highest compatibility version that is still below or equal to the version of Gradle applying the plugin. To support Gradle versions <7.0 you would have one feature variant that does not set the attribute and that is then used for all older versions. For the older versions you then need the usual tricks if you want to use some APIs available in newer versions you support but in older ones like checking the version and depending on that using different classes that use the respective API and so on.
👍 3
j
thanks appreciate all the insights!
👌 1
d
@Juan Rada Speaking of this, you might be interested in https://github.com/davidburstrom/version-compatibility-gradle-plugin to be able to support older Gradle APIs seamlessly.
🙌 1