aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/build.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-12-22 21:43:54 -1400
committermat <git@matdoes.dev>2025-12-22 21:43:54 -1400
commit82e3d46ca319badcbc584cf902aeebcbd30948b9 (patch)
tree4afb8c6135caacbdf9f1f04d451cb2bae1c488b6 /azalea-client/build.rs
parent0429a81d706da7c45600d357f9f9a14cef6113b4 (diff)
downloadazalea-drasl-82e3d46ca319badcbc584cf902aeebcbd30948b9.tar.xz
run azalea-client integration tests as one binary
per https://corrode.dev/blog/tips-for-faster-rust-compile-times/\#combine-all-integration-tests-into-a-single-binary <3
Diffstat (limited to 'azalea-client/build.rs')
-rw-r--r--azalea-client/build.rs43
1 files changed, 43 insertions, 0 deletions
diff --git a/azalea-client/build.rs b/azalea-client/build.rs
new file mode 100644
index 00000000..49ef62db
--- /dev/null
+++ b/azalea-client/build.rs
@@ -0,0 +1,43 @@
+use std::{
+ fs::{self, File},
+ io::Write,
+};
+
+fn main() {
+ // Tell Cargo that if the given file changes, to rerun this build script.
+ println!("cargo::rerun-if-changed=tests");
+
+ let Ok(paths) = fs::read_dir("tests/simulation") else {
+ return;
+ };
+
+ let mut modules = Vec::new();
+
+ for path in paths {
+ let Ok(path) = path else {
+ continue;
+ };
+ let path = path.path();
+ if path.extension().is_none_or(|ext| ext != "rs") {
+ continue;
+ }
+ let mod_name = path.with_extension("");
+ let mod_name = mod_name.file_name().unwrap().to_string_lossy().to_string();
+ if mod_name == "mod" {
+ continue;
+ }
+ modules.push(mod_name);
+ }
+
+ let Ok(mut mod_rs) = File::create("tests/simulation/mod.rs") else {
+ return;
+ };
+ let _ = writeln!(
+ mod_rs,
+ "// This file is @generated by `azalea-client/build.rs`.\n"
+ );
+ modules.sort();
+ for mod_name in modules {
+ let _ = writeln!(mod_rs, "mod {mod_name};");
+ }
+}