build: copy engine plugins to the profile dir under Cargo's newer build-dir layout (#226)

Rust 1.100 CI places OUT_DIR one level deeper, so ancestors().nth(3) no longer
reached target/<profile> and the release feature-set checks lost libuu-wayland.so.

Co-authored-by: VallierDev <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
authored and GitHub committed 2026-11-13 13:40:01 +09:00
1 parent 0e1e935fb4
commit ff2bd9c582
1 file changed
+7 -2
+7 -2
View File
@@ -173,6 +173,11 @@ fn shared_engine(name: &str, sources: &[&str], includes: &[&std::path::Path], cf
command.args(cflags.split_whitespace()).args(sources).args(libs.split_whitespace()).arg("-lpthread"); command.args(cflags.split_whitespace()).args(sources).args(libs.split_whitespace()).arg("-lpthread");
let status = command.status().expect("C compiler for the engine plugin"); let status = command.status().expect("C compiler for the engine plugin");
assert!(status.success(), "building {name} failed"); assert!(status.success(), "building {name} failed");
// OUT_DIR = target/<profile>/build/<package>-<hash>/out // OUT_DIR = target/<profile>/build/<package>-<hash>/out, or target/<profile>/build/<package>/<hash>/out with
if let Some(profile) = out.ancestors().nth(3) { std::fs::copy(&library, profile.join(name)).expect("copy engine plugin"); } // the newer Cargo build-dir layout (Rust 1.100 CI): the profile dir is the parent of the `build` component.
let profile = out.ancestors().find(|dir| dir.file_name().is_some_and(|n| n == "build")).and_then(|dir| dir.parent());
match profile {
Some(profile) => { std::fs::copy(&library, profile.join(name)).expect("copy engine plugin"); }
None => println!("cargo:warning={name} built in {} but no target/<profile> dir found to copy it to", out.display()),
}
} }