Bug 1751331 - Use the mozbuild crate in gecko-profiler. r=canaltinova

Differential Revision: https://phabricator.services.mozilla.com/D136566
This commit is contained in:
Mike Hommey 2022-01-25 21:29:53 +00:00
Родитель e467585271
Коммит b82810b455
4 изменённых файлов: 8 добавлений и 14 удалений

1
Cargo.lock сгенерированный
Просмотреть файл

@ -1874,6 +1874,7 @@ dependencies = [
"bincode",
"bindgen",
"lazy_static",
"mozbuild",
"profiler-macros",
"serde",
]

Просмотреть файл

@ -9,10 +9,12 @@ profiler-macros = { path = "./macros" }
lazy_static = "1"
serde = { version = "1.0", features = ["derive"] }
bincode = "1"
mozbuild = "0.1"
[build-dependencies]
lazy_static = "1"
bindgen = {version = "0.56", default-features = false}
mozbuild = "0.1"
[features]
# This feature is being set by Gecko. If it's not set, all public functions and

Просмотреть файл

@ -24,24 +24,16 @@ const BINDINGS_FILE: &str = "bindings.rs";
lazy_static! {
static ref BINDGEN_FLAGS: Vec<String> = {
// Load build-specific config overrides.
let path = PathBuf::from(env::var_os("MOZ_TOPOBJDIR").unwrap())
.join("tools/profiler/rust-api/extra-bindgen-flags");
let path = mozbuild::TOPOBJDIR.join("tools/profiler/rust-api/extra-bindgen-flags");
println!("cargo:rerun-if-changed={}", path.to_str().unwrap());
fs::read_to_string(path).expect("Failed to read extra-bindgen-flags file")
.split_whitespace()
.map(std::borrow::ToOwned::to_owned)
.collect()
};
static ref DISTDIR_PATH: PathBuf = {
let path = PathBuf::from(env::var_os("MOZ_TOPOBJDIR").unwrap());
if !path.is_absolute() || !path.is_dir() {
panic!("MOZ_TOPOBJDIR must be an absolute directory, was: {}", path.display());
}
path.join("dist")
};
static ref SEARCH_PATHS: Vec<PathBuf> = vec![
DISTDIR_PATH.join("include"),
DISTDIR_PATH.join("include/nspr"),
mozbuild::TOPOBJDIR.join("dist/include"),
mozbuild::TOPOBJDIR.join("dist/include/nspr"),
];
}

Просмотреть файл

@ -8,9 +8,8 @@
//! `mozglue/baseprofiler/generate_profiling_categories.py`, from
//! 'mozglue/baseprofiler/core/profiling_categories.yaml`.
include!(concat!(
env!("MOZ_TOPOBJDIR"),
"/tools/profiler/rust-api/src/gecko_bindings/profiling_categories.rs"
include!(mozbuild::objdir_path!(
"tools/profiler/rust-api/src/gecko_bindings/profiling_categories.rs"
));
/// Helper macro that returns the profiling category pair from either only