Class RepositoryStateReader

java.lang.Object
io.github.joke.conventionalversion.git.RepositoryStateReader

public class RepositoryStateReader extends Object
Gathers what the calculation needs, once per build, for every package at once.

The manifest says which version each package last released, the tag says where. The whole first-parent history is read a single time and each package's range is sliced from it at that package's own base commit, so the number of git processes does not grow with the number of packages.

  • Constructor Details

    • RepositoryStateReader

      public RepositoryStateReader(GitRepository repository)
  • Method Details

    • read

      The state of every declared package, paired with the package itself.

      Paired rather than keyed by path so that callers never look a package up and never have to handle an absent one: the pairing is the invariant, expressed in the type.

    • stateOf

      @VisibleForTesting protected RepositoryState stateOf(ReleasePackage declared, @Nullable SemanticVersion recorded, List<Commit> history, String headSha)
    • baseShaOf

      @VisibleForTesting protected String baseShaOf(ReleasePackage declared, SemanticVersion recorded)
      The commit a package's recorded release was cut at, found by the tag release-please would create.
    • since

      @VisibleForTesting protected List<Commit> since(String baseSha, List<Commit> history)
      The history after a package's base commit. A base that is not on the first-parent line yields nothing.
    • messagesOf

      @VisibleForTesting protected List<String> messagesOf(ReleasePackage declared, List<Commit> commits)
      Only the commits that touched a path this package claims contribute to its bump.
    • touches

      @VisibleForTesting protected boolean touches(ReleasePackage declared, Commit commit)
    • repositoryRoot

      public String repositoryRoot()
      Where release-please keeps its configuration, which need not be the Gradle build's root.