diff options
-rw-r--r-- | components/style/Cargo.toml | 3 | ||||
-rw-r--r-- | components/style/build.rs | 1 | ||||
-rw-r--r-- | components/style/lib.rs | 2 | ||||
-rw-r--r-- | python/servo/testing_commands.py | 7 | ||||
-rw-r--r-- | tests/unit/stylo/build.rs | 13 | ||||
-rw-r--r-- | tests/unit/stylo/lib.rs | 6 |
6 files changed, 25 insertions, 7 deletions
diff --git a/components/style/Cargo.toml b/components/style/Cargo.toml index 708488861e8..e19f2b00768 100644 --- a/components/style/Cargo.toml +++ b/components/style/Cargo.toml @@ -7,6 +7,9 @@ publish = false build = "build.rs" +# https://github.com/rust-lang/cargo/issues/3544 +links = "for some reason the links key is required to pass data around between build scripts" + [lib] name = "style" path = "lib.rs" diff --git a/components/style/build.rs b/components/style/build.rs index 8d40ccb9969..d31bc87e88a 100644 --- a/components/style/build.rs +++ b/components/style/build.rs @@ -83,6 +83,7 @@ fn generate_properties() { fn main() { println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:out_dir={}", env::var("OUT_DIR").unwrap()); generate_properties(); build_gecko::generate(); } diff --git a/components/style/lib.rs b/components/style/lib.rs index 4210304217f..fc61dd1b001 100644 --- a/components/style/lib.rs +++ b/components/style/lib.rs @@ -61,7 +61,7 @@ extern crate log; extern crate matches; #[cfg(feature = "gecko")] #[macro_use] -extern crate nsstring_vendor as nsstring; +pub extern crate nsstring_vendor as nsstring; #[cfg(feature = "gecko")] extern crate num_cpus; extern crate num_integer; extern crate num_traits; diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index 64d79e38501..a36d50c2658 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -299,13 +299,8 @@ class MachCommands(CommandBase): env["CARGO_TARGET_DIR"] = path.join(self.context.topdir, "target", "geckolib").encode("UTF-8") release = ["--release"] if release else [] - ret = 0 with cd(path.join("ports", "geckolib")): - ret = call(["cargo", "test", "-p", "stylo_tests", "--features", "testing"] + release, env=env) - if ret != 0: - return ret - with cd(path.join("ports", "geckolib")): - return call(["cargo", "test", "-p", "style"] + release, env=env) + return call(["cargo", "test", "-p", "stylo_tests", "--features", "testing"] + release, env=env) @Command('test-compiletest', description='Run compiletests', diff --git a/tests/unit/stylo/build.rs b/tests/unit/stylo/build.rs index fe161688da3..111da70f57e 100644 --- a/tests/unit/stylo/build.rs +++ b/tests/unit/stylo/build.rs @@ -2,6 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use std::env; +use std::fs; +use std::io::Write; +use std::path; use std::process::Command; fn main() { @@ -11,4 +15,13 @@ fn main() { println!("cargo:rerun-if-changed=../../../components/style/gecko_bindings/bindings.rs"); assert!(Command::new("python").arg("./check_bindings.py") .spawn().unwrap().wait().unwrap().success()); + + // https://github.com/rust-lang/cargo/issues/3544 + let style_out_dir = env::var_os("DEP_FOR SOME REASON THE LINKS KEY IS REQUIRED \ + TO PASS DATA AROUND BETWEEN BUILD SCRIPTS_OUT_DIR").unwrap(); + fs::File::create(path::PathBuf::from(env::var_os("OUT_DIR").unwrap()).join("bindings.rs")) + .unwrap() + .write_all(format!("include!(concat!({:?}, \"/gecko/structs_debug.rs\"));", + style_out_dir).as_bytes()) + .unwrap(); } diff --git a/tests/unit/stylo/lib.rs b/tests/unit/stylo/lib.rs index 6527c90609f..05a32869c4e 100644 --- a/tests/unit/stylo/lib.rs +++ b/tests/unit/stylo/lib.rs @@ -17,3 +17,9 @@ mod size_of; mod servo_function_signatures; +use style::*; + +#[allow(dead_code, improper_ctypes)] +mod bindings { + include!(concat!(env!("OUT_DIR"), "/bindings.rs")); +} |