1234567891011121314151617181920212223242526272829303132 |
- use std::env;
- use std::fs::File;
- use std::io::Write;
- use std::path::Path;
- use std::process::Command;
- fn main() {
- println!("cargo:rerun-if-changed=tests/generate_tile_connection_array_cases.py");
- let status = Command::new("python3.11")
- .arg("tests/generate_tile_connection_array_cases.py")
- .status()
- .expect("failed to execute Python script generate_tile_connection_array_cases.py");
- if !status.success() {
- panic!("failed to execute Python script generate_tile_connection_array_cases.py");
- }
- // Code generation for tile_grid.rs
- println!("cargo:rerun-if-changed=src/neighbor_associations_match_generation.py");
- let out_dir = env::var("OUT_DIR").unwrap();
- let dest_path = Path::new(&out_dir).join("neighbor_associations_match.rs");
- let mut file = File::create(&dest_path).unwrap();
- let output = Command::new("python3.11")
- .arg("src/neighbor_associations_match_generation.py")
- .output()
- .expect("failed to execute Python script neighbor_associations_match_generation.py");
- file.write_all(output.stdout.as_slice()).unwrap();
- }
|