Interface VersionEvaluator

All Known Subinterfaces:
VersionEvaluatorProvider
All Known Implementing Classes:
VersionEvaluatorProvider

public interface VersionEvaluator
Configurable version evaluator for a Git repository.

By default, all files in the work tree are considered when evaluating the version. Restrict the scope using the matching* methods or subDirectory(java.nio.file.Path). Multiple matchers are combined with a logical OR.

Obtain an instance via forRepository(Repository) or forRepository(Repository, ClassLoader).

  • Method Details

    • forRepository

      static VersionEvaluator forRepository(org.eclipse.jgit.lib.Repository repository, ClassLoader classLoader)
      Creates a version evaluator for the given repository. The implementation is looked up using the ServiceLoader mechanism with the given class loader.
      Parameters:
      repository - the repository
      classLoader - the class loader to use for service loading
      Returns:
      the version evaluator
      Throws:
      NoSuchElementException - if no VersionEvaluatorProvider is available
    • forRepository

      static VersionEvaluator forRepository(org.eclipse.jgit.lib.Repository repository)
      Creates a version evaluator for the given repository. The implementation is looked up using the ServiceLoader mechanism, trying the context class loader of the current thread and the class loader of this class.
      Parameters:
      repository - the repository
      Returns:
      the version evaluator
      Throws:
      NoSuchElementException - if no VersionEvaluatorProvider is available
    • repository

      org.eclipse.jgit.lib.Repository repository()
      Returns the evaluator's repository.
      Returns:
      the repository
    • tagFilter

      Sets the tag filter to use. The filter determines which tags are recognized as version tags and extracts the version string from them.
      Parameters:
      tagFilter - the tag filter
      Returns:
      this evaluator for chaining
    • tagProcessor

      Sets the tag processor to use. The processor generates the final version string from the tag name and parsed version.
      Parameters:
      tagProcessor - the tag processor
      Returns:
      this evaluator for chaining
    • matchingGlob

      Include all files matching the given glob expression when evaluating the version.
      Parameters:
      glob - the glob expression
      Returns:
      this evaluator for chaining
    • matchingRegex

      Include all files matching the given regular expression when evaluating the version.
      Parameters:
      regex - the regular expression
      Returns:
      this evaluator for chaining
    • matchingAntPattern

      Include all files matching the given Ant pattern when evaluating the version.
      Parameters:
      pattern - the Ant pattern
      Returns:
      this evaluator for chaining
    • subDirectory

      Include all files under the given sub-directory when evaluating the version.
      Parameters:
      subDirectory - the sub-directory, relative to the repository work tree or absolute
      Returns:
      this evaluator for chaining
    • dirtyFiles

      Returns a stream of "dirty" (uncommitted or untracked) files in the work tree that match the configured file selection.
      Returns:
      a stream of paths
    • modifiedFiles

      Returns a stream of files modified since the latest version tag that match the configured file selection.
      Returns:
      a stream of paths
    • version

      Evaluates and returns the version string for the current repository state.
      Returns:
      the version string