aboutsummaryrefslogtreecommitdiffstats
path: root/components/script_bindings/build.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script_bindings/build.rs')
-rw-r--r--components/script_bindings/build.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/components/script_bindings/build.rs b/components/script_bindings/build.rs
index 25b5e10a24d..b11e3d1cfdf 100644
--- a/components/script_bindings/build.rs
+++ b/components/script_bindings/build.rs
@@ -43,13 +43,21 @@ fn main() {
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() {
- map.entry(Bytes(key), value.as_str().unwrap());
+ let parts = value.as_array().unwrap();
+ map.entry(
+ Bytes(key),
+ &format!(
+ "Interface {{ define: {}, enabled: {} }}",
+ parts[0].as_str().unwrap(),
+ parts[1].as_str().unwrap()
+ ),
+ );
}
let phf = PathBuf::from(env::var_os("OUT_DIR").unwrap()).join("InterfaceObjectMapPhf.rs");
let mut phf = File::create(phf).unwrap();
writeln!(
&mut phf,
- "pub(crate) static MAP: phf::Map<&'static [u8], fn(JSContext, HandleObject)> = {};",
+ "pub(crate) static MAP: phf::Map<&'static [u8], Interface> = {};",
map.build(),
)
.unwrap();