Repository navigation
Conversation
Refactor NDK discovery, version compatibility checks, target mapping, and Cargo environment generation into a reusable library API. Make the CLI share the linker-wrapper implementation. Allow external Rust executables to consume cargo-ndk directly and act as their own linker wrapper without requiring a sibling cargo-ndk executable. Add an independent embedding fixture, CLI environment compatibility tests, and documentation. Co-authored-by: Codex <noreply@openai.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR makes cargo-ndk usable as a regular Rust library for build tools such as xtask. Consumers can configure and launch their own Cargo commands while reusing cargo-ndk's Android NDK toolchain compatibility logic.
Motivation
The previous implementation kept environment setup behind the CLI and assumed that a cargo-ndk executable would be available to act as the Rust linker wrapper. That makes library embedding awkward: an xtask would need an additional installed or sibling cargo-ndk executable.
What changed
Embedding model
An embedding executable can dispatch linker invocations to cargo-ndk before its normal command handling:
It can then configure and launch Cargo itself:
The default linker is the current embedding executable, so this path does not look up or require a sibling cargo-ndk binary.
Compatibility and tests
Validation