diff options
author | Charles Lombardo <clombardo169@gmail.com> | 2023-04-04 18:54:45 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2023-06-03 09:05:49 +0200 |
commit | 63819af214ca1d93e6bf7ddbf40884fa46269e5c (patch) | |
tree | 00d8a5aaf4295fea99b1e3173916f103986529fa | |
parent | android: Backup shared preferences where applicable (diff) | |
download | yuzu-63819af214ca1d93e6bf7ddbf40884fa46269e5c.tar yuzu-63819af214ca1d93e6bf7ddbf40884fa46269e5c.tar.gz yuzu-63819af214ca1d93e6bf7ddbf40884fa46269e5c.tar.bz2 yuzu-63819af214ca1d93e6bf7ddbf40884fa46269e5c.tar.lz yuzu-63819af214ca1d93e6bf7ddbf40884fa46269e5c.tar.xz yuzu-63819af214ca1d93e6bf7ddbf40884fa46269e5c.tar.zst yuzu-63819af214ca1d93e6bf7ddbf40884fa46269e5c.zip |
-rw-r--r-- | src/android/app/build.gradle | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/android/app/build.gradle b/src/android/app/build.gradle index 221232712..09ca9c26f 100644 --- a/src/android/app/build.gradle +++ b/src/android/app/build.gradle @@ -47,6 +47,9 @@ android { versionCode autoVersion versionName getVersion() ndk.abiFilters "arm64-v8a", "x86_64" + + buildConfigField "String", "GIT_HASH", "\"${getGitHash()}\"" + buildConfigField "String", "BRANCH", "\"${getBranch()}\"" } signingConfigs { @@ -163,3 +166,25 @@ def getVersion() { return versionName } + +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 branch') + } + + return 'main' +} |