diff --git a/mobile/android/android-components/plugins/config/src/main/java/ConfigPlugin.kt b/mobile/android/android-components/plugins/config/src/main/java/ConfigPlugin.kt index 7261a093281b..3fe3ee11a6d7 100644 --- a/mobile/android/android-components/plugins/config/src/main/java/ConfigPlugin.kt +++ b/mobile/android/android-components/plugins/config/src/main/java/ConfigPlugin.kt @@ -18,6 +18,9 @@ class ConfigPlugin : Plugin { object Config { + @JvmStatic + val vcsHash by lazy { readVcsHash() } + @JvmStatic private fun generateDebugVersionName(): String { val today = Date() @@ -172,8 +175,7 @@ object Config { * Returns the git or hg hash of the currently checked out revision. If there are uncommitted changes, * a "+" will be appended to the hash, e.g. "c8ba05ad0+". */ - @JvmStatic - fun getVcsHash(): String { + private fun readVcsHash(): String { val gitRevision: String try { val revisionCmd = arrayOf("git", "rev-parse", "--short", "HEAD") @@ -189,7 +191,6 @@ object Config { val status = execReadStandardOutOrThrow(statusCmd) val hasUnstagedChanges = status.isNotBlank() val statusSuffix = if (hasUnstagedChanges) "+" else "" - return "git-$gitRevision$statusSuffix" } diff --git a/mobile/android/fenix/app/build.gradle b/mobile/android/fenix/app/build.gradle index 865ae6a0c11d..67a9330e1f84 100644 --- a/mobile/android/fenix/app/build.gradle +++ b/mobile/android/fenix/app/build.gradle @@ -125,7 +125,7 @@ android { if (gradle.ext.vcsHashFileContent) { buildConfigField "String", "VCS_HASH", "hg-\"${gradle.ext.vcsHashFileContent}\"" } else { - buildConfigField "String", "VCS_HASH", "\"${Config.getVcsHash()}\"" + buildConfigField "String", "VCS_HASH", "\"${Config.vcsHash}\"" } if (gradle.hasProperty("localProperties.autosignReleaseWithDebugKey")) { diff --git a/mobile/android/focus-android/app/build.gradle b/mobile/android/focus-android/app/build.gradle index 1f7ba7a3b166..cf7bf1533ea0 100644 --- a/mobile/android/focus-android/app/build.gradle +++ b/mobile/android/focus-android/app/build.gradle @@ -82,7 +82,7 @@ android { if (gradle.ext.vcsHashFileContent) { buildConfigField "String", "VCS_HASH", "hg-\"${gradle.ext.vcsHashFileContent}\"" } else { - buildConfigField "String", "VCS_HASH", "\"${Config.getVcsHash()}\"" + buildConfigField "String", "VCS_HASH", "\"${Config.vcsHash}\"" } if (gradle.hasProperty("localProperties.autosignReleaseWithDebugKey")) {