Record Class AssignVersion

java.lang.Object
java.lang.Record
io.github.joke.conventionalversion.AssignVersion

public record AssignVersion(VersionCatalogue catalogue) extends Record
Assigns one project the version of the package that claims it.

The whole of what either mode does to a project, and the reason the two modes cannot drift apart: settings mode reaches projects by applying ProjectVersionPlugin to each of them, so both routes end in exactly this code.

No longer an IsolatedAction. It is not what gets registered with beforeProject any more - ApplyProjectPlugin is - so it need not be serializable, and the constraints that came with that have moved there.

Reaching no further than the project it is handed is still visible in execute(Project): it uses that project and nothing else. Matching a project to its package is a lookup in a value computed before any project was evaluated, which is what keeps per-project versions compatible with isolated projects at all.

  • Constructor Details

    • AssignVersion

      public AssignVersion(VersionCatalogue catalogue)
      Creates an instance of a AssignVersion record class.
      Parameters:
      catalogue - the value for the catalogue record component
  • Method Details

    • execute

      public void execute(org.gradle.api.Project project)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • catalogue

      public VersionCatalogue catalogue()
      Returns the value of the catalogue record component.
      Returns:
      the value of the catalogue record component