Skip to content

Commit

Permalink
Bug 1832711 - Update readme and docs for how to use local GV in Fenix
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac McKenney authored and mergify[bot] committed May 16, 2023
1 parent f471109 commit 10da214
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 108 deletions.
8 changes: 1 addition & 7 deletions fenix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,7 @@ If you wish to use a custom Glean server during local development, you can add a
- `glean.custom.server.url`
### GeckoView
Specify a relative path to your local `mozilla-central` checkout via `dependencySubstitutions.geckoviewTopsrcdir`,
and optional a path to m-c object directory via `dependencySubstitutions.geckoviewTopobjdir`.
If these are configured, local builds of GeckoView will be used instead of what's configured in Dependencies.kt.
For more details, see https://firefox-source-docs.mozilla.org/mobile/android/geckoview/contributor/geckoview-quick-start.html#include-geckoview-as-a-dependency
See notes on building successfully in the `android-components` auto-publication section.
For building with a local checkout of `mozilla-central` see [Substituting Local GeckoView](https://github.com/mozilla-mobile/firefox-android/blob/main/fenix/docs/substituting-local-gv.md)
## License
Expand Down
101 changes: 0 additions & 101 deletions fenix/docs/substituting-local-ac-and-gv.md

This file was deleted.

94 changes: 94 additions & 0 deletions fenix/docs/substituting-local-gv.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Substituting local GeckoView

### 1. Manually publish local GeckoView to local Maven
First, to get the version that we are locally publishing (which will be used in later steps) please add the following:

*geckoview/build.gradle*
```diff
diff --git a/mobile/android/geckoview/build.gradle b/mobile/android/geckoview/build.gradle
index 731026796921b..81cc6782be291 100644
--- a/mobile/android/geckoview/build.gradle
+++ b/mobile/android/geckoview/build.gradle
@@ -398,6 +398,7 @@ android.libraryVariants.all { variant ->
apply plugin: 'maven-publish'

version = getVersionNumber()
+println("version = " + version)
group = 'org.mozilla.geckoview'

def getArtifactId() {

```

We can now publish our local GeckoView to our local maven.
```sh
./mach build && ./mach gradle \
geckoview:publishWithGeckoBinariesDebugPublicationToMavenLocal \
exoplayer2:publishDebugPublicationToMavenLocal
```

:warning: **This needs to be run every time you make changes.** :warning:

You need to copy the version in the logs or run
```sh
./mach build | grep version
```
(ex. `115.0.20230511122045-SNAPSHOT`)

### 2. Modify Fenix to consume local GV
Update the build.gradle and Gecko.kt file in Fenix (see the diffs below). Remember to update the GV version with the version you found in step 2!

*fenix/build.gradle*
```diff
diff --git a/fenix/build.gradle b/fenix/build.gradle
index 6a635a4818..4c8cc28995 100644
--- a/fenix/build.gradle
+++ b/fenix/build.gradle
@@ -5,6 +5,7 @@ import org.mozilla.fenix.gradle.tasks.GithubDetailsTask
buildscript {
// This logic is duplicated in the allprojects block: I don't know how to fix that.
repositories {
+ mavenLocal()
maven {
name "Mozilla Nightly"
url "https://nightly.maven.mozilla.org/maven2"
@@ -90,6 +91,7 @@ plugins {
allprojects {
// This logic is duplicated in the buildscript block: I don't know how to fix that.
repositories {
+ mavenLocal()
maven {
name "Mozilla Nightly"
url "https://nightly.maven.mozilla.org/maven2"
```
*Gecko.kt*
```diff
diff --git a/android-components/plugins/dependencies/src/main/java/Gecko.kt b/android-components/plugins/dependencies/src/main/java/Gecko.kt
index bed3fb0161..2d3a19a96e 100644
--- a/android-components/plugins/dependencies/src/main/java/Gecko.kt
+++ b/android-components/plugins/dependencies/src/main/java/Gecko.kt
@@ -9,7 +9,7 @@ object Gecko {
/**
* GeckoView Version.
*/
- const val version = "115.0.20230511131014"
+ const val version = "115.0.20230511122045-SNAPSHOT"

/**
* GeckoView channel
@@ -23,7 +23,7 @@ object Gecko {
enum class GeckoChannel(
val artifactName: String,
) {
- NIGHTLY("geckoview-nightly-omni"),
+ NIGHTLY("geckoview-default-omni"),
BETA("geckoview-beta-omni"),
RELEASE("geckoview-omni"),
}

```

### 3. Build fenix with local GV
Now sync your gradle changes and build!

An easy way to confirm you are using a local GV is switching your Android Studio project tool window to "Project" and looking in the root directory called "External Libraries" for "GeckoView". You should see something like `Gradle: org.mozilla.geckoview-default-omni:115.0.20230511122045-SNAPSHOT@aar`

0 comments on commit 10da214

Please sign in to comment.