extendr / rextendr

An R package that helps scaffolding extendr-enabled packages or compiling Rust code dynamically
https://extendr.github.io/rextendr/
Other
174 stars 25 forks source link

Consider `CARGO_TARGET_DIR` #353

Open CGMossa opened 1 month ago

CGMossa commented 1 month ago

Several people have custom target-dir in their ~.cargo/config.toml, or they override CARGO_TARGET_DIR / CARGO_BUILD_TARGET_DIT, see https://doc.rust-lang.org/cargo/reference/config.html#buildtarget-dir

But this does not play nicely with rust_source or rust_function, because it doesn't invoke a cargo update, therefore, it sometimes result in using of cached dependencies, instead of defaulting to the latest one.

If one only used the published extendr-api on crates.io, then maybe that would be fine, but with use of say use_dev_extendr=, it becomes a source of false positives (in terms of errors).

I believe we should either set / reset this environment variable when creating "homeless" rust snippets, and even or even use --target-dir in the cargo-invocation even, see https://doc.rust-lang.org/cargo/commands/cargo-build.html?highlight=target-dir#output-options for documentation.