Bug 1822393 - Support Android Components consuming GeckoView directly. r=nalexander,geckoview-reviewers,tthibaud,android-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D201483
This commit is contained in:
Gabriel Luong 2023-12-07 16:19:43 -05:00
parent 0e54430926
commit 52bb5c21a8
5 changed files with 62 additions and 5 deletions

View File

@ -14,7 +14,12 @@ buildscript {
}
}
ext.kotlin_version = '1.9.22'
ext {
kotlin_version = Versions.kotlin
detekt_plugin = Versions.detekt
python_envs_plugin = Versions.python_envs_plugin
ksp_plugin = Versions.ksp_plugin
}
dependencies {
classpath 'org.mozilla.apilint:apilint:0.5.2'
@ -26,6 +31,11 @@ buildscript {
}
}
plugins {
id("io.gitlab.arturbosch.detekt").version("$detekt_plugin")
id("com.google.devtools.ksp").version("$ksp_plugin")
}
def tryInt = { string ->
if (string == null) {
return string
@ -404,4 +414,16 @@ subprojects {
ktlint('0.49.1')
}
}
project.configurations.configureEach {
resolutionStrategy.capabilitiesResolution.withCapability("org.mozilla.telemetry:glean-native") {
def toBeSelected = candidates.find {
it.id instanceof ProjectComponentIdentifier && it.id.projectName.contains('geckoview')
}
if (toBeSelected != null) {
select(toBeSelected)
}
because 'use GeckoView Glean instead of standalone Glean'
}
}
}

View File

@ -276,8 +276,11 @@ subprojects {
}
}
tasks.register("clean", Delete) {
delete rootProject.layout.buildDirectory
if (findProject(":geckoview") == null) {
// Avoid adding this task if it already exists in a different root project.
tasks.register("clean", Delete) {
delete rootProject.layout.buildDirectory
}
}
detekt {

View File

@ -65,7 +65,11 @@ dependencies {
}
implementation ComponentsDependencies.kotlin_coroutines
api ComponentsDependencies.mozilla_geckoview
if (findProject(":geckoview") != null) {
api project(':geckoview')
} else {
api ComponentsDependencies.mozilla_geckoview
}
implementation ComponentsDependencies.androidx_paging
implementation ComponentsDependencies.androidx_data_store_preferences

View File

@ -2,9 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
if (findProject(":geckoview") != null) {
buildDir "${topobjdir}/gradle/build/mobile/android/samples-browser"
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
if (findProject(":geckoview") != null) {
apply from: "${topsrcdir}/mobile/android/gradle/product_flavors.gradle"
}
android {
defaultConfig {
applicationId "org.mozilla.samples.browser"
@ -26,7 +34,12 @@ android {
}
}
flavorDimensions "engine"
if (findProject(":geckoview") != null) {
project.configureProductFlavors.delegate = it
project.configureProductFlavors()
}
flavorDimensions += "engine"
productFlavors {
gecko {

View File

@ -1,3 +1,14 @@
pluginManagement {
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/android-components/plugins/github")
}
plugins {
id 'mozac.DependenciesPlugin'
id 'mozac.GitHubPlugin'
}
// You might think topsrcdir is '.', but that's not true when the Gradle build
// is launched from within IntelliJ.
ext.topsrcdir = rootProject.projectDir.absolutePath
@ -16,12 +27,16 @@ include ':geckoview'
include ':geckoview_example'
include ':test_runner'
include ':exoplayer2'
include ':android-components'
include ':samples-browser'
project(':annotations').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/annotations")
project(':geckoview').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/geckoview")
project(':geckoview_example').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/geckoview_example")
project(':test_runner').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/test_runner")
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")
if (hasProperty("androidFormatLintTest")) {
include ':androidFormatLintTest'