Class ApiOnlySubscriberPlugin

java.lang.Object
com.arc_e_tect.gradle.apionly.subscriber.ApiOnlySubscriberPlugin
All Implemented Interfaces:
org.gradle.api.Plugin<org.gradle.api.Project>

public class ApiOnlySubscriberPlugin extends Object implements org.gradle.api.Plugin<org.gradle.api.Project>
The consumer half of the API-Only pair. An implementation project declares which contracts it builds against and at which versions. The plugin fetches them, verifies them, and puts them on the classpath -- without the project holding a copy of anything the specification library owns. The question an implementation's build answers changes as a result. It stops being "does this implementation match this file that happens to sit in src/?" and becomes "does this implementation match the organisation's published contract, at version X?"
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The classpath directory the documents of an API a project calls are copied under, followed by the target name: "contracts".
    static final String
    The project property apiOnlySubscriber.apiContractVersion defaults to, and that the command line overrides it with: "apiContractVersion".
    static final String
    The name this plugin's extension is registered under: "apiOnlySubscriber".
    static final String
    The aggregate task that fetches every subscribed contract: "fetchApiSpec".
    static final String
    The DSL-updating task registered by this plugin.
    static final String
    The aggregate task that checks every fetched contract: "verifyApiSpec".
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates the plugin.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    apply(org.gradle.api.Project project)
    Registers the apiOnlySubscriber extension and the tasks that act on it.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • EXTENSION_NAME

      public static final String EXTENSION_NAME
      The name this plugin's extension is registered under: "apiOnlySubscriber".
      See Also:
    • FETCH_TASK

      public static final String FETCH_TASK
      The aggregate task that fetches every subscribed contract: "fetchApiSpec".
      See Also:
    • VERIFY_TASK

      public static final String VERIFY_TASK
      The aggregate task that checks every fetched contract: "verifyApiSpec".
      See Also:
    • UPDATE_DSL_TASK

      public static final String UPDATE_DSL_TASK
      The DSL-updating task registered by this plugin.
      See Also:
    • CONTRACT_VERSION_PROPERTY

      public static final String CONTRACT_VERSION_PROPERTY
      The project property apiOnlySubscriber.apiContractVersion defaults to, and that the command line overrides it with: "apiContractVersion".
      See Also:
    • CLIENT_RESOURCES

      public static final String CLIENT_RESOURCES
      The classpath directory the documents of an API a project calls are copied under, followed by the target name: "contracts".
      See Also:
  • Constructor Details

    • ApiOnlySubscriberPlugin

      public ApiOnlySubscriberPlugin()
      Creates the plugin. Gradle instantiates this when the plugin is applied.
  • Method Details

    • apply

      public void apply(org.gradle.api.Project project)
      Registers the apiOnlySubscriber extension and the tasks that act on it.
      Specified by:
      apply in interface org.gradle.api.Plugin<org.gradle.api.Project>
      Parameters:
      project - the project the plugin is applied to