Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2019 SenX S.A.S.
// Copyright 2019-2023 SenX S.A.S.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,6 @@

plugins {
id 'com.github.johnrengelman.shadow' version '7.0.0'
id 'net.nemerosa.versioning' version '2.14.0'
id 'io.codearte.nexus-staging' version '0.22.0'
id 'java'
id 'java-library'
Expand All @@ -28,9 +27,7 @@ plugins {

project.group = 'io.warp10'
project.description = 'WarpScrip™ Redis Extension'

// If the current tag is set, then it's a new release. Don't add build number
project.version = versioning.info.lastTag + ((versioning.info.tag != null) ? '' : '-' + versioning.info.build)
project.version = getVersionFromGit()
//
// Repositories for the project dependencies
//
Expand Down Expand Up @@ -253,3 +250,18 @@ if (project.hasProperty('signing.gnupg.keyName')) {
sign publishing.publications
}
}

def getVersionFromGit() {
def nogit = System.getProperty("nogit")
if (null != nogit) {
// Override version with the property value. To remove the version altogether use '-Dnogit' without value.
return nogit
} else {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags', '--always'
standardOutput = stdout
}
return stdout.toString().trim()
}
}