use std::{env, fs, path::PathBuf}; fn main() { let root = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()) .parent() .unwrap() .to_path_buf(); let base = root.join("os-runqueue/src/runqueue.rs"); let extension = root.join("scripts/os-acceptance/k1060-runqueue-handoff.rs"); println!("cargo:rerun-if-changed={}", base.display()); println!("cargo:rerun-if-changed={}", extension.display()); let mut bytes = fs::read(&base).unwrap(); bytes.extend_from_slice(b"\n"); bytes.extend_from_slice(&fs::read(&extension).unwrap()); let out = PathBuf::from(env::var("OUT_DIR").unwrap()); let module = out.join("runqueue.rs"); fs::write(&module, bytes).unwrap(); fs::write( out.join("module.rs"), format!( "#[path = {:?}] pub mod runqueue;\n", module.to_str().unwrap() ), ) .unwrap(); }