Bug 1894702 - "hg id --id" is called many times when building geckoview. r=gl,android-reviewers,pollymce,tthibaud

Differential Revision: https://phabricator.services.mozilla.com/D217717
This commit is contained in:
Aaditya Dhingra 2024-08-23 14:36:29 +00:00
Родитель c064d325a8
Коммит dfcea4f125
3 изменённых файлов: 6 добавлений и 5 удалений

Просмотреть файл

@ -18,6 +18,9 @@ class ConfigPlugin : Plugin<Settings> {
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"
}

Просмотреть файл

@ -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")) {

Просмотреть файл

@ -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")) {