Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ commands:
pip install uv
cd samples/glean-sym-test
make run
make run-noop

install-rustup:
steps:
Expand Down
4 changes: 4 additions & 0 deletions glean-core/glean-sym/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ uniffi = "0.31.0"
xshell = "0.2.7"
glean-sym-parser = { path = "../../tools/glean-sym-parser" }
glean-core = { path = "../" }

[features]
# No-op all metric type calls
noop = []
7 changes: 7 additions & 0 deletions glean-core/glean-sym/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

#[cfg(not(feature = "noop"))]
use std::sync::LazyLock;

#[doc(hidden)]
Expand All @@ -26,9 +27,11 @@ pub mod __export {
pub use once_cell::sync::Lazy;
}

#[cfg(not(feature = "noop"))]
const FFI_CONTRACT_VERSION: u32 = include!("contract_version.txt");

// Based on https://searchfox.org/firefox-main/rev/6193f8fd1172486e3ce941b8de251b9d1a4dfa0b/toolkit/crashreporter/client/app/src/net/libcurl.rs#84
#[cfg(not(feature = "noop"))]
macro_rules! library_binding {
( $localname:ident members[$($members:tt)*] load[$($load:tt)*] fn $name:ident $args:tt $( -> $ret:ty )? ; $($rest:tt)* ) => {
library_binding! {
Expand Down Expand Up @@ -106,10 +109,12 @@ macro_rules! library_binding {

pub mod metrics;
pub mod types;
#[cfg(not(feature = "noop"))]
mod util;

pub use types::PingType;

#[cfg(not(feature = "noop"))]
static GLEAN: LazyLock<metrics::GleanSym> = LazyLock::new(|| metrics::GleanSym::load().unwrap());

// This boilerplate is usually generated by `uniffi::setup_scaffolding!()`
Expand All @@ -124,12 +129,14 @@ pub struct UniFfiTag;
/// The namespace glean-sym FFI items are placed in.
/// Required by UniFFI to match up items.
#[allow(clippy::large_const_arrays)] // this is moved into the `static` below, we can't make it a static itself.
#[cfg(not(feature = "noop"))]
const UNIFFI_META_CONST_NAMESPACE_GLEAN_SYM: ::uniffi::MetadataBuffer =
::uniffi::MetadataBuffer::from_code(::uniffi::metadata::codes::NAMESPACE)
.concat_str("glean_sym")
.concat_str("glean_sym");
#[doc(hidden)]
#[unsafe(no_mangle)]
#[cfg(not(feature = "noop"))]
pub static UNIFFI_META_NAMESPACE_GLEAN_SYM: [::std::primitive::u8;
UNIFFI_META_CONST_NAMESPACE_GLEAN_SYM.size] =
UNIFFI_META_CONST_NAMESPACE_GLEAN_SYM.into_array();
Loading
Loading