Class CompatibilityRegistry

java.lang.Object
org.gradle.plugin.compatibility.internal.CompatibilityRegistry

public class CompatibilityRegistry extends Object
A holder for configurations of plugin declarations in the "legacy" mode.

We want to provide nice user API, where people can take a PluginDeclaration and apply compatibility configuration onto it. Then later, the descriptor-generating task action can consume the data and enrich the plugin descriptor. The task has plugin declarations as its input, so sounds easy, right?

It is easy with modern Gradle - just use ExtensionAware and add the data directly to PluginDeclaration. However, older versions have bugs that prevent that, starting from the fact that PluginDeclaration is not extensible.

This is where this class enters. It offers a global storage for configuration actions applied to plugin declarations. It also takes classloader shenanigans into account.

This class has to be static-only because of Kotlin: there is no Project context available to the extension function. This is also why we're storing actions rather than applying them immediately - there is no way to instantiate the CompatibilityExtension to configure.

  • Constructor Details

    • CompatibilityRegistry

      public CompatibilityRegistry()
  • Method Details

    • store

      public static void store(org.gradle.plugin.devel.PluginDeclaration declaration, org.gradle.api.Action<? super CompatibilityExtension> action)
    • getForDeclaration

      public static List<org.gradle.api.Action<CompatibilityExtension>> getForDeclaration(org.gradle.plugin.devel.PluginDeclaration declaration)