public interface GitVersionCalculator extends AutoCloseable, MetadataProvider
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
String |
getVersion()
Return the version to use for the current git repository depending on the HEAD position.
|
String |
getVersion(boolean forceComputation)
Calculates if necessary the version to use for the current git repository depending on the HEAD position.
|
Version |
getVersionObject()
Return the version to use for the current git repository depending on the HEAD position.
|
Version |
getVersionObject(boolean forceComputation)
Calculates the version to use for the current git repository depending on the HEAD position.
|
static GitVersionCalculator |
location(File gitRepositoryLocation)
Creates a
GitVersionCalculator for the git repository pointing to the given path. |
Optional<String> |
meta(Metadatas meta) |
GitVersionCalculator |
setAutoIncrementPatch(boolean value)
When true, when the found tag to calculate a version for HEAD is a normal/annotated one, the semver patch version
of the tag is increased by one ; except when the tag is on the HEAD itself.
|
GitVersionCalculator |
setFindTagVersionPattern(String pattern)
Defines a regexp search pattern that will match tags identifying a version.
|
GitVersionCalculator |
setGitCommitIdLength(int gitCommitIdLength)
Defines how long the qualifier from SHA1 git commit has to be.
|
GitVersionCalculator |
setLookupPolicy(LookupPolicy policy)
Defines the
LookupPolicy to be used for the next version resolution. |
GitVersionCalculator |
setMavenLike(boolean mavenLike)
Deprecated.
since 0.7.0, use
setStrategy(Strategies) instead |
GitVersionCalculator |
setMaxDepth(int maxDepth)
Defines max depth to look for version tags, defaults to Integer.MAX_VALUE.
|
GitVersionCalculator |
setNonQualifierBranches(String nonQualifierBranches)
Defines a comma separated list of branches for which no branch name qualifier will be used. default "master".
|
GitVersionCalculator |
setQualifierBranchingPolicies(BranchingPolicy... policies)
Sets as an array the policies that will be applied to try to build a qualifier from the branch of the HEAD.
|
GitVersionCalculator |
setQualifierBranchingPolicies(List<BranchingPolicy> policies)
Sets as a list the policies that will be applied to try to build a qualifier from the branch of the HEAD.
|
GitVersionCalculator |
setStrategy(Strategies s)
Defines the strategy to use.
|
GitVersionCalculator |
setTagVersionPattern(String pattern)
Defines the version pattern to use in
Strategies.PATTERN mode when HEAD is on an annotated tag |
GitVersionCalculator |
setUseDefaultBranchingPolicy(boolean useDefaultBranchingPolicy)
When true, uses
BranchingPolicy.DEFAULT_FALLBACK as last BranchingPolicy. |
GitVersionCalculator |
setUseDirty(boolean useDirty)
When true, append a qualifier with the "dirty" qualifier if the repository is in a dirty state (ie with
uncommited changes or new files)
|
GitVersionCalculator |
setUseDistance(boolean useDistance)
When true, append a qualifier with the distance between the HEAD commit and the found commit with a version tag.
|
GitVersionCalculator |
setUseGitCommitId(boolean useGitCommitId)
When true, append the git commit id (SHA1) to the version.
|
GitVersionCalculator |
setUseGitCommitTimestamp(boolean useGitCommitTimestamp)
When true, append the git commit timestamp to the version.
|
GitVersionCalculator |
setUseLongFormat(boolean useLongFormat)
When true describes commits hash with long format pattern, ie preceded with the letter 'g'.
|
GitVersionCalculator |
setVersionPattern(String pattern)
Defines the version pattern to use in
Strategies.PATTERN mode for normal situation (i.e. not on a tag) |
static GitVersionCalculator location(File gitRepositoryLocation)
GitVersionCalculator for the git repository pointing to the given path.gitRepositoryLocation - the location of the git repository to find version forGitVersionCalculatorVersion getVersionObject(boolean forceComputation)
forceComputation - true to discard any previous cached result, false allow to reuse already cached valuesVersion getVersionObject()
String getVersion()
String getVersion(boolean forceComputation)
forceComputation - true to force computation even if no computation parameters have changed,
false to allow to retrieve the value from the last computed version.void close()
throws Exception
close in interface AutoCloseableExceptionGitVersionCalculator setAutoIncrementPatch(boolean value)
value - if true and when found tag is not on HEAD, then version returned will be the found version with
patch number increased by one. default false.GitVersionCalculator setNonQualifierBranches(String nonQualifierBranches)
setQualifierBranchingPolicies(List) &
setQualifierBranchingPolicies(BranchingPolicy...).nonQualifierBranches - a comma separated list of branch name for which no branch name qualifier should be
used, can be null and/or emptyGitVersionCalculator setQualifierBranchingPolicies(BranchingPolicy... policies)
setNonQualifierBranches(String) & setQualifierBranchingPolicies(List).policies - an array of policies to apply can be emptyGitVersionCalculator setQualifierBranchingPolicies(List<BranchingPolicy> policies)
setNonQualifierBranches(String) &
setQualifierBranchingPolicies(BranchingPolicy...).policies - an array of policies to apply can be emptyGitVersionCalculator setUseDistance(boolean useDistance)
useDistance - if true, a qualifier with found distance will be used.GitVersionCalculator setUseDirty(boolean useDirty)
useDirty - if true, a qualifier with "dirty" qualifier will be used if the repository is stall.GitVersionCalculator setUseLongFormat(boolean useLongFormat)
useLongFormat - if true and useGitCommitId,
then commitId will be prepended with a 'g' to be compliant with `git describe --long` formatGitVersionCalculator setUseGitCommitId(boolean useGitCommitId)
useGitCommitId - if true, a qualifier with SHA1 git commit will be used, default trueGitVersionCalculator setUseGitCommitTimestamp(boolean useGitCommitTimestamp)
useGitCommitTimestamp - if true, a qualifier with git commit timestamp will be used, default falseGitVersionCalculator setUseDefaultBranchingPolicy(boolean useDefaultBranchingPolicy)
BranchingPolicy.DEFAULT_FALLBACK as last BranchingPolicy.useDefaultBranchingPolicy - if true, appends BranchingPolicy.DEFAULT_FALLBACK as last branching policyGitVersionCalculator setGitCommitIdLength(int gitCommitIdLength)
gitCommitIdLength - the length of the SHA1 substring to use as qualifier, valid values [8, 40], default 8IllegalArgumentException - in case the length is not in the range [8,40]GitVersionCalculator setMavenLike(boolean mavenLike)
setStrategy(Strategies) insteadmavenLike - true to activate maven like modeGitVersionCalculator setFindTagVersionPattern(String pattern)
pattern - a non null string representing a java regexp pattern able to match tag containing versionsPatternSyntaxException - if the given string cannot be parsed
as a correct Pattern objectOptional<String> meta(Metadatas meta)
meta in interface MetadataProviderGitVersionCalculator setStrategy(Strategies s)
s - the non null strategy to use as a Strategies enum valueGitVersionCalculator setTagVersionPattern(String pattern)
Strategies.PATTERN mode when HEAD is on an annotated tagpattern - the pattern to use for annotated tagsGitVersionCalculator setVersionPattern(String pattern)
Strategies.PATTERN mode for normal situation (i.e. not on a tag)pattern - the pattern to useGitVersionCalculator setMaxDepth(int maxDepth)
maxDepth - the maximum depth to reach to lookup for version tagsGitVersionCalculator setLookupPolicy(LookupPolicy policy)
LookupPolicy to be used for the next version resolution.policy - the policy kind, cannot be nullCopyright © 2016–2019 Matthieu Brouillard. All rights reserved.