-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
apk: Use rustc --crate-type=cdylib
to always force a lib to be compiled
#28
Conversation
7feb598
to
45f03ff
Compare
Will probably transplant this to |
Ah interesting, didn't know about I vaguely wonder what happens in a situation where you have a Not exactly intentionally but I've probably had crates with overlapping The docs say "If more than one target is available for the current package the filters of --lib, --bin, etc, must be used to select which target is compiled" so would it error if it's ambiguous? does cargo apk already explicitly name the target to build? |
A bin cannot be a
Yes, it can, and cargo-apk might get confused or panic, otherwise it blindly calls Also keep in mind #26 and rust-mobile/cargo-subcommand#17 (latter could use some review) that messes around with target selection specifically. |
good to know that |
I just wasn't sure initially whether this was going to somehow force the compilation of a |
tbh even since I have read them I'm not 100% sure. I see you can use |
Oh I see now, yeah I covered this in the PR message already:
|
Yeah it would have been, except that it explicitly disallows this scenario. Same for |
45f03ff
to
c85395c
Compare
…iled 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.
c85395c
to
8f26cfb
Compare
The unfortunate downside of this, as shown by the last CI run is that we can no longer build multiple targets such as examples at once. Neither |
Unsure what to do with breaking multi-build arguments, so users will just have to read the documentation and provide + select a |
This automatically turns
crate-type = ["*lib"]
and[lib]
targets into acdylib
, and otherwise errors appropriately when encountering a binary instead of succeeding the build and havingcargo-apk
later complain whentarget/aarch64-linux-android/debug/lib<yourpacakge>.so
is not found.