Previously, `RustAndroidPlugin` would read the
NDK version from `source.properties` in the NDK
path, while `CargoBuildTask` would try to infer
the NDK version from the pathname.
Inferring the NDK version from the pathname would
fail if the pathname didn't contain the version
(e.g., Mach currently installs the NDK used to
build Firefox for Android into
`~/.mozbuild/android-ndk-r26c`), causing
`Toolchain` to return the wrong path to `ar` for
new NDK versions.
I'd prefer to do this by interrogating the binaries on disk, using
something like `which`, but the current expression makes that a little
hard to achieve, so we'll feed the NDK version into the relevant
helper function for now.
That release should then be published to the Gradle Plugin portal by
the existing release workflow.
Everything here was cribbed from or inspired by
b9f6de7f8b.
This works around an unfortunate issue with the Rust `std` library
where-by `-lgcc` is requested but not provided by newer NDKs. There
are a multiple ways to address this, but since `rust-android-gradle`
already has a linker script it's reasonable to use it for this
purpose.
Eventually we will remove `darwin` in favour of the explicit
`darwin-86-64`. For backwards compatibility, we leave the output
directory names unchanged.
Setting AR and CC via Cargo is not supported. AR is still documented but marked deprecated here:
https://doc.rust-lang.org/nightly/cargo/reference/config.html#targettriplearhttps://doc.rust-lang.org/rustc/codegen-options/index.html#ar
Setting CC via config is not documented at all now, and searching for cc
in Cargo source code also comes up empty. It's also missing from the
`rustc` codegen options link above.
I also removed a comment reference to RUSTFLAGS which doesn't appear to be
accurate (we don't set or modify RUSTFLAGS anywhere in this library)
The gradle classpath for the plugin returns a 403 and will fail to resolve on a new project. If you just drop the `gradle.plugin` part it works good though. This would be a quick fix to make starting out a little easier!