Merge pull request #11455 from t895/about-dialog

Android: Add about dialog
This commit is contained in:
Pierre Bourdon
2023-01-24 13:16:15 +01:00
committed by GitHub
19 changed files with 894 additions and 22 deletions

View File

@ -49,6 +49,9 @@ android {
versionName "${getVersion()}"
buildConfigField "String", "GIT_HASH", "\"${getGitHash()}\""
buildConfigField "String", "BRANCH", "\"${getBranch()}\""
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@ -172,7 +175,6 @@ def getVersion() {
return versionNumber
}
def getBuildVersionCode() {
try {
def versionNumber = 'git rev-list --first-parent --count HEAD'.execute([], project.rootDir).text
@ -184,3 +186,25 @@ def getBuildVersionCode() {
return 1
}
def getGitHash() {
try {
def gitHash = 'git rev-parse HEAD'.execute([], project.rootDir).text.trim()
return gitHash
} catch (Exception e) {
logger.error(e + ': Cannot find git, defaulting to dummy build hash')
}
return 0
}
def getBranch() {
try {
def branch = 'git rev-parse --abbrev-ref HEAD'.execute([], project.rootDir).text.trim()
return branch
} catch (Exception e) {
logger.error(e + ': Cannot find git, defaulting to dummy build hash')
}
return 'master'
}