mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-06 11:01:38 +12:00
auto git versioning
This commit is contained in:
parent
79bfb67156
commit
43aff85381
1 changed files with 24 additions and 2 deletions
|
@ -10,8 +10,8 @@ android {
|
||||||
applicationId = "com.panda3ds.pandroid"
|
applicationId = "com.panda3ds.pandroid"
|
||||||
minSdk = 24
|
minSdk = 24
|
||||||
targetSdk = 33
|
targetSdk = 33
|
||||||
versionCode = 1
|
versionCode = getVersionCode()
|
||||||
versionName = "1.0"
|
versionName = getVersion()
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
@ -54,3 +54,25 @@ dependencies {
|
||||||
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
||||||
implementation("com.google.code.gson:gson:2.10.1")
|
implementation("com.google.code.gson:gson:2.10.1")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def getVersionName() {
|
||||||
|
def tag = '1.0'
|
||||||
|
try {
|
||||||
|
def process = 'git describe --tags --abbrev=0'.execute()
|
||||||
|
tag = process.text.trim()
|
||||||
|
if (tag.startsWith('v')) {
|
||||||
|
tag = tag.substring(1)
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
println "Failed to get latest Git tag: ${e.message}"
|
||||||
|
}
|
||||||
|
return tag
|
||||||
|
}
|
||||||
|
|
||||||
|
def getVersionCode() {
|
||||||
|
def versionCode = 1
|
||||||
|
if (getVersionName() && getVersionName()[0].isDigit()) {
|
||||||
|
versionCode = getVersionName()[0].toInteger()
|
||||||
|
}
|
||||||
|
return versionCode
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue