Using ${version} in a versionFormat with any other macro results in multiple expansion in sub-project
carl-adams-symc opened this issue · 4 comments
Using ${version} in a versionFormat with any other macro results in multiple expansion.
For example, with the following configuration:
gitVersioning {
branch {
pattern = 'master'
versionFormat = '${version}'
}
branch {
pattern = 'feature/(?<user>.+)/(?<feature>.+)'
versionFormat = '${version}_${user}_${feature}'
}
}
With a project where in the root build.gradle.kts has the following:
allprojects {
version = "0.1"
}
on the master branch, version is "0.1" as expected, but on a feature branch like "features/myuser/myfeature" the version is set to "0.1_myuser_myfeature_myuser_myfeature", where I would expect it to be "0.1_myuser_myfeature"
This problem seems specific to sub-projects. For example, if in the root directory I do "gradlew version", I get "0.1_myuser_myfeature", but if I do "gradlew :subproject:version" I see "0.1_myuser_myfeature_myuser_myfeature"
work-around is to simply expand the version in the format, like this:
versionFormat = "${version}" + '_${user}_${feature}'
thanks for the bug report will have look at the weekend
hmm, any ideas how to solve this?
I've just release version 1.0.3
This version will add the :version
task to all projects.
You should add and configure the plugin only in the root build.gradle