mirror of
https://github.com/etlegacy/JoyStick.git
synced 2024-11-25 13:31:47 +00:00
gradle: have sensible defaults for the version information
This commit is contained in:
parent
66f28f9188
commit
b517866731
2 changed files with 10 additions and 6 deletions
2
.github/workflows/build.yaml
vendored
2
.github/workflows/build.yaml
vendored
|
@ -32,7 +32,7 @@ jobs:
|
||||||
uses: android-actions/setup-android@v3
|
uses: android-actions/setup-android@v3
|
||||||
|
|
||||||
- name: Build and publish
|
- name: Build and publish
|
||||||
run: ./gradlew publish --no-daemon
|
run: ./gradlew publish --no-daemon --info
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
|
12
build.gradle
12
build.gradle
|
@ -14,14 +14,16 @@ buildscript {
|
||||||
}
|
}
|
||||||
|
|
||||||
def parseGitVersion() {
|
def parseGitVersion() {
|
||||||
def major = 0
|
def major = 1
|
||||||
def minor = 0
|
def minor = 2
|
||||||
def patch = 0
|
def patch = 0
|
||||||
def postfix = 'UNKNOWN'
|
def postfix = '-UNKNOWN'
|
||||||
def hash = ''
|
def hash = ''
|
||||||
def output = 'git describe --long --tags --dirty --always'.execute().text.trim()
|
def output = 'git describe --long --tags --dirty --always'.execute().text.trim()
|
||||||
|
project.logger.info("Ran git describe with the output: {}", output)
|
||||||
(output =~ /^v(\d+)\.(\d+)\.(\d+)-(\d+)-(\w+)/).each { match, majorVal, minorVal, patchVal, commitVal, hashVal ->
|
(output =~ /^v(\d+)\.(\d+)\.(\d+)-(\d+)-(\w+)/).each { match, majorVal, minorVal, patchVal, commitVal, hashVal ->
|
||||||
if (output.toLowerCase().endsWith('-dirty')) {
|
if (output.toLowerCase().endsWith('-dirty')) {
|
||||||
|
patchVal = (patchVal as int + 1) as String
|
||||||
postfix = '-DIRTY'
|
postfix = '-DIRTY'
|
||||||
} else if(commit as int > 0) {
|
} else if(commit as int > 0) {
|
||||||
patchVal = (patchVal as int + 1) as String
|
patchVal = (patchVal as int + 1) as String
|
||||||
|
@ -35,7 +37,9 @@ def parseGitVersion() {
|
||||||
patch = patchVal as int
|
patch = patchVal as int
|
||||||
hash = hashVal
|
hash = hashVal
|
||||||
}
|
}
|
||||||
return [version: "${major}.${minor}.${patch}${postfix}", hash: hash]
|
def outputHash = [version: "${major}.${minor}.${patch}${postfix}", hash: hash]
|
||||||
|
project.logger.info("Parsed version: {}", outputHash.version)
|
||||||
|
return outputHash
|
||||||
}
|
}
|
||||||
|
|
||||||
def versionInfo = parseGitVersion()
|
def versionInfo = parseGitVersion()
|
||||||
|
|
Loading…
Reference in a new issue