()
| 4 | use std::path::{Path, PathBuf}; |
| 5 | |
| 6 | fn main() { |
| 7 | println!("cargo:rerun-if-changed=build.rs"); |
| 8 | println!("cargo:rerun-if-changed=tests/integration"); |
| 9 | |
| 10 | let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR")); |
| 11 | let out_dir = PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR")); |
| 12 | let generated = out_dir.join("generated_tests.rs"); |
| 13 | |
| 14 | let mut files = Vec::new(); |
| 15 | collect_rs_files(&manifest_dir.join("tests/integration"), &mut files); |
| 16 | files.sort(); |
| 17 | |
| 18 | let mut output = String::new(); |
| 19 | output.push_str("// @generated by build.rs; do not edit.\n"); |
| 20 | output.push_str("// This file includes every test module under tests/integration.\n\n"); |
| 21 | |
| 22 | for path in files { |
| 23 | let rel = path |
| 24 | .strip_prefix(&manifest_dir) |
| 25 | .expect("path under manifest dir"); |
| 26 | let module_name = module_name_for(rel); |
| 27 | let absolute = path.display().to_string(); |
| 28 | output.push_str(&format!( |
| 29 | "#[path = r#\"{absolute}\"#]\nmod {module_name};\n" |
| 30 | )); |
| 31 | } |
| 32 | |
| 33 | fs::write(&generated, output).expect("failed to write generated test harness"); |
| 34 | |
| 35 | generate_theme_palette(&manifest_dir, &out_dir); |
| 36 | generate_userspace(&manifest_dir, &out_dir); |
| 37 | } |
| 38 | |
| 39 | fn generate_theme_palette(manifest_dir: &Path, out_dir: &Path) { |
nothing calls this directly
no test coverage detected