From fc5fd8853e1e231264fa32acf418849b224f9694 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Fri, 15 Sep 2017 16:33:29 +0200 Subject: [PATCH] Fix running `cargo test -p stylo_test` from repo root MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … in order to add it to Rust CI though https://github.com/rust-lang/rust/blob/master/src/tools/cargotest/main.rs --- components/style/build_gecko.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/components/style/build_gecko.rs b/components/style/build_gecko.rs index 32ec46c1334..caf4601a6ea 100644 --- a/components/style/build_gecko.rs +++ b/components/style/build_gecko.rs @@ -550,7 +550,8 @@ mod bindings { } fn generate_atoms() { - let script = Path::new(file!()).parent().unwrap().join("gecko").join("regen_atoms.py"); + let script = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()) + .join("gecko").join("regen_atoms.py"); println!("cargo:rerun-if-changed={}", script.display()); let status = Command::new(&*PYTHON) .arg(&script) @@ -596,11 +597,12 @@ mod bindings { #[cfg(not(feature = "bindgen"))] mod bindings { - use std::path::Path; + use std::env; + use std::path::PathBuf; use super::common::*; pub fn generate() { - let dir = Path::new(file!()).parent().unwrap().join("gecko/generated"); + let dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()).join("gecko/generated"); println!("cargo:rerun-if-changed={}", dir.display()); copy_dir(&dir, &*OUTDIR_PATH, |path| { println!("cargo:rerun-if-changed={}", path.display());