Skip to content

Bug 2018944 - glean-sym - a Rust API built on top of the Glean UniFFI C FFI#3426

Open
badboy wants to merge 14 commits intomainfrom
glean-sys-generated
Open

Bug 2018944 - glean-sym - a Rust API built on top of the Glean UniFFI C FFI#3426
badboy wants to merge 14 commits intomainfrom
glean-sys-generated

Conversation

@badboy
Copy link
Copy Markdown
Member

@badboy badboy commented Mar 30, 2026

This small patch on a-s makes use of the new glean-sys crate: mozilla/application-services@main...badboy:application-services:glean-dylib

Todo:

  • Naming! Not sure I like glean-sys. it was decided: glean-sym (as in glean-symbols)
  • Testing. Not clear how we will do that. Probably some sample crate that uses glean-sys and we inject a libxul.so into it at test time
  • glean-sys/src/metrics.rs is generated. Currently by a test. That has a bit of a problem that you need to compile the code to generate the code, which breaks if the code doesn't compile. Might want to have a non-test way to generate that code.
  • libxul.so is hard-coded. Ok for manual testing in Fenix, not sure we want to ship that as-is
  • No way to ensure we're not the first ones loading libxul.
  • Should we have the UniFFI-alike runtime checks? (like the version check)
  • Extend glean_parser (and glean-build) to generate the correct code usable with glean-sys
  • Dependency vetting
  • Rust minimum version bump probably necessary (or we need to exclude glean-sys)

@badboy badboy force-pushed the glean-sys-generated branch 2 times, most recently from dab03d7 to 23adcc4 Compare March 30, 2026 11:31
Comment thread glean-core/glean-sym/src/lib.rs
@badboy badboy force-pushed the glean-sys-generated branch from 23adcc4 to a6d1ef4 Compare March 30, 2026 12:54
@badboy badboy mentioned this pull request Apr 16, 2026
@badboy badboy force-pushed the glean-sys-generated branch 5 times, most recently from e1571f1 to 6a7603a Compare April 17, 2026 17:34
@badboy badboy changed the title Bug 2018944 - glean-sys - a Rust API built on top of the Glean UniFFI C FFI Bug 2018944 - glean-sym - a Rust API built on top of the Glean UniFFI C FFI Apr 22, 2026
@badboy badboy force-pushed the glean-sys-generated branch 5 times, most recently from 9b3dd70 to 85d08d6 Compare April 23, 2026 15:59
@badboy badboy marked this pull request as ready for review April 23, 2026 15:59
@badboy badboy requested a review from a team as a code owner April 23, 2026 15:59
@badboy badboy requested review from travis79 and removed request for a team April 23, 2026 15:59
@badboy
Copy link
Copy Markdown
Member Author

badboy commented Apr 23, 2026

I would like to land this (experimentally) sometime soon. The plan is to test it out with a metric in appservices, see https://bugzilla.mozilla.org/show_bug.cgi?id=2034534
PoC: badboy/application-services@2c0f79a

Given this is an experiment and not a released crate we can tackle the open questions as we go along, instead of landing the perfectly finished PR.

Copy link
Copy Markdown
Member

@travis79 travis79 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, a decent first pass with several questions. Nothing really big aside from the comments in the metrics.rs about the mismatched Double type being bool

Comment thread glean-core/glean-sym/src/metrics.rs Outdated
Comment thread tools/glean-sym-parser/src/type_resolver.rs Outdated
Comment thread tools/glean-sym-parser/src/type_resolver.rs Outdated
Comment thread glean-core/glean-sym/src/types.rs
Comment thread glean-core/glean-sym/src/util.rs Outdated
Comment thread glean-core/glean-sym/tests/parser.rs
Comment thread supply-chain/config.toml
Comment thread .circleci/config.yml
Comment thread glean-core/glean-sym/Cargo.toml Outdated
@badboy badboy force-pushed the glean-sys-generated branch from 4a23b84 to 8fd60b6 Compare May 6, 2026 12:19
badboy added 5 commits May 6, 2026 14:52
…ated code over FFI

This will be used later by glean-sys to build a Rust API via C FFI.
…C FFI

This loads `libxul.so` (currently hard-coded), looks up the required symbols and wraps that in
a nice Rust API.
Other crates can depend on `glean-sym`, without needing to have Glean in
the same library.
not done yet
@badboy badboy force-pushed the glean-sys-generated branch from 8fd60b6 to e518814 Compare May 6, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants