Path C-2 fix: uniffiBindgen honors CARGO_TARGET_DIR

The crafting-table container's rootfs hits 100% disk before cross-
compile finishes for 4 ABIs, so we redirect CARGO_TARGET_DIR to
/caches. The uniffiBindgen task was looking for libstrawcore.so at
target/debug/ (default) and failed when it had been written to
$CARGO_TARGET_DIR/debug/ instead. Honor the env var with a fallback
to the workspace-relative default.
This commit is contained in:
Kayos 2026-05-24 12:59:59 -07:00
parent 93297ad0a0
commit 7968bbb8e6

View file

@ -142,6 +142,11 @@ val cargoBin: String = "$cargoHome/bin/cargo"
val ndkHome: String = System.getenv("ANDROID_NDK_HOME")
?: System.getenv("ANDROID_NDK_ROOT")
?: "/caches/android-sdk/ndk/27.2.12479018"
// Honor CARGO_TARGET_DIR if set (we redirect it to /caches on crafting-table
// because the container's writable rootfs hits 100% before the cross-compile
// for 4 ABIs finishes). Falls back to the default `<workspace>/target`.
val cargoTargetDir: String = System.getenv("CARGO_TARGET_DIR")
?: "$rustRoot/target"
val cargoBuild by tasks.registering(Exec::class) {
group = "rust"
@ -181,7 +186,7 @@ val uniffiBindgen by tasks.registering(Exec::class) {
commandLine = listOf(
cargoBin, "run", "--quiet", "--bin", "uniffi-bindgen", "--",
"generate",
"--library", "target/debug/libstrawcore.so",
"--library", "$cargoTargetDir/debug/libstrawcore.so",
"--crate", "strawcore",
"--language", "kotlin",
"--no-format",