public class GitVersionExtension
extends java.lang.Object
gitVersion block.| Constructor and Description |
|---|
GitVersionExtension(org.gradle.api.Project project,
GitRepositoryFactory gitRepositoryFactory) |
| Modifier and Type | Method and Description |
|---|---|
SemVersion |
determineVersion() |
SemVersion |
getCachedVersion()
Gets the version that was written to a file by an earlier invocation of
a
DetermineGitVersion task. |
java.lang.Object |
getLazyVersion()
Returns a lazily-evaluated object that can be assigned to the
Project.version
property. |
java.lang.String |
getOverrideBranchName()
Gets the branch name that will be used for versioning.
|
RulesContainer |
getRules()
Gets the container object that represents the versioning rules.
|
void |
rules(org.gradle.api.Action<RulesContainer> action)
Configures the rules using an action.
|
void |
rules(groovy.lang.Closure closure)
Configures the
rules container using a closure. |
void |
setOverrideBranchName(java.lang.String overrideBranchName)
Sets the branch name that should be used for versioning.
|
public GitVersionExtension(org.gradle.api.Project project,
GitRepositoryFactory gitRepositoryFactory)
@Nonnull public RulesContainer getRules()
RulesContainerpublic void rules(org.gradle.api.Action<RulesContainer> action)
action - the configuration Actionpublic void rules(@DelegatesTo(value=RulesContainer.class) groovy.lang.Closure closure)
rules container using a closure.closure - the configuration closure, executed in the context of the RulesContainer@Nonnull public SemVersion determineVersion()
@Nullable public SemVersion getCachedVersion() throws java.io.IOException
DetermineGitVersion task.null if the version file does not existjava.io.IOException - on I/O errors@Nonnull public java.lang.Object getLazyVersion()
Project.version
property. The version is only calculated the first time its toString() method is
called.
If at the time of evaluation, the version cannot be determined, the toString() method will return
an empty string.
@Nullable public java.lang.String getOverrideBranchName()
null if the repository HEAD is usedpublic void setOverrideBranchName(@Nullable
java.lang.String overrideBranchName)
By default (if this property is null), the Git repository's HEAD branch is used.
overrideBranchName - the branch name, or null to use the repository HEAD