|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD | |||||||
java.lang.Objectorg.ajoberstar.gradle.git.semver.InferredVersion
class InferredVersion
Version object that infers its value from the existing Git tags in the repository and the stage and scope of the change.
Version will be inferred by finding the nearest tagged version using NearestVersionLocator. Based on the scope of the changes and the stage of their completion (both of which must be provided to the infer(String, String) method) the nearest version will be incremented appropriately to result in the inferred version.
If the closest tagged version is v1.1.0 (for the normal version) and the closes absolute version is v1.2.0-milestone.1, here are some examples of the versions that would be inferred (assuming the default settings on this object):
| Scope | Stage | Inferred Version |
| patch | milestone | 1.1.1-milestone.1 |
| minor | dev | 1.2.0-dev.<commits since 1.1.0> |
| minor | milestone | 1.2.0-milestone.2 |
| minor | rc | 1.2.0-rc.1 |
| minor | final | 1.2.0 |
| major | milestone | 2.0.0-milestone.1 |
| Nested Class Summary | |
|---|---|
static enum |
InferredVersion.ChangeScope
|
| Property Summary | |
|---|---|
groovy.lang.Closure |
createBuildMetadata
Closure to create the build metadata to use in the inferred versions. |
Grgit |
grgit
The git repository to infer from. |
java.util.SortedSet |
taggedStages
Valid stages for versions that should have tags created for them. |
java.util.SortedSet |
untaggedStages
Valid stages for versions that should not have tags created for them. |
groovy.lang.Closure |
useBuildMetadataForStage
Closure to determine whether build metadata should be included in the inferred version. |
| Constructor Summary | |
InferredVersion(Project project)
|
|
| Method Summary | |
|---|---|
java.util.SortedSet
|
getAllStages()
Gets all stages considered valid by this object. |
Version
|
getInferredVersion()
|
NearestVersion
|
getNearest()
The nearest version that was found in the repository. |
boolean
|
getReleasable()
|
InferredVersion.ChangeScope
|
getScope()
|
java.lang.String
|
getStage()
|
void
|
infer()
Infers the version using project properties release.scope and release.stage or falls back to a scope of patch or the lowest precedence stage from untaggedStages. |
void
|
infer(java.lang.String scope, java.lang.String stage)
Infers the version using the given arguments. |
void
|
infer(InferredVersion.ChangeScope scope, java.lang.String stage)
Infers the version using the given arguments. |
java.lang.String
|
toString()
|
| Methods inherited from class java.lang.Object | |
|---|---|
| java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
| Property Detail |
|---|
groovy.lang.Closure createBuildMetadata
Grgit grgit
java.util.SortedSet taggedStages
java.util.SortedSet untaggedStages
groovy.lang.Closure useBuildMetadataForStage
| Constructor Detail |
|---|
InferredVersion(Project project)
| Method Detail |
|---|
java.util.SortedSet getAllStages()
Version getInferredVersion()
NearestVersion getNearest()
boolean getReleasable()
InferredVersion.ChangeScope getScope()
java.lang.String getStage()
void infer()
void infer(java.lang.String scope, java.lang.String stage)
scope - the scope of the change. Must be a string matching one of
ChangeScope's valuesstage - one of the valid stages for this object. See getAllStages()
void infer(InferredVersion.ChangeScope scope, java.lang.String stage)
scope - the scope of the change.stage - one of the valid stages for this object. See getAllStages()
@Override java.lang.String toString()
Groovy Documentation