Developing with a local Glean build¶
FOG uses a release version of Glean, as published on crates.io.
For local development and try runs you can replace this Glean implementation with a local or remote version.
To tell
mach
where to find your Glean, patch the top-level Cargo.toml to point at your Glean fork:[patch.crates-io] glean = { git = "https://github.com/myfork/glean", branch = "my-feature-branch" } glean-core = { git = "https://github.com/myfork/glean", branch = "my-feature-branch" }
Both crates need to be specified to ensure they are in sync.
You can specify the exact code to use by
branch
,tag
orrev
(Git commit). See the cargo documentation for details.You can also use a path dependency, for a truly local Glean:
[patch.crates-io] glean = { path = "../glean/glean-core/rlb" } glean-core = { path = "../glean/glean-core" }
If the version of the Glean SDK in the patched repository is not semver-compatible with the versions required by the workspaces within mozilla-central, trying to update the Cargo lockfile at this time will result in an error like
warning: Patch `glean vMM.m.p (/path/to/glean/glean-core/rlb)` was not used in the crate graph.
In this case, change the
glean
crate version in both Cargo.toml and gfx/wr/Cargo.toml to match the version in yourglean
repo:glean = "=MM.m.p"
Update the Cargo lockfile for the root workspace:
cargo update -p glean
(You’d think that, if you had to change gfx/wr/Cargo.toml in step 2, you’d have to
cargo update
ingfx/wr
too, but you’d be wrong. It’s not needed, and if you try it’ll just error aboutcrates.io
not knowing about your local version of Glean.)Mozilla’s supply-chain management policy requires that third-party software (which includes the Glean SDK because it is distributed as though it is third-party) be audited and certified as safe. Your local Glean SDK is not coming from a source that has been vetted. If you try to vendor right now,
./mach vendor rust
may complain something like:Vet error: There are some issues with your policy.audit-as-crates-io entries
To allow your local Glean crates to be treated as crates.io-sourced crates for vetting, add the following sections to the top of
supply-chain/config.toml
:[policy.glean] audit-as-crates-io = true [policy.glean-core] audit-as-crates-io = true
Note: Do not attempt to check these changes in.
@supply-chain-reviewers
may become cross as theyr-
your patch.Vendor the changed crates:
./mach vendor rust
Note: If you’re using a path dependency,
mach vendor rust
doesn’t actually change files. Instead it pulls the files directly from the location on disk you specify.Finally, build Firefox:
./mach build
A remote git
reference works for try runs as well,
but a path
dependency will not.
Please ensure you do not land a non-release version of Glean.