Skip to content

Commit

Permalink
Use better version descriptors.
Browse files Browse the repository at this point in the history
  • Loading branch information
mnlipp committed Jun 10, 2024
1 parent bbd9d3b commit 6213aa5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,19 @@ java {

jar {
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
def gitDesc = grgit.describe(always: true, match: matchExpr)
attributes([
"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")
+ " (" + grgit.repository.jgit.repository.config.getString("user", null, "email") + ")",
"Git-Descriptor": grgit.describe(always: true),
"Git-Descriptor": gitDesc,
"Git-SHA": grgit.head().id,
])
}
Expand Down
28 changes: 15 additions & 13 deletions buildSrc/src/org.jdrupes.vmoperator.versioning-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,24 @@ plugins {
id 'pl.allegro.tech.build.axion-release'
}

def shortened = project.name.startsWith(project.group + ".") ?
project.name.substring(project.group.length() + 1) : project.name
if (shortened == "manager") {
shortened = "manager-app";
}
var tagName = shortened.replace('.', '-') + "-"
if (grgit.branch.current.name != "main"
&& grgit.branch.current.name != "HEAD"
&& !grgit.branch.current.name.startsWith("release")
&& !grgit.branch.current.name.startsWith("develop")) {
tagName = tagName + grgit.branch.current.name.replace('/', '-') + "-"
}
project.ext.tagName = tagName

scmVersion {
versionIncrementer 'incrementMinor'
tag {
def shortened = project.name.startsWith(project.group + ".") ?
project.name.substring(project.group.length() + 1) : project.name
if (shortened == "manager") {
shortened = "manager-app";
}
var p = shortened.replace('.', '-') + "-"
if (grgit.branch.current.name != "main"
&& grgit.branch.current.name != "HEAD"
&& !grgit.branch.current.name.startsWith("release")
&& !grgit.branch.current.name.startsWith("develop")) {
p = p + grgit.branch.current.name.replace('/', '-') + "-"
}
prefix = p
prefix = project.tagName
}
}
project.version = scmVersion.version
Expand Down

0 comments on commit 6213aa5

Please # to comment.