Format script component

This commit is contained in:
chansuke 2018-09-18 23:24:15 +09:00 committed by Josh Matthews
parent 2ca7a13473
commit c37a345dc9
357 changed files with 25485 additions and 18076 deletions

View file

@ -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();
}