Open tmcguire opened 3 years ago
I think this could be improved, but I don't quite know how to do it myself. What we need is to add some annotated fields to the CargoBuildTask
instances and set them with the information from https://github.com/mozilla/rust-android-gradle/blob/6e553c13ef2d9bb40b58a7675b96e0757d1b0443/plugin/src/main/kotlin/com/nishtahir/CargoBuildTask.kt#L52-L67.
The hard thing here is having the dynamic values of the various configuration options set at the right times so that the annotated fields have the correct values when inspected.
I'll add that these tasks are expected to always run but to be very fast, because cargo build --target ...
itself does input/output tracking.
Also the following warning is printed when running ./gradlew assembleDebug
from command-line, I guess it's related:
> Task :<redacted>:cargoBuildArm
Property 'toolchain' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0. See https://docs.gradle.org/6.5/userguide/more_about_tasks.html#sec:up_to_date_checks for more details.```
I'll add that these tasks are expected to always run but to be very fast, because cargo build --target ... itself does input/output tracking.
Right, it is quite fast. I guess the issues for me are:
When I upgraded to Gradle 7, I wasn't able to build my project anymore because of this. It looks like input/output annotations are required by gradle now, not just recommended.
Edit: never mind! the new plugin version (0.9.0) somehow builds successfully.
~When I upgraded to Gradle 7, I wasn't able to build my project anymore because of this. It looks like input/output annotations are required by gradle now, not just recommended.~
Edit: never mind! the new plugin version (0.9.0) somehow builds successfully.
Woot woot! The new plugin version specifically added support for newer Gradle and Android-Gradle Plugin versions, so I'm thrilled that it's working as expected.
As to the actual content of this ticket, these always-run tasks are by design: only Cargo itself can determine if the task needs to run :(
It looks like the![BuildAnalyzerWarning](https://user-images.githubusercontent.com/1164876/93068505-dd748500-f67c-11ea-886b-2b9a92870780.png)
cargoBuild<Target>
tasks are always run when running gradle, because they don't specify an output. See this screenshot from Android Studio: