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 Summary
Modifier and TypeMethodDescriptionReturns a stream of "dirty" (uncommitted or untracked) files in the work tree that match the configured file selection.static VersionEvaluatorforRepository(org.eclipse.jgit.lib.Repository repository) Creates a version evaluator for the given repository.static VersionEvaluatorforRepository(org.eclipse.jgit.lib.Repository repository, ClassLoader classLoader) Creates a version evaluator for the given repository.matchingAntPattern(String pattern) Include all files matching the given Ant pattern when evaluating the version.matchingGlob(String glob) Include all files matching the given glob expression when evaluating the version.matchingRegex(String regex) Include all files matching the given regular expression when evaluating the version.Returns a stream of files modified since the latest version tag that match the configured file selection.org.eclipse.jgit.lib.RepositoryReturns the evaluator's repository.subDirectory(Path subDirectory) Include all files under the given sub-directory when evaluating the version.Sets the tag filter to use.tagProcessor(TagProcessor tagProcessor) Sets the tag processor to use.version()Evaluates and returns the version string for the current repository state.
-
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 theServiceLoadermechanism with the given class loader.- Parameters:
repository- the repositoryclassLoader- the class loader to use for service loading- Returns:
- the version evaluator
- Throws:
NoSuchElementException- if noVersionEvaluatorProvideris available
-
forRepository
Creates a version evaluator for the given repository. The implementation is looked up using theServiceLoadermechanism, 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 noVersionEvaluatorProvideris 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
Stream<Path> 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
-