public class Version extends Object
Modifier and Type | Method and Description |
---|---|
static Version |
fromGitFiles(Class locator,
String commitFile,
String tagsFile,
String hashFile,
String statusFile,
String buildDate)
Provides a version object from resources containing git command output.
|
static Version |
fromGitOutput(String commit,
String tags,
String hash,
String status,
String buildDate)
Provides a version object corresponding to the output of git commands.
|
static Version |
fromGitProperties(UnaryOperator<String> propertyFetcher)
Provides a version object corresponding to some supplied git
build properties.
|
static Version |
fromMercurialProperties(UnaryOperator<String> propertyFetcher)
Provides a version object corresponding to some supplied Mercurial
build properties.
|
String |
getDateString() |
String |
getVersionString() |
String |
getYearRange() |
public static Version fromMercurialProperties(UnaryOperator<String> propertyFetcher)
build.hg.revid
(revision ID),
build.hg.date
(date of revision), build.hg.tag
(version tag of revision, if any), and build.date
(date of build).propertyFetcher
- a function which returns property values
for supplied property namespublic static Version fromGitProperties(UnaryOperator<String> propertyFetcher)
build.git.hash
(revision ID), build.git.committerdate
(committer date of revision), build.git.tag
(version tag of
revision, if any), and build.date
(date of build).propertyFetcher
- a function which returns property values
for supplied property namespublic static Version fromGitFiles(Class locator, String commitFile, String tagsFile, String hashFile, String statusFile, String buildDate)
locator
- the class relative to which the resource names are
resolvedcommitFile
- name of resource containing the output of
git cat-file commit HEAD
tagsFile
- name of resource containing the output of
git name-rev --tags HEAD
hashFile
- name of resource containing the output of
git show-ref --head --hash ^HEAD$
statusFile
- name of resource containing the output of
git status --porcelain
buildDate
- a build date string, used as a fallback date if the date
cannot be determined from the commit
argument. The format of this
string is not specified; it will be used as is, without any attempt at
parsing.public static Version fromGitOutput(String commit, String tags, String hash, String status, String buildDate)
commit
- the output of git cat-file commit HEAD
tags
- the output of git name-rev --tags HEAD
hash
- the output of git show-ref --head --hash ^HEAD$
status
- the output of git status --porcelain
buildDate
- a build date string, used as a fallback date if
the date cannot be determined from the commit
argument.
The format of this string is not specified; it will be used
as is, without any attempt at parsing.public String getVersionString()
public String getDateString()
public String getYearRange()
Copyright © 2022. All rights reserved.