fayalite/crates/fayalite/build.rs
2024-08-21 22:27:21 -07:00

17 lines
669 B
Rust

// SPDX-License-Identifier: LGPL-3.0-or-later
// See Notices.txt for copyright information
use fayalite_visit_gen::parse_and_generate;
use std::{env, fs, path::Path};
fn main() {
println!("cargo::rustc-check-cfg=cfg(todo)");
let path = "visit_types.json";
println!("cargo::rerun-if-changed={path}");
println!("cargo::rerun-if-changed=build.rs");
let generated = parse_and_generate(path).map_err(|e| panic!("{e}")).unwrap();
let out_dir = env::var_os("OUT_DIR").unwrap();
let out_path = Path::new(&out_dir).join("visit.rs");
fs::write(&out_path, generated).unwrap();
// println!("cargo::warning=generated {}", out_path.display());
}