servo: Merge #19003 - Make test-stylo compile an empty crate on Windows without Gecko (from servo:stylo_tests_windows); r=emilio

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

Source-Repo: https://github.com/servo/servo
Source-Revision: 38fe9533b93e985657f99a29772bf3d3c8694822

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 3a2413e03efb4754cf657f4637a3543fbc13074a
This commit is contained in:
Simon Sapin 2017-10-24 13:32:39 -05:00
parent 1ead0a96a9
commit 99aca456f1
3 changed files with 14 additions and 0 deletions

View File

@ -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

View File

@ -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")
}
}

View File

@ -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 dont need to be resolved
// as theyre 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;