From 890257ebc32128faa91975cf4605cef811844e5f Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Sun, 10 Dec 2017 02:58:31 +0100 Subject: [PATCH] Check that 'style' is compiled in a supported configuration. Provide an explanatory error message when the compilation would fail because of missing or duplicate items. --- components/style/build.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/components/style/build.rs b/components/style/build.rs index e34fa79ccdb..517c65f99dc 100644 --- a/components/style/build.rs +++ b/components/style/build.rs @@ -94,6 +94,15 @@ fn generate_properties() { } fn main() { + let gecko = cfg!(feature = "gecko"); + let servo = cfg!(feature = "servo"); + if !(gecko || servo) { + panic!("The style crate requires enabling one of its 'servo' or 'gecko' feature flags"); + } + if gecko && servo { + panic!("The style crate does not support enabling both its 'servo' or 'gecko' \ + feature flags at the same time."); + } println!("cargo:rerun-if-changed=build.rs"); println!("cargo:out_dir={}", env::var("OUT_DIR").unwrap()); generate_properties();