diff options
Diffstat (limited to 'components/script/build.rs')
-rw-r--r-- | components/script/build.rs | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/components/script/build.rs b/components/script/build.rs index 88317ca8f31..d801137c59c 100644 --- a/components/script/build.rs +++ b/components/script/build.rs @@ -31,22 +31,34 @@ fn main() { build.generator("Ninja"); // because we're using ninja, we need to explicitly set these // to VC++, otherwise it'll try to use cc - build.define("CMAKE_C_COMPILER", "cl.exe") - .define("CMAKE_CXX_COMPILER", "cl.exe"); + build + .define("CMAKE_C_COMPILER", "cl.exe") + .define("CMAKE_CXX_COMPILER", "cl.exe"); // We have to explicitly specify the full path to link.exe, // for reasons that I don't understand. If we just give // link.exe, it tries to use script-*/out/link.exe, which of // course does not exist. - let link = std::process::Command::new("where").arg("link.exe").output().unwrap(); - let link_path: Vec<&str> = std::str::from_utf8(&link.stdout).unwrap().split("\r\n").collect(); + let link = std::process::Command::new("where") + .arg("link.exe") + .output() + .unwrap(); + let link_path: Vec<&str> = std::str::from_utf8(&link.stdout) + .unwrap() + .split("\r\n") + .collect(); build.define("CMAKE_LINKER", link_path[0]); } build.build(); - println!("Binding generation completed in {}s", start.elapsed().as_secs()); + println!( + "Binding generation completed in {}s", + start.elapsed().as_secs() + ); - let json = PathBuf::from(env::var_os("OUT_DIR").unwrap()).join("build").join("InterfaceObjectMapData.json"); + let json = PathBuf::from(env::var_os("OUT_DIR").unwrap()) + .join("build") + .join("InterfaceObjectMapData.json"); let json: Value = serde_json::from_reader(File::open(&json).unwrap()).unwrap(); let mut map = phf_codegen::Map::new(); for (key, value) in json.as_object().unwrap() { @@ -54,7 +66,10 @@ fn main() { } let phf = PathBuf::from(env::var_os("OUT_DIR").unwrap()).join("InterfaceObjectMapPhf.rs"); let mut phf = File::create(&phf).unwrap(); - write!(&mut phf, "pub static MAP: phf::Map<&'static [u8], unsafe fn(*mut JSContext, HandleObject)> = ").unwrap(); + write!( + &mut phf, + "pub static MAP: phf::Map<&'static [u8], unsafe fn(*mut JSContext, HandleObject)> = " + ).unwrap(); map.build(&mut phf).unwrap(); write!(&mut phf, ";\n").unwrap(); } |