Bug 1751331 - Use the mozbuild crate in glean. r?chutten draft
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 21 Jan 2022 06:18:26 +0000
changeset 4180198 a2c3c0a959ab6f2037636a1170130ba090364a8e
parent 4180197 038ea363d994917c7296a386507d2f2c50490ae8
child 4180199 f97b22de4c2359a3e1122b986ba664adb6ca4eeb
push id771620
push userreviewbot
push dateFri, 21 Jan 2022 06:18:54 +0000
treeherdertry@42009296bf68 [default view] [failures only]
reviewerschutten
bugs1751331
milestone98.0a1
Bug 1751331 - Use the mozbuild crate in glean. r?chutten Differential Diff: PHID-DIFF-4zokbpzlpiaehqyy4yg2
Cargo.lock
toolkit/components/glean/api/Cargo.toml
toolkit/components/glean/api/src/metrics.rs
toolkit/components/glean/api/src/pings.rs
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1659,16 +1659,17 @@ checksum = "3f9eec918d3f24069decb9af1554
 name = "fog"
 version = "0.1.0"
 dependencies = [
  "bincode",
  "chrono",
  "glean",
  "inherent",
  "log",
+ "mozbuild",
  "nsstring",
  "once_cell",
  "serde",
  "tempfile",
  "thin-vec",
  "uuid",
  "xpcom",
 ]
--- a/toolkit/components/glean/api/Cargo.toml
+++ b/toolkit/components/glean/api/Cargo.toml
@@ -12,14 +12,15 @@ glean = "43.0.2"
 inherent = "0.1.4"
 log = "0.4"
 nsstring = { path = "../../../../xpcom/rust/nsstring", optional = true }
 once_cell = "1.2.0"
 serde = { version = "1.0", features = ["derive"] }
 uuid = { version = "0.8.1", features = ["v4"] }
 xpcom = { path = "../../../../xpcom/rust/xpcom", optional = true }
 thin-vec = { version = "0.2.1", features = ["gecko-ffi"] }
+mozbuild = { version = "0.1", optional = true }
 
 [dev-dependencies]
 tempfile = "3.1.0"
 
 [features]
-with_gecko = ["xpcom", "nsstring"]
+with_gecko = ["xpcom", "nsstring", "mozbuild"]
--- a/toolkit/components/glean/api/src/metrics.rs
+++ b/toolkit/components/glean/api/src/metrics.rs
@@ -4,20 +4,17 @@
 
 //! This file contains the Generated Glean Metrics API
 //!
 //! The contents of this module are generated by
 //! `toolkit/components/glean/build_scripts/glean_parser_ext/run_glean_parser.py`, from
 //! 'toolkit/components/glean/metrics.yaml`.
 
 #[cfg(not(feature = "cargo-clippy"))]
-include!(concat!(
-    env!("MOZ_TOPOBJDIR"),
-    "/toolkit/components/glean/api/src/metrics.rs"
-));
+include!(mozbuild::objdir_path!("toolkit/components/glean/api/src/metrics.rs"));
 
 #[cfg(not(feature = "cargo-clippy"))]
 use crate::private::{EventMetric, EventRecordingError, ExtraKeys};
 
 /// Helper to get the number of allowed extra keys for a given event metric.
 #[cfg(not(feature = "cargo-clippy"))]
 fn extra_keys_len<K: ExtraKeys>(_event: &EventMetric<K>) -> usize {
     K::ALLOWED_KEYS.len()
--- a/toolkit/components/glean/api/src/pings.rs
+++ b/toolkit/components/glean/api/src/pings.rs
@@ -4,12 +4,9 @@
 
 //! This file contains the Generated Glean Metrics API (Ping portion)
 //!
 //! The contents of this module are generated by
 //! `toolkit/components/glean/build_scripts/glean_parser_ext/run_glean_parser.py`, from
 //! 'toolkit/components/glean/pings.yaml`.
 
 #[cfg(not(feature = "cargo-clippy"))]
-include!(concat!(
-    env!("MOZ_TOPOBJDIR"),
-    "/toolkit/components/glean/api/src/pings.rs"
-));
+include!(mozbuild::objdir_path!("toolkit/components/glean/api/src/pings.rs"));