Use better version descriptors.
This commit is contained in:
parent
bbd9d3baff
commit
6213aa5970
2 changed files with 22 additions and 16 deletions
|
|
@ -61,15 +61,19 @@ java {
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
manifest {
|
manifest {
|
||||||
inputs.property("gitDescriptor", { grgit.describe(always: true) })
|
def matchExpr = [ project.tagName + "*" ]
|
||||||
|
|
||||||
|
inputs.property("gitDescriptor",
|
||||||
|
{ grgit.describe(always: true, match: matchExpr) })
|
||||||
|
|
||||||
// Set Git revision information in the manifests of built bundles
|
// Set Git revision information in the manifests of built bundles
|
||||||
|
def gitDesc = grgit.describe(always: true, match: matchExpr)
|
||||||
attributes([
|
attributes([
|
||||||
"Implementation-Title": project.name,
|
"Implementation-Title": project.name,
|
||||||
"Implementation-Version": "$project.version (built from ${grgit.describe(always: true)})",
|
"Implementation-Version": "$project.version (built from ${gitDesc})",
|
||||||
"Implementation-Vendor": grgit.repository.jgit.repository.config.getString("user", null, "name")
|
"Implementation-Vendor": grgit.repository.jgit.repository.config.getString("user", null, "name")
|
||||||
+ " (" + grgit.repository.jgit.repository.config.getString("user", null, "email") + ")",
|
+ " (" + grgit.repository.jgit.repository.config.getString("user", null, "email") + ")",
|
||||||
"Git-Descriptor": grgit.describe(always: true),
|
"Git-Descriptor": gitDesc,
|
||||||
"Git-SHA": grgit.head().id,
|
"Git-SHA": grgit.head().id,
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,22 +11,24 @@ plugins {
|
||||||
id 'pl.allegro.tech.build.axion-release'
|
id 'pl.allegro.tech.build.axion-release'
|
||||||
}
|
}
|
||||||
|
|
||||||
scmVersion {
|
def shortened = project.name.startsWith(project.group + ".") ?
|
||||||
versionIncrementer 'incrementMinor'
|
|
||||||
tag {
|
|
||||||
def shortened = project.name.startsWith(project.group + ".") ?
|
|
||||||
project.name.substring(project.group.length() + 1) : project.name
|
project.name.substring(project.group.length() + 1) : project.name
|
||||||
if (shortened == "manager") {
|
if (shortened == "manager") {
|
||||||
shortened = "manager-app";
|
shortened = "manager-app";
|
||||||
}
|
}
|
||||||
var p = shortened.replace('.', '-') + "-"
|
var tagName = shortened.replace('.', '-') + "-"
|
||||||
if (grgit.branch.current.name != "main"
|
if (grgit.branch.current.name != "main"
|
||||||
&& grgit.branch.current.name != "HEAD"
|
&& grgit.branch.current.name != "HEAD"
|
||||||
&& !grgit.branch.current.name.startsWith("release")
|
&& !grgit.branch.current.name.startsWith("release")
|
||||||
&& !grgit.branch.current.name.startsWith("develop")) {
|
&& !grgit.branch.current.name.startsWith("develop")) {
|
||||||
p = p + grgit.branch.current.name.replace('/', '-') + "-"
|
tagName = tagName + grgit.branch.current.name.replace('/', '-') + "-"
|
||||||
}
|
}
|
||||||
prefix = p
|
project.ext.tagName = tagName
|
||||||
|
|
||||||
|
scmVersion {
|
||||||
|
versionIncrementer 'incrementMinor'
|
||||||
|
tag {
|
||||||
|
prefix = project.tagName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
project.version = scmVersion.version
|
project.version = scmVersion.version
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue