Repository navigation
Conversation
ncalexan
left a comment
There was a problem hiding this comment.
Sorry for the long delay before reviewing. I don't think this is right as written, but I'm happy to help the user do the right thing in this case.
| ?: targetDirectory | ||
| ?: "${module!!}/target" | ||
|
|
||
| if (Files.exists(Paths.get(targetDirectory))) { |
There was a problem hiding this comment.
This conditional looks backwards -- surely you want !Files.exists(...).
| ?: "${module!!}/target" | ||
|
|
||
| if (Files.exists(Paths.get(targetDirectory))) { | ||
| throw GradleException("Cargo target directory (`${targetDirectory}`) is not exists. If you're using Cargo Workspace, you need to specify the target directory in `build.gradle` or `local.properties` (see https://github.com/mozilla/rust-android-gradle#targetdirectory).") |
There was a problem hiding this comment.
nit: s/is not exists/does not exist/. And s/Cargo Workspace/a Cargo workspace/.
When the Rust project is inside a Cargo Workspace this plugin will _fail_ silently because by default it assumes Cargo target directory will be inside the module directory. This patch add a guard against misconfigured target directory. When the target directory not exists, we'll make the build fails and point user to the documentation. ``` Cargo target directory (`../../target`) does not exists. If you're using a Cargo Workspace, you need to specify the target directory in `build.gradle` or `local.properties` (see https://github.com/mozilla/rust-android-gradle#targetdirectory). ```
|
Thanks for this, and sorry it sat so long. The silent failure is still real, but checking that the directory exists misses a stale target directory left over from a non-workspace build, and the code here has changed a lot since. #181 fails the build when the copy step finds no libraries instead, which covers this case and a few others, and #182 tracks having the plugin ask Cargo for the target directory so it doesn't need configuring. Closing in favor of those. |
When the Rust project is inside a Cargo Workspace this plugin will
fail silently because by default it assumes Cargo target directory
will be inside the module directory.
This patch add a guard against misconfigured target directory. When the
target directory not exists, we'll make the build fails and point user
to the documentation.