Skip to content

Commit cdfc884

Browse files
committed
Prepare build system for the incoming migration to gecko 128.14.0
First of all we're specifying that the gecko substitution should be done for the omni version of the GeckoView packages. By default if omni is not specified then gradle expects the lite version. For a full fledged browser the omni version should be used. That brings some challenges. For example glean is provided both by GV and android components so we had to had some dependency analysis code to select the one from GV (this is also done by Mozilla in their reference browser implementation). Last but not least, the dependency analysis forced us to bump the gradle and gradle plugin versions.
1 parent a13c749 commit cdfc884

File tree

4 files changed

+49
-11
lines changed

4 files changed

+49
-11
lines changed

app/build.gradle

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if (getGradle().getStartParameter().getTaskRequests().toString() =~ /[Hh]vr/
1616

1717
def getGitHash = { ->
1818
def stdout = new ByteArrayOutputStream()
19-
exec {
19+
project.exec {
2020
commandLine 'git', 'rev-parse', '--short', 'HEAD'
2121
standardOutput = stdout
2222
}
@@ -156,8 +156,6 @@ android {
156156
vectorDrawables.useSupportLibrary = true
157157
}
158158

159-
project.archivesBaseName = "Wolvic"
160-
161159
compileOptions {
162160
sourceCompatibility JavaVersion.VERSION_1_8
163161
targetCompatibility JavaVersion.VERSION_1_8
@@ -202,6 +200,19 @@ android {
202200
}
203201
}
204202

203+
// Select the Glean from GeckoView.
204+
// `service-sync-logins` requires Glean, which pulls in glean-native,
205+
// but that's also provided by geckoview-omni, so now we need to select which one to use.
206+
project.configurations.configureEach {
207+
resolutionStrategy.capabilitiesResolution.withCapability("org.mozilla.telemetry:glean-native") {
208+
def toBeSelected = candidates.find { it.id instanceof ModuleComponentIdentifier && it.id.module.contains('geckoview') }
209+
if (toBeSelected != null) {
210+
select(toBeSelected)
211+
}
212+
because 'use GeckoView Glean instead of standalone Glean'
213+
}
214+
}
215+
205216
applicationVariants.configureEach { variant ->
206217
// Use different version names for release builds for each backend.
207218
def backend = variant.productFlavors.get(2).name

build.gradle

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ buildscript {
1717
}
1818
}
1919

20+
plugins {
21+
alias libs.plugins.dependency.analysis
22+
}
23+
2024
allprojects {
2125
repositories {
2226
google()
@@ -26,6 +30,27 @@ allprojects {
2630
}
2731
}
2832

33+
dependencyAnalysis {
34+
structure {
35+
// Ignore Android KTX dependencies. See https://developer.android.com/kotlin/ktx#modules
36+
ignoreKtx(true)
37+
}
38+
issues {
39+
all {
40+
onAny {
41+
// Fail the run if any issues are found (default = 'warn')
42+
severity('fail')
43+
// Ignore warnings about kotlin-stdlib since we don't directly control its usage
44+
exclude('org.jetbrains.kotlin:kotlin-stdlib')
45+
}
46+
onUsedTransitiveDependencies {
47+
// We explicitly want to pull in these dependencies transitively from AC
48+
exclude('org.mozilla.appservices.nightly:fxaclient', 'org.mozilla.geckoview:geckoview-omni')
49+
}
50+
}
51+
}
52+
}
53+
2954
tasks.register("clean", Delete) {
3055
delete layout.buildDirectory
3156
}

gradle/libs.versions.toml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[versions]
2-
agp = "8.7.2"
2+
agp = "8.11.1"
33
androidComponents = "128.0"
44
androidxAnnotation = "1.6.0"
55
androidxAppcompat = "1.6.1"
@@ -18,6 +18,7 @@ atslRunner = "1.5.2"
1818
atslJunit = "1.1.5"
1919
colorpickerpreference = "2.0.6"
2020
desugarJdkLibs = "2.1.4"
21+
dependency-analysis = "3.0.1"
2122
diskLruCache = "2.0.2"
2223
espresso= "3.5.1"
2324
gamesActivity = "4.0.0"
@@ -96,12 +97,12 @@ espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref =
9697
# Games Activity
9798
games-activity = { module = "androidx.games:games-activity", version.ref = "gamesActivity" }
9899
# GeckoView
99-
geckoview-beta-arm64 = { module = "org.mozilla.geckoview:geckoview-beta-arm64-v8", version.ref = "geckoviewBeta" }
100-
geckoview-beta-x64 = { module = "org.mozilla.geckoview:geckoview-beta-x86_64", version.ref = "geckoviewBeta" }
101-
geckoview-nightly-arm64 = { module = "org.mozilla.geckoview:geckoview-nightly-arm64-v8a", version.ref = "geckoviewNightly" }
102-
geckoview-nightly-x64 = { module = "org.mozilla.geckoview:geckoview-nightly-x86_64", version.ref = "geckoviewNightly" }
103-
geckoview-release-arm64 = { module = "org.mozilla.geckoview:geckoview-arm64-v8a", version.ref = "geckoviewRelease" }
104-
geckoview-release-x64 = { module = "org.mozilla.geckoview:geckoview-x86_64", version.ref = "geckoviewRelease" }
100+
geckoview-beta-arm64 = { module = "org.mozilla.geckoview:geckoview-omni-beta-arm64-v8", version.ref = "geckoviewBeta" }
101+
geckoview-beta-x64 = { module = "org.mozilla.geckoview:geckoview-omni-beta-x86_64", version.ref = "geckoviewBeta" }
102+
geckoview-nightly-arm64 = { module = "org.mozilla.geckoview:geckoview-nightly-omni-arm64-v8a", version.ref = "geckoviewNightly" }
103+
geckoview-nightly-x64 = { module = "org.mozilla.geckoview:geckoview-nightly-omni-x86_64", version.ref = "geckoviewNightly" }
104+
geckoview-release-arm64 = { module = "org.mozilla.geckoview:geckoview-omni-arm64-v8a", version.ref = "geckoviewRelease" }
105+
geckoview-release-x64 = { module = "org.mozilla.geckoview:geckoview-omni-x86_64", version.ref = "geckoviewRelease" }
105106
# GSON
106107
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
107108
# Huawei
@@ -161,4 +162,5 @@ work-testing = { module = "androidx.work:work-testing", version.ref = "androidxW
161162
zip4j = { module = "net.lingala.zip4j:zip4j", version.ref = "zip4j" }
162163

163164
[plugins]
165+
dependency-analysis = { id = "com.autonomousapps.dependency-analysis", version.ref = "dependency-analysis" }
164166
jetbrains-python-envs = { id = "com.jetbrains.python.envs", version.ref = "jetbrainsPython" }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Wed Jul 21 16:13:31 CEST 2021
22
distributionBase=GRADLE_USER_HOME
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists
66
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)