app

Local-first trade for farms and co-ops
git clone https://radroots.dev/git/app.git
Log | Files | Refs | README | LICENSE

build.rs (712B)


      1 use std::fs;
      2 use std::path::PathBuf;
      3 
      4 #[path = "src/parser.rs"]
      5 mod parser;
      6 
      7 use parser::generate_rust_constants;
      8 
      9 const MANIFEST_PATH: &str = "../../../config/product/harvestcircle-v1.properties";
     10 fn main() {
     11     println!("cargo:rerun-if-changed={MANIFEST_PATH}");
     12     let source = fs::read_to_string(MANIFEST_PATH).expect("read HarvestCircle product manifest");
     13     let generated =
     14         generate_rust_constants(&source).expect("validate HarvestCircle product manifest");
     15 
     16     fs::write(out_file("product_coordinates.rs"), generated)
     17         .expect("write generated product coordinates");
     18 }
     19 
     20 fn out_file(name: &str) -> PathBuf {
     21     PathBuf::from(std::env::var_os("OUT_DIR").expect("OUT_DIR")).join(name)
     22 }