Add possibility to generate module for inclusion
kilork opened this issue · 1 comments
kilork commented
This looks like more nice approach, as just directly include generation procedure.
We can achieve a similar thing with the following code:
let out_dir = env::var("OUT_DIR").unwrap();
let generated_filename = Path::new(&out_dir).join("generated.rs");
let generated_rs = "\
mod sets;
pub use sets::generate;";
std::fs::write(generated_filename, generated_rs).unwrap();
let generated_dir = Path::new(&out_dir).join("sets");
std::fs::create_dir_all(&generated_dir).unwrap();
let mod_filename = generated_dir.join("mod.rs");
std::fs::write(
mod_filename,
"\
mod set_01;
pub use set_01::generate;",
)
.unwrap();
let generated_filename = generated_dir.join("set_01.rs");
generate_resources(
"generated",
None,
generated_filename,
"generate",
)
.unwrap();
kilork commented
This function should also support multiple sets generation.