Bug 1890508 - Android bootstrapping tasks fail because git as dependency is missing. r=android-reviewers,tthibaud,geckoview-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D218004
This commit is contained in:
Aaditya Dhingra 2024-08-22 15:22:29 +00:00
Родитель 64c43b9399
Коммит 6625cf797d
5 изменённых файлов: 38 добавлений и 5 удалений

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

@ -51,7 +51,11 @@ android {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField("String", "VCS_HASH", "\"" + getVcsHash() + "\"")
if (gradle.ext.vcsHashFileContent) {
buildConfigField("String", "VCS_HASH", "\"" + gradle.ext.vcsHashFileContent + "\"")
} else {
buildConfigField("String", "VCS_HASH", "\"" + getVcsHash() + "\"")
}
}
}

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

@ -33,7 +33,6 @@ static def getVcsHash() {
}
ext.configurePublish = { groupIdArg, artifactIdArg, descriptionArg ->
apply plugin: 'maven-publish'
@ -82,7 +81,11 @@ ext.configurePublish = { groupIdArg, artifactIdArg, descriptionArg ->
connection = libVcsUrl
developerConnection = libVcsUrl
url = libUrl
tag = getVcsHash()
if (gradle.ext.vcsHashFileContent) {
tag = gradle.ext.vcsHashFileContent
} else {
tag = getVcsHash()
}
}
}
}

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

@ -122,7 +122,11 @@ android {
// Changing the build config can cause files that depend on BuildConfig.java to recompile
// so we only set the vcs hash in release builds to avoid possible recompilation in debug builds.
buildConfigField "String", "VCS_HASH", "\"${Config.getVcsHash()}\""
if (gradle.ext.vcsHashFileContent) {
buildConfigField "String", "VCS_HASH", "hg-\"${gradle.ext.vcsHashFileContent}\""
} else {
buildConfigField "String", "VCS_HASH", "\"${Config.getVcsHash()}\""
}
if (gradle.hasProperty("localProperties.autosignReleaseWithDebugKey")) {
signingConfig signingConfigs.debug

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

@ -78,7 +78,12 @@ android {
minifyEnabled !project.hasProperty("disableOptimization")
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
matchingFallbacks = ['release']
buildConfigField "String", "VCS_HASH", "\"${Config.getVcsHash()}\""
if (gradle.ext.vcsHashFileContent) {
buildConfigField "String", "VCS_HASH", "hg-\"${gradle.ext.vcsHashFileContent}\""
} else {
buildConfigField "String", "VCS_HASH", "\"${Config.getVcsHash()}\""
}
if (gradle.hasProperty("localProperties.autosignReleaseWithDebugKey")) {
println ("All builds will be automatically signed with the debug key")

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

@ -78,3 +78,20 @@ gradle.ext.mozconfig = json
// based on the changed environment variables.
def orig = slurper.parse(new File(json.topobjdir, '.mozconfig.json'))
gradle.ext.mozconfig.orig_mozconfig = orig.mozconfig
// Returns the hg hash of the currently checked out revision.
// Hash is stored in MOZ_SOURCE_STAMP variable of $topobjdir/source-repo.h.
// $topobjdir/source-repo.h is created in mercurial repos and taskcluster.
// Also avoids running git/hg subprocesses when possible.
// Relevant bug: 1890508
def getVcsHash() {
def sourceRepoFile = file("${gradle.mozconfig.topobjdir}/source-repo.h")
if (sourceRepoFile.canRead()) {
def pattern = ~/define MOZ_SOURCE_STAMP\s(.{1,12})/
def matcher = sourceRepoFile.getText('utf-8') =~ pattern
return matcher.find() ? matcher.group(1).trim() : null
}
return null
}
gradle.ext.vcsHashFileContent = getVcsHash()