fix(android): point UniFFI --library at CARGO_TARGET_DIR
All checks were successful
ci / test (pull_request) Successful in 2m51s
All checks were successful
ci / test (pull_request) Successful in 2m51s
CI sets CARGO_TARGET_DIR=/cargo-target. Bindgen still looked at crates/onionwire-sdk/target/release/libonionwire_sdk.so and died ENOENT after a green host compile.
This commit is contained in:
parent
1e6a4c12b2
commit
53ba1e857f
1 changed files with 7 additions and 1 deletions
|
|
@ -55,6 +55,12 @@ val onionwireAbis: List<String> = (findProperty("onionwire.abis") as String?)
|
|||
val jniLibsDir = layout.buildDirectory.dir("rustJniLibs")
|
||||
val uniffiKotlinDir = layout.buildDirectory.dir("generated/uniffi")
|
||||
|
||||
// cargo honors CARGO_TARGET_DIR when set (CI sibling container). UniFFI's
|
||||
// --library path must match, or bindgen dies with ENOENT after a green compile.
|
||||
val cargoTargetDir: File = System.getenv("CARGO_TARGET_DIR")?.let(::File)
|
||||
?: sdkCrateDir.resolve("target")
|
||||
val hostCdylib: File = cargoTargetDir.resolve("release/libonionwire_sdk.so")
|
||||
|
||||
/** Host cdylib. UniFFI's `--library` mode dlopens it, so it must be host-arch. */
|
||||
val cargoHostLib by tasks.registering(Exec::class) {
|
||||
group = "onionwire"
|
||||
|
|
@ -76,7 +82,7 @@ val uniffiBindgen by tasks.registering(Exec::class) {
|
|||
commandLine(
|
||||
cargoExe, "run", "--release", "--bin", "uniffi-bindgen", "--",
|
||||
"generate",
|
||||
"--library", "target/release/libonionwire_sdk.so",
|
||||
"--library", hostCdylib.absolutePath,
|
||||
"--language", "kotlin",
|
||||
"--no-format",
|
||||
"--config", "uniffi.toml",
|
||||
|
|
|
|||
Loading…
Reference in a new issue