From 9e595f8206ffe45b2a6f4efdf7daaf49f05d0a0d Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Tue, 24 Oct 2017 14:57:48 +0200 Subject: [PATCH 1/2] Make test-stylo compile an empty crate on Windows without Gecko That is, in cases where it would fail to link. This will help make Rust CI be gated on compiling Stylo: https://github.com/rust-lang/rust/pull/44603 --- tests/unit/stylo/build.rs | 4 ++++ tests/unit/stylo/lib.rs | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/tests/unit/stylo/build.rs b/tests/unit/stylo/build.rs index e620bbdf1cc..0f9f0851a4d 100644 --- a/tests/unit/stylo/build.rs +++ b/tests/unit/stylo/build.rs @@ -63,4 +63,8 @@ fn main() { .write_all(format!("include!(concat!({:?}, \"/gecko/structs.rs\"));", style_out_dir).as_bytes()) .unwrap(); + + if env::var_os("MOZ_SRC").is_some() { + println!("cargo:rustc-cfg=linking_with_gecko") + } } diff --git a/tests/unit/stylo/lib.rs b/tests/unit/stylo/lib.rs index 6b460558953..62fd455239d 100644 --- a/tests/unit/stylo/lib.rs +++ b/tests/unit/stylo/lib.rs @@ -2,6 +2,15 @@ * 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/. */ +// Disable this entire crate on Windows when Gecko symbols are not available +// as linking would fail: +// https://github.com/rust-lang/rust/pull/44603#issuecomment-338807312 +// +// On Linux and OS X linking succeeds anyway. +// Presumably these symbol declarations don’t need to be resolved +// as they’re not used in any code called from this crate. +#![cfg(any(linking_with_gecko, not(windows)))] + extern crate atomic_refcell; extern crate cssparser; extern crate env_logger; From 4c36ba1f7806970611ec731e3c83732e9d53844e Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Tue, 24 Oct 2017 14:56:44 +0200 Subject: [PATCH 2/2] Run 'test-stylo' on Windows CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Exercise the previous commit’s fix. This used to fail to link: https://github.com/rust-lang/rust/pull/44603#issuecomment-338807312 --- etc/ci/buildbot_steps.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/ci/buildbot_steps.yml b/etc/ci/buildbot_steps.yml index c8a23190975..7755b737941 100644 --- a/etc/ci/buildbot_steps.yml +++ b/etc/ci/buildbot_steps.yml @@ -146,6 +146,7 @@ windows-msvc-dev: - mach.bat test-unit - mach.bat package --dev - mach.bat build-geckolib + - mach.bat test-stylo windows-msvc-nightly: - mach.bat clean-nightlies --keep 3 --force