-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite docs on how to use local glean plugin in m-c
[doc only]
- Loading branch information
Showing
6 changed files
with
91 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Working on unreleased Glean code in mozilla-central | ||
|
||
> **Note**: This guide is for mozilla-central Android builds. If you only need to replace the Glean Rust parts, refer to [Developing with a local Glean build](https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/local_glean.html) in the Firefox Source Docs. | ||
> **Note**: This guide only refers to building Fenix. It should work similarly for Focus Android. | ||
## Preparation | ||
|
||
This guide assumes you already have are setup to build the mozilla-central repository for Android. | ||
Refer to [Getting Set Up To Work On The Firefox Codebase](https://firefox-source-docs.mozilla.org/setup/index.html) for more. | ||
|
||
Clone the Glean SDK repositories: | ||
|
||
```sh | ||
git clone https://github.com/mozilla/glean | ||
``` | ||
|
||
## Cargo build targets | ||
|
||
By default when building Fenix using gradle, the rust-android plugin will compile Glean for every possible platform, | ||
which might end up in build failures. | ||
You can customize which targets are built in `glean/local.properties` | ||
([more information](https://github.com/ncalexan/rust-android-gradle/blob/HEAD/README.md#specifying-local-targets)): | ||
|
||
``` | ||
# For physical devices: | ||
rust.targets=arm | ||
# For unit tests: | ||
# rust.targets=darwin # Or linux-*, windows-* (* = x86/x64) | ||
# For emulator only: | ||
rust.targets=x86 | ||
``` | ||
|
||
## Substituting projects | ||
|
||
Fenix has custom build logic for dealing with composite builds, | ||
so you should be able to configure it by simply adding the path to the Glean repository in the correct `local.properties` file: | ||
|
||
In `mozilla-central/mobile/android/fenix/local.properties`: | ||
|
||
```groovy | ||
autoPublish.glean.dir=../../../../glean | ||
``` | ||
|
||
Make sure to use the correct path pointing to your Glean checkout. | ||
|
||
> **Note**: This substitution-based approach will not work for testing updates to the Glean Gradle plugin or `glean_parser` as shipped in the Glean Gradle Plugin. | ||
> | ||
> See [Replacing the Glean Gradle plugin in mozilla-central](android/gradle-plugin-in-mc.md). | ||
> For replacing `glean_parser` in a local build, see [Substituting `glean_parser`](glean-parser-substitution.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Replacing the Glean Gradle plugin in mozilla-central | ||
|
||
> **Note**: If you only need to replace the `glean_parser` Python parts used in the build see [Substituting `glean_parser`](glean-parser-substitution.md). | ||
> The approached documented in this chapter is only necessary if you changed `GleanGradlePlugin.groovy`. | ||
If you need to replace the Glean Gradle Plugin used by any component in mozilla-central, follow these steps: | ||
|
||
1. In your Glean repository increment the version number in `.buildconfig.yml` to something unused: | ||
|
||
```yaml | ||
libraryVersion: 70.0.0 | ||
``` | ||
1. Build the Glean Gradle plugin and publish the plugin locally: | ||
``` | ||
./gradlew glean-gradle-plugin:publishToMavenLocal | ||
``` | ||
|
||
1. In your `mozilla-central` checkout, add the following line in `mobile/android/fenix/settings.gradle` file in the `pluginManagement` block: | ||
|
||
```gradle | ||
mavenLocal() | ||
``` | ||
|
||
1. Use the new version number where the plugin is imported in `mobile/android/fenix/build.gradle`: | ||
|
||
``` | ||
classpath "org.mozilla.telemetry:glean-gradle-plugin:70.0.0" | ||
``` | ||
|
||
This might need to be applied to the top-level `build.gradle` and other `build.gradle` files under `mobile/android` to apply to all components. | ||
|
||
|
||
Building Fenix will now use your locally published Glean Gradle Plugin. |
This file was deleted.
Oops, something went wrong.