Bug 1952523 - Only enable splits for APK builds. r=android-reviewers,adhingra

Differential Revision: https://phabricator.services.mozilla.com/D242409
This commit is contained in:
Ryan VanderMeulen
2025-03-21 00:08:01 +00:00
parent d65bc04e4d
commit 5a4f1bf36b
3 changed files with 25 additions and 21 deletions

View File

@@ -42,6 +42,8 @@ import static org.gradle.api.tasks.testing.TestResult.ResultType
apply from: 'benchmark.gradle'
def isAppBundle = gradle.startParameter.taskNames.any { it.toLowerCase().contains("bundle") }
android {
project.maybeConfigForJetpackBenchmark(it)
if (project.hasProperty("testBuildType")) {
@@ -235,7 +237,7 @@ android {
splits {
abi {
enable true
enable = !isAppBundle
reset()
@@ -337,12 +339,14 @@ android.applicationVariants.configureEach { variant ->
variant.outputs.each { output ->
def isMozillaOnline = project.hasProperty("mozillaOnline") || gradle.hasProperty("localProperties.mozillaOnline")
def abi = output.getFilter(FilterConfiguration.FilterType.ABI.name())
if (isAppBundle) {
abi = "AAB"
}
// If it is a Mozilla Online build, use a unified version code of armeabi-v7a
def arch = (isMozillaOnline) ? "armeabi-v7a" : abi
def aab = project.hasProperty("aab")
// We use the same version code generator, that we inherited from Fennec, across all channels - even on
// channels that never shipped a Fennec build.
def versionCodeOverride = Config.generateFennecVersionCode(arch, aab)
def versionCodeOverride = Config.generateFennecVersionCode(arch, isAppBundle )
project.logger.debug("versionCode for $abi = $versionCodeOverride, isMozillaOnline = $isMozillaOnline")

View File

@@ -12,6 +12,8 @@ if (gradle.mozconfig.substs.MOZILLA_OFFICIAL) {
apply plugin: 'com.google.android.gms.oss-licenses-plugin'
}
def isAppBundle = gradle.startParameter.taskNames.any { it.toLowerCase().contains("bundle") }
def versionCodeGradle = "$project.rootDir/tools/gradle/versionCode.gradle"
if (findProject(":geckoview") != null) {
versionCodeGradle = "$project.rootDir/mobile/android/focus-android/tools/gradle/versionCode.gradle"
@@ -146,7 +148,7 @@ android {
splits {
abi {
enable true
enable = !isAppBundle
reset()
@@ -397,7 +399,10 @@ android.applicationVariants.configureEach { variant ->
variant.outputs.each { output ->
def abi = output.getFilter(FilterConfiguration.FilterType.ABI.name())
def aab = project.hasProperty("aab")
if (isAppBundle) {
abi = "AAB"
}
// We use the same version code generator, that we inherited from Fennec, across all channels - even on
// channels that never shipped a Fennec build.
@@ -408,24 +413,21 @@ android.applicationVariants.configureEach { variant ->
def versionCodeOverride = baseVersionCode
if (aab) {
if (abi == "AAB") {
// AAB version code is odd
versionCodeOverride = versionCodeOverride + 1
project.logger.debug("versionCode for AAB = $versionCodeOverride")
} else {
if (abi == "x86_64") {
} else if (abi == "x86_64") {
versionCodeOverride = versionCodeOverride + 6
} else if (abi == "x86") {
versionCodeOverride = versionCodeOverride + 4
} else if (abi == "arm64-v8a") {
versionCodeOverride = versionCodeOverride + 2
} else if (abi == "armeabi-v7a") {
versionCodeOverride = versionCodeOverride + 0
} else {
throw new RuntimeException("Unknown ABI: " + abi)
}
project.logger.debug("versionCode for $abi = $versionCodeOverride")
} else if (abi == "x86") {
versionCodeOverride = versionCodeOverride + 4
} else if (abi == "arm64-v8a") {
versionCodeOverride = versionCodeOverride + 2
} else if (abi == "armeabi-v7a") {
versionCodeOverride = versionCodeOverride + 0
} else {
throw new RuntimeException("Unknown ABI: " + abi)
}
project.logger.debug("versionCode for $abi = $versionCodeOverride")
if (versionName != null) {
output.versionNameOverride = versionName

View File

@@ -24,8 +24,6 @@ task-defaults:
build_platform: android
run:
gradle-package-command: bundle
gradle-extra-options:
- -Paab
tasks:
focus-debug: