Cargo supports letting you specify a single directory for use for all projects via the CARGO_TARGET_DIR environment variable.
See this reddit post for a reason someone might want to do this (I had 170GB in various target files across my machine), although I've heard it can to speed up build times too, since it improves dep cache hits.
I haven't tested this, and maybe it's a little more complex.
It's unclear to me what should happen if both targetDirectory and that variable is specified. I kind of think that the variable should take precedence, as it's what cargo will actually use. But, maybe there's a use case for targetDirectory that I'm missing.
Cargo supports letting you specify a single directory for use for all projects via the CARGO_TARGET_DIR environment variable.
See this reddit post for a reason someone might want to do this (I had 170GB in various
target
files across my machine), although I've heard it can to speed up build times too, since it improves dep cache hits.I think we would just want to change https://github.com/mozilla/rust-android-gradle/blob/fcea23838ca8d95bc5e6caff504dfcf605b2e323/plugin/src/main/kotlin/com/nishtahir/CargoBuildTask.kt#L31, but
targetDirectory
and that variable is specified. I kind of think that the variable should take precedence, as it's what cargo will actually use. But, maybe there's a use case fortargetDirectory
that I'm missing.