extern crate heck;
extern crate proc_macro2;
extern crate quote;
extern crate serde;
extern crate serde_json;
mod generator;
mod spec;

use generator::generate_rust_grammar;
use spec::latest_grammar;
use std::{env, fs, path::PathBuf};

fn main() {
    println!("cargo:rerun-if-changed=build/spec/spirv.core.grammar.json");

    let out = PathBuf::from(env::var("OUT_DIR").unwrap()).join("generated.rs");
    fs::write(out, generate_rust_grammar(latest_grammar()).to_string()).unwrap();
}
