Class ConventionalVersionPlugin

java.lang.Object
io.github.joke.conventionalversion.ConventionalVersionPlugin
All Implemented Interfaces:
org.gradle.api.Plugin<org.gradle.api.plugins.PluginAware>

public class ConventionalVersionPlugin extends Object implements org.gradle.api.Plugin<org.gradle.api.plugins.PluginAware>
Assigns projects the version of the release-please package that claims them.

Calculates only. It never creates a tag, never writes a changelog and contributes no task: release-please remains the release authority and this predicts the number it will publish.

There is no configuration block. Every option that changes a number lives in release-please-config.json, under the name release-please gives it, so the two cannot disagree.

One id, applicable at two levels. Applied in a settings file it versions the whole build; applied to a project - directly or by a convention plugin - it versions that project. Which level suits a build is that build's structural choice and not a different feature, so this dispatches on what it was applied to rather than publishing two ids.

Declared Plugin<PluginAware> because Gradle types a plugin by its target and no class can implement Plugin<Settings> and Plugin<Project> at once. The cost is that Gradle no longer refuses a wrong target on this plugin's behalf, so pluginFor(PluginAware) has to say so itself.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    apply(org.gradle.api.plugins.PluginAware target)
    The target type is resolved before the target is touched, so an unsupported one fails without the plugin having reached into it first.
    protected Class<? extends org.gradle.api.Plugin<?>>
    pluginFor(org.gradle.api.plugins.PluginAware target)
    Gradle is a PluginAware too, so an init script reaches here.

    Methods inherited from class Object

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

    • ConventionalVersionPlugin

      public ConventionalVersionPlugin()
  • Method Details

    • apply

      public void apply(org.gradle.api.plugins.PluginAware target)
      The target type is resolved before the target is touched, so an unsupported one fails without the plugin having reached into it first.
      Specified by:
      apply in interface org.gradle.api.Plugin<org.gradle.api.plugins.PluginAware>
    • pluginFor

      @VisibleForTesting protected Class<? extends org.gradle.api.Plugin<?>> pluginFor(org.gradle.api.plugins.PluginAware target)
      Gradle is a PluginAware too, so an init script reaches here. It names what it was given, because the alternative is a plugin that appears to apply and silently does nothing.