mirror of
https://github.com/etlegacy/JoyStick.git
synced 2024-11-22 04:12:24 +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
|
||||
|
||||
- name: Build and publish
|
||||
run: ./gradlew publish --no-daemon
|
||||
run: ./gradlew publish --no-daemon --info
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
|
12
build.gradle
12
build.gradle
|
@ -14,14 +14,16 @@ buildscript {
|
|||
}
|
||||
|
||||
def parseGitVersion() {
|
||||
def major = 0
|
||||
def minor = 0
|
||||
def major = 1
|
||||
def minor = 2
|
||||
def patch = 0
|
||||
def postfix = 'UNKNOWN'
|
||||
def postfix = '-UNKNOWN'
|
||||
def hash = ''
|
||||
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 ->
|
||||
if (output.toLowerCase().endsWith('-dirty')) {
|
||||
patchVal = (patchVal as int + 1) as String
|
||||
postfix = '-DIRTY'
|
||||
} else if(commit as int > 0) {
|
||||
patchVal = (patchVal as int + 1) as String
|
||||
|
@ -35,7 +37,9 @@ def parseGitVersion() {
|
|||
patch = patchVal as int
|
||||
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()
|
||||
|
|
Loading…
Reference in a new issue