copy only the libraries that were built #135
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As in #89, we build multiple ffi libraries in the same cargo workspace.
cargo-ndk
ends up copying all libraries in the target directory instead of only the ones built for that invocation. Gradle then will complain with something like2 files found with path 'lib/arm64-v8a/libffi.so' from inputs
in the merge JNI libraries step.This change parses the library name from Cargo.toml and copies only the library (per target) to the output directory. I'm not sure if this will end up missing some libraries in copy. As far as I can tell, every rust crate can have 0 or 1 libraries, and
package.name
is required inCargo.toml
so we always have a name.The library name is derived from
lib.name
if set, or frompackage.name
if not, per https://doc.rust-lang.org/cargo/reference/cargo-targets.html#the-name-field