Class ReleasePreparationService

java.lang.Object
fr.paris.lutece.plugins.releaser.service.ReleasePreparationService

public final class ReleasePreparationService extends Object
Prepares an aggregate (site, theme, platform POM loaded in a transient site) and its components for release : component list from the POM dependencies, remote informations, target and next snapshot versions, release branches. Knows nothing about persistence or screens.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The reasons a component cannot be released by the aggregate it belongs to, whatever the user does.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    First major of the core line parents numbered like the core : lutece-global-pom 4.x to 7.x and lutece-site-pom 3.x to 7.x are core 7
    static final List<String>
    The parents that tell the core version a component is built for
    static final String
    Message of a default branch built for another core version than the aggregate, shared by the site and platform flows
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Builds the release comments of a component : missing version, bugtracker informations, outdated snapshot, newer version available, to be released.
    static void
    Rebuilds the release comments of every component of an aggregate.
    static void
    defineAggregateVersions(Site site, String strLastReleaseVersion)
    Define the aggregate versions from its origin version : next release, next snapshot, target versions list and cycling index.
    static void
    Define the next snapshot version for a given component from its target version.
    static void
    Define the target version for a given component :
    - current version for non project component
    - next release for project component.
    static Integer
    Returns the core version of an aggregate : its parent major converted by toCoreLine(int).
    static Integer
    Returns the core version of an aggregate, read from the major of its parent POM version : the lutece-site-pom of a site, the core of a platform campaign.
    static String[]
    getCoreMismatchArguments(Component component, int nCoreMajor)
    The arguments of the core mismatch message : branch, core of the branch, parent artifactId and version, expected core.
    getNonReleasableReason(Component component, int nCoreMajor, String strDefaultBranch)
    Decides why a component cannot be released by its aggregate, in the order the checks must apply : a component already blocked or not in SNAPSHOT is left as is ; a theme ; a current SNAPSHOT ahead of the last one in Nexus, before any check relying on the Nexus POM ; a default branch whose parent belongs to another core version than the aggregate.
    static String
    getOriginVersion(String strLastRelease, String strCurrentVersion)
    Define which version between last released or current snapshot should be the origin for next release versions.
    static Integer
    Returns the core version a component or an aggregate is built for, told by its parent POM when that parent belongs to the core line (lutece-global-pom, lutece-site-pom).
    static void
    initComponents(Site site, ReleaserUser user, Predicate<Component> projectSelector)
    Initialize the component list of an aggregate from its current dependencies : remote informations, target versions, next snapshot versions and release branches.
    static boolean
    Whether a value parses to a SNAPSHOT version, false for null, blank and the "not found" sentinels without logging.
    static void
    Refreshes a component newly flagged as project : remote informations, release branch, target and next snapshot versions, name.
    static int
    toCoreLine(int nParentMajor)
    Converts the major of a core line parent into the core version it is built for : the parents are numbered like the core from 8, the earlier numbering (lutece-global-pom 4.x to 7.x, lutece-site-pom 3.x to 7.x) belongs to core 7.

    Methods inherited from class java.lang.Object

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

    • MESSAGE_BRANCH_CORE_MISMATCH

      public static final String MESSAGE_BRANCH_CORE_MISMATCH
      Message of a default branch built for another core version than the aggregate, shared by the site and platform flows
      See Also:
    • CORE_LINE_PARENTS

      public static final List<String> CORE_LINE_PARENTS
      The parents that tell the core version a component is built for
    • CORE_8_FIRST_PARENT_MAJOR

      public static final int CORE_8_FIRST_PARENT_MAJOR
      First major of the core line parents numbered like the core : lutece-global-pom 4.x to 7.x and lutece-site-pom 3.x to 7.x are core 7
      See Also:
  • Method Details

    • getOriginVersion

      public static String getOriginVersion(String strLastRelease, String strCurrentVersion)
      Define which version between last released or current snapshot should be the origin for next release versions. Ex of cases :
      last release : 3.2.1 current : 4.0.0-SNAPSHOT -- current
      last release : 3.2.1 current : 3.2.2-SNAPSHOT -- last or current
      last release : missing current : 1.0.0-SNAPSHOT -- current
      last release : 3.2.1-RC-02 current : 3.2.1-SNAPSHOT -- last
      Parameters:
      strLastRelease - The last release
      strCurrentVersion - The current release
      Returns:
      The origin version
    • defineAggregateVersions

      public static void defineAggregateVersions(Site site, String strLastReleaseVersion)
      Define the aggregate versions from its origin version : next release, next snapshot, target versions list and cycling index.
      Parameters:
      site - The aggregate
      strLastReleaseVersion - The last released version, may be null
    • initComponents

      public static void initComponents(Site site, ReleaserUser user, Predicate<Component> projectSelector)
      Initialize the component list of an aggregate from its current dependencies : remote informations, target versions, next snapshot versions and release branches. The project selector decides which components are to be released.
      Parameters:
      site - The aggregate
      user - The releaser user (credentials)
      projectSelector - Returns true for components to be released
    • buildComponentsComments

      public static void buildComponentsComments(Site site, Locale locale)
      Rebuilds the release comments of every component of an aggregate.
      Parameters:
      site - The aggregate
      locale - The locale of the comments
    • getNonReleasableReason

      public static ReleasePreparationService.NonReleasableReason getNonReleasableReason(Component component, int nCoreMajor, String strDefaultBranch)
      Decides why a component cannot be released by its aggregate, in the order the checks must apply : a component already blocked or not in SNAPSHOT is left as is ; a theme ; a current SNAPSHOT ahead of the last one in Nexus, before any check relying on the Nexus POM ; a default branch whose parent belongs to another core version than the aggregate. The site flow reports the reason, the platform flow blocks on it.
      Parameters:
      component - the component, Nexus information loaded
      nCoreMajor - the core version of the aggregate
      strDefaultBranch - the default branch of the components
      Returns:
      the reason, null when the component is releasable
    • getCoreMismatchArguments

      public static String[] getCoreMismatchArguments(Component component, int nCoreMajor)
      The arguments of the core mismatch message : branch, core of the branch, parent artifactId and version, expected core.
      Parameters:
      component - the component
      nCoreMajor - the core version of the aggregate
      Returns:
      the arguments
    • getParentCoreLine

      public static Integer getParentCoreLine(AbstractReleaserResource resource)
      Returns the core version a component or an aggregate is built for, told by its parent POM when that parent belongs to the core line (lutece-global-pom, lutece-site-pom).
      Parameters:
      resource - the component or aggregate
      Returns:
      7 or 8, null when the parent is unknown, of another kind or unreadable
    • toCoreLine

      public static int toCoreLine(int nParentMajor)
      Converts the major of a core line parent into the core version it is built for : the parents are numbered like the core from 8, the earlier numbering (lutece-global-pom 4.x to 7.x, lutece-site-pom 3.x to 7.x) belongs to core 7.
      Parameters:
      nParentMajor - the parent major
      Returns:
      7 or 8
    • getCoreLine

      public static Integer getCoreLine(Site site)
      Returns the core version of an aggregate : its parent major converted by toCoreLine(int).
      Parameters:
      site - the aggregate
      Returns:
      7 or 8, null when the parent version is missing or unreadable
    • getCoreMajor

      public static Integer getCoreMajor(Site site)
      Returns the core version of an aggregate, read from the major of its parent POM version : the lutece-site-pom of a site, the core of a platform campaign.
      Parameters:
      site - the aggregate
      Returns:
      the core major, null when the parent version is missing or unreadable
    • isParsableSnapshot

      public static boolean isParsableSnapshot(String strVersion)
      Whether a value parses to a SNAPSHOT version, false for null, blank and the "not found" sentinels without logging.
      Parameters:
      strVersion - the value
      Returns:
      true for a SNAPSHOT version
    • buildComponentComments

      public static void buildComponentComments(Component component, Locale locale)
      Builds the release comments of a component : missing version, bugtracker informations, outdated snapshot, newer version available, to be released. A blocking anomaly owns the display, no other comment is added after it.
      Parameters:
      component - The component
      locale - The locale of the comments
    • refreshProjectComponent

      public static void refreshProjectComponent(Component component)
      Refreshes a component newly flagged as project : remote informations, release branch, target and next snapshot versions, name.
      Parameters:
      component - The component
    • defineTargetVersion

      public static void defineTargetVersion(Component component)
      Define the target version for a given component :
      - current version for non project component
      - next release for project component.
      Parameters:
      component - The component
    • defineNextSnapshotVersion

      public static void defineNextSnapshotVersion(Component component)
      Define the next snapshot version for a given component from its target version.
      Parameters:
      component - The component