Skip to content

Commit 45f03ff

Browse files
committed
apk: Use rustc --crate-type=cdylib to always force a lib to be compiled
This automatically turns `crate-type = ["*lib"]` and `[lib]` targets into a `cdylib`, and otherwise errors appropriately when encountering a binary instead of succeeding the build and having `cargo-apk` later complain when `target/aarch64-linux-android/debug/lib<yourpacakge>.so` is not found.
1 parent 0f47f04 commit 45f03ff

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cargo-apk/src/apk.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ impl<'a> ApkBuilder<'a> {
226226
self.min_sdk_version(),
227227
self.cmd.target_dir(),
228228
)?;
229-
cargo.arg("build");
229+
cargo.arg("rustc");
230+
cargo.arg("--crate-type=cdylib");
230231
if self.cmd.target().is_none() {
231232
cargo.arg("--target").arg(triple);
232233
}

0 commit comments

Comments
 (0)