- handle tags within git worktrees directories
- threat empty circleCI environment variables as not set
- add option
describeTagFirstParent
option to disable follow first parent only
-prevent version task to be registered multiple times #111 (kudos to @taichi)
- add visible logging for relevant output
- ignore ci/cd environment if head SHA hash is not matching environment variable commit hash
- fix value of describe.tag.version placeholder
- Improve compatibility with Gradle Configuration Cache #99
- Only register version task for the current project #97
- Fix version pattern matcher. Ensure that matching groups are available. #96
- Fixes describe.tag.version.label #95
- Extend gitlab ci support for env var CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
- add new placeholders
${describe.tag.version.patch.plus.describe.distance}
${describe.tag.version.patch.next.plus.describe.distance}
${describe.tag.version.label.plus.describe.distance}
${describe.tag.version.label.next.plus.describe.distance}
- add config option for
projectVersionPattern
to use special parts of the project version as placeholders e.g.${version.environment}
- add placeholder
${version.core}
the core version component of${version}
e.g. '1.2.3'${version.release}
is marked as deprecated
- handle lightweight tags
- set
${version.minor.next}
placeholders properly
version.label.prefixed
resolve to empty string ifversion.label
is empty
- fix incompatibility with jre 8
- fix git describe tag selection, if multiple tags point to head
- do not consider project properties for command options anymore
- prefer cli options e.g.
-Dgit.ref=...
over environment variables e.g.VERSIONING_GIT_REF=...
)
- placeholder
- new
${version.major.next}
${version.minor.next}
${version.patch.next}
${describe.tag.version}
${describe.tag.version.major}
${describe.tag.version.major.next}
${describe.tag.version.minor}
${describe.tag.version.minor.next}
${describe.tag.version.path}
${describe.tag.version.patch.next}
- removed
${version.minor.prefixed}
${version.patch.prefixed}
- new
- migrate to java 11
- migrate
describeTagPattern
config fields from Pattern to String
- drop support for java 8
- add additional version component placeholders (#182)
${version.minor.prefixed}
like${version.minor}
with version component separator e.g. '.2'${version.patch.prefixed}
like${version.patch}
with version component separator e.g. '.3'${version.label}
the version label of${version}
e.g. 'SNAPSHOT'${version.label.prefixed}
like${version.label}
with label separator e.g. '-SNAPSHOT'
- replace deprecated class ConfigureUtil
- fix worktree handling
- fix
rootDirectory
determination for sub working trees
groovy
add specialproperties_
field to work around groovy naming conflict ofproperties
filed fromgroovy.lang.MetaClass
- if a tag is provided (and no branch) the extension behaves like in detached head state
- if a branch is provided (and no tag) the extension behaves like in attached head state with no tags pointing to head
- New Placeholder
${commit.timestamp.year.2digit}
-
Add GitHub Actions, GitLab CI and Jenkins environment variable support
- GitHub Actions: if
$GITHUB_ACTIONS == true
,GITHUB_REF
is considered - GitLab CI: if
$GITLAB_CI == true
,CI_COMMIT_BRANCH
andCI_COMMIT_TAG
are considered - Circle CI: if
$CIRCLECI == true
,CIRCLE_BRANCH
andCIRCLE_TAG
are considered - Jenkins: if
JENKINS_HOME
is set,BRANCH_NAME
andTAG_NAME
are considered
- GitHub Actions: if
-
Simplify configuration (also see BREAKING CHANGES)
Groovy DSL Example:
build.gradle
version = '0.0.0-SNAPSHOT' gitVersioning.apply { refs { branch('.+') { version = '${ref}-SNAPSHOT' } tag('v(?<version>.*)') { version = '${ref.version}' } } // optional fallback configuration in case of no matching ref configuration rev { version = '${commit}' } }
Kotlin DSL Example:
build.gradle.kts
version = "0.0.0-SNAPSHOT" gitVersioning.apply { refs { branch(".+") { version = "\${ref}-SNAPSHOT" } tag('v(?<version>.*)') { version = "\${ref.version}" } } // optional fallback configuration in case of no matching ref configuration rev { version = "\${commit}" } }
-
New option to consider tag configs on branches (attached HEAD), enabled by
refs { considerTagsOnBranches = true }
- If enabled, first matching branch or tag config will be used for versioning
- There is no default config anymore, if no
ref
configuration is matching current git situation and norev
configuration has been defined a warning message will be logged and plugin execution will be skipped. - Placeholder Changes (old -> new)
${branch}
->${ref}
${tag}
->${ref}
${REF_PATTERN_GROUP}
->${ref.REF_PATTERN_GROUP}
${describe.TAG_PATTERN_GROUP}
->${describe.tag.TAG_PATTERN_GROUP}
preferTags
option was removed- use
refs { considerTagsOnBranches = true }
instead
- use
-
Features
- add git describe version placeholders
- new placeholders
${describe}
${describe.tag}
${describe.<TAG_PATTERN_GROUP_NAME or TAG_PATTERN_GROUP_INDEX>}
e.g. patternv(?<version>.*)
will create placeholder${describe.version}
${describe.distance}
- new placeholders
- add git describe version placeholders
-
BREAKING CHANGES
- no longer provide project property
git.dirty
due to performance issues on larger projects, version format placeholder${dirty}
is still available
- no longer provide project property
- Features
- add ability to define default or overwrite values for version and property format.
- default value if parameter value is not set
${paramter:-<DEFAULT_VALUE>}
e.g.${buildNumber:-0}
- overwrite value if parameter has a value
${paramter:+<OVERWRITE_VALUE>}
e.g.${dirty:+-SNAPSHOT}
- default value if parameter value is not set
- add ability to define default or overwrite values for version and property format.
- Features
- Add option to disable plugin by default and enable on demand.
- Add option to modify project
gradle.properties
file accordingly to plugin related changes.- commandline property
gradle ... -Pversioning.updateGradleProperties
- Environment variable
OPTION_UPDATE_GRADLE_PROPERTIES=true
- Plugin Config
updateGradleProperties=true
global and branch/tag specific.
- commandline property
- Project
<Dependency>
and<Plugin>
versions will be updated accordingly to git versions - Add config option
<disable>true</disable>
to disable extension by default. - Add format placeholder:
${dirty.snapshot}
${commit.timestamp.year}
${commit.timestamp.month}
${commit.timestamp.day}
${commit.timestamp.hour}
${commit.timestamp.minute}
${commit.timestamp.second}
- Gradle CLI properties e.g.
gradle ... -Pfoo=bar
will be accessible by${foo}
placeholder
- BREAKING CHANGES
- default version format on a branch changed to
${branch}-SNAPSHOT
was${commit}
- Replace property regex pattern match with simple name match
- old regex pattern config
branch|tag|commit { property { pattern = 'abc' } }
- new property name config
branch|tag|commit { property { name = 'abc' } }
- old regex pattern config
- Remove property value pattern
branch|tag|commit { property { valuePattern = 'xyz' } }
- Remove format placeholder
${property.name}
- Rename format placeholder
${property.value}
to just${value}
- Remove
CommitVersionDescription
, useVersionDescription
instead.
- default version format on a branch changed to
- simplify
property
replacement configuration
-
simplify
property
replacement configurationnew config
gitVersioning.apply { branch { pattern = 'master' versionFormat = '${version}' property { pattern = 'revision' valueFormat = '${branch-SNAPSHOT}' } } }
old config
gitVersioning.apply { branch { pattern = 'master' versionFormat = '${version}' property { pattern ='revision' value { format = '${branch-SNAPSHOT}' } } } }
- add
${dirty}
flag version format placeholder - add
git.dirty
property
- New way of applying git versioning
- You need to call
apply
method with config, after version was set.version = '0.0.0-SNAPSHOT' gitVersioning.apply { // see configuration documentatiomn above }
- You need to call