Bug 1822393 - Support Fenix consuming GeckoView directly. r=owlish,nalexander,geckoview-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D201493
This commit is contained in:
Gabriel Luong 2023-12-15 04:19:16 -05:00
parent eae8e93805
commit a4eecece6d
6 changed files with 52 additions and 12 deletions

View File

@ -19,6 +19,9 @@ buildscript {
detekt_plugin = Versions.detekt
python_envs_plugin = Versions.python_envs_plugin
ksp_plugin = Versions.ksp_plugin
// Used in mobile/android/fenix/app/build.gradle
protobuf_plugin = FenixVersions.protobuf_plugin
}
dependencies {
@ -28,6 +31,13 @@ buildscript {
classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.25.0'
classpath 'org.tomlj:tomlj:1.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// Used in mobile/android/fenix/app/build.gradle
classpath FenixDependencies.androidx_safeargs
classpath FenixDependencies.osslicenses_plugin
classpath FenixDependencies.tools_benchmarkgradle
classpath "org.mozilla.telemetry:glean-gradle-plugin:${Versions.mozilla_glean}"
classpath "${ApplicationServicesConfig.groupId}:tooling-nimbus-gradle:${ApplicationServicesConfig.version}"
}
}
@ -357,10 +367,10 @@ afterEvaluate {
"-Xlint:-serial",
// Classfile, because javac has a bug with MethodParameters attributes
// with Java 7. https://bugs.openjdk.java.net/browse/JDK-8190452
"-Xlint:-classfile",
"-Xlint:-classfile"]
// Turn all remaining warnings into errors,
// unless marked by @SuppressWarnings.
"-Werror"]
//"-Werror"]
}
}
}

View File

@ -34,23 +34,30 @@ object Config {
// ergonomically validate (sometimes IDEs default to a release variant and mysteriously fail due to the
// validation, sometimes devs just need a release build and specifying project properties is annoying in IDEs),
// so instead we'll allow the `versionName` to silently default to an empty string.
return if (project.hasProperty("versionName")) project.property("versionName") as String else null
return if (project.hasProperty("versionName")) project.property("versionName").toString() else null
}
@JvmStatic
fun nightlyVersionName(): String {
fun nightlyVersionName(project: Project): String {
// Nightly versions will use the version from "version.txt".
return readVersionFromFile()
return readVersionFromFile(project)
}
@JvmStatic
fun readVersionFromFile(): String {
return File("../version.txt").useLines { it.firstOrNull() ?: "" }
fun readVersionFromFile(project: Project): String {
var versionPath = "../version.txt"
if (project.findProject(":geckoview") != null) {
versionPath = "./mobile/android/version.txt"
}
return File(versionPath).useLines { it.firstOrNull() ?: "" }
}
@JvmStatic
fun majorVersion(): String {
return readVersionFromFile().split(".")[0]
fun majorVersion(project: Project): String {
return readVersionFromFile(project).split(".")[0]
}
/**

View File

@ -6,6 +6,10 @@ plugins {
id "com.google.protobuf" version "$protobuf_plugin"
}
if (findProject(":geckoview") != null) {
buildDir "${topobjdir}/gradle/build/mobile/android/fenix"
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'
@ -13,6 +17,10 @@ apply plugin: 'jacoco'
apply plugin: 'androidx.navigation.safeargs.kotlin'
apply plugin: 'com.google.android.gms.oss-licenses-plugin'
if (findProject(":geckoview") != null) {
apply from: "${topsrcdir}/mobile/android/gradle/product_flavors.gradle"
}
import groovy.json.JsonOutput
import org.gradle.internal.logging.text.StyledTextOutput.Style
import org.gradle.internal.logging.text.StyledTextOutputFactory
@ -188,6 +196,11 @@ android {
animationsDisabled = true
}
if (findProject(":geckoview") != null) {
project.configureProductFlavors.delegate = it
project.configureProductFlavors()
}
flavorDimensions.add("product")
productFlavors {
@ -297,7 +310,7 @@ android.applicationVariants.configureEach { variant ->
// same version code. Therefore we need to have different version codes for our ARM and x86
// builds.
def versionName = variant.buildType.name == 'nightly' ? Config.nightlyVersionName() : Config.releaseVersionName(project)
def versionName = variant.buildType.name == 'nightly' ? Config.nightlyVersionName(project) : Config.releaseVersionName(project)
println("versionName override: $versionName")
variant.outputs.each { output ->
@ -906,4 +919,4 @@ def getSupportedLocales() {
}
// Enable expiration by major version.
ext.gleanExpireByVersion = Config.majorVersion()
ext.gleanExpireByVersion = Config.majorVersion(project)

View File

@ -9,6 +9,7 @@ channels:
- beta
- nightly
- developer
- withGeckoBinariesFenixDebug
includes:
- onboarding.fml.yaml
- pbm.fml.yaml

View File

@ -373,7 +373,7 @@ android.applicationVariants.configureEach { variant ->
if (buildType == "release" || buildType == "nightly" || buildType == "beta") {
def baseVersionCode = generatedVersionCode
def versionName = buildType == "nightly" ? Config.nightlyVersionName() : Config.releaseVersionName(project)
def versionName = buildType == "nightly" ? Config.nightlyVersionName(project) : Config.releaseVersionName(project)
println("versionName override: $versionName")
// The Google Play Store does not allow multiple APKs for the same app that all have the

View File

@ -1,10 +1,16 @@
pluginManagement {
includeBuild("${rootProject.projectDir.absolutePath}/mobile/android/android-components/plugins/config")
includeBuild("${rootProject.projectDir.absolutePath}/mobile/android/android-components/plugins/dependencies")
includeBuild("${rootProject.projectDir.absolutePath}/mobile/android/android-components/plugins/publicsuffixlist")
includeBuild("${rootProject.projectDir.absolutePath}/mobile/android/fenix/plugins/apksize")
includeBuild("${rootProject.projectDir.absolutePath}/mobile/android/fenix/plugins/fenixdependencies")
}
plugins {
id "mozac.ConfigPlugin"
id 'mozac.DependenciesPlugin'
id 'ApkSizePlugin'
id 'FenixDependenciesPlugin'
}
// You might think topsrcdir is '.', but that's not true when the Gradle build
@ -27,6 +33,8 @@ include ':test_runner'
include ':exoplayer2'
include ':android-components'
include ':samples-browser'
include ':fenix'
include ':mozilla-lint-rules'
project(':annotations').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/annotations")
project(':geckoview').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/geckoview")
@ -35,6 +43,7 @@ project(':test_runner').projectDir = new File("${gradle.mozconfig.topsrcdir}/mob
project(':exoplayer2').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/exoplayer2")
project(':android-components').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/android-components")
project(':samples-browser').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/android-components/samples/browser")
project(':fenix').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/fenix/app")
if (hasProperty("androidFormatLintTest")) {
include ':androidFormatLintTest'