Skip to content

Commit

Permalink
Add getVersionName, getVersionCode functions + icon
Browse files Browse the repository at this point in the history
  • Loading branch information
pstorch committed May 1, 2024
1 parent 99f8299 commit 55dc35b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,32 @@ allprojects {
}
}

def getVersionName = { ->
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = stdout
}
return stdout.toString().trim()
} catch (ignored) {
return null
}
}

def getVersionCode = { ->
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-list', 'HEAD', '--count'
standardOutput = stdout
}
return Integer.valueOf(stdout.toString().trim())
} catch (ignored) {
return null
}
}

android {
compileOptions {
coreLibraryDesugaringEnabled true
Expand All @@ -41,6 +67,8 @@ android {
versionCode 1
versionName "1.0"

buildConfigField "String", "VERSION_NAME_FULL", "\"${getVersionName()}\""

minSdk 30
targetSdk 34
}
Expand Down
Binary file added fastlane/metadata/android/en-US/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 55dc35b

Please sign in to comment.