# rextendr 0.5.0

## Added
* `use_extendr()` now generates `cleanup` and `cleanup.win`. (#473)
* Refactor of `rust_source()` and `rust_function()` (#478) 
  * Adds `opts = extendr_options()` to simplify `rust_source()` API with `...` 
    to maintain backwards compatibility
  * Adds rlang standalone type checks to `rust_source()` and `rust_function()` 
  * Replaces internal `invoke_cargo()` with `run_cargo()` in `rust_source()` 
  * Simplifies handling of macro options in `rust_function(extendr_fn_options = list())` 
  * Unknown macro options in dev and release now throw errors instead of warnings
* `vendor_pkgs()` now has a `clean` argument to remove the `src/rust/vendor`
  directory after creating the `vendor.tar.xz` file. (#479)
* Added `update_scaffold()` to overwrite scaffolding, making it easier to update
  packages to track developments in extendr and rextendr. (#493)
* `write_license_note()` is now marked as experimental. The `authors` field in
  Cargo metadata is deprecated upstream (<https://github.com/rust-lang/cargo/issues/16458>)
  and crates may stop populating it, leading to incomplete author information.

## Deprecated
* `vendor_pkgs()` has been renamed to `vendor_crates()` to better reflect that
  it vendors Rust crates. `vendor_pkgs()` is soft-deprecated and will be removed
  in a future release.
* Complete overhaul of wrapper-generation. (#491)
  * `rextendr::document()` is now a thin wrapper around `devtools::document()` 
    and is soft deprecated. Packages created with `use_extendr()` no longer 
    require it. It is retained for backwards compatibility. 
  * `register_extendr()` is no longer called in `rextendr::document()` and is 
    soft deprecated. The function itself is no-op and now returns a lifecycle 
    warning.
  * Deprecating `register_extendr()` effectively nullifies the PkgGen CI tests, 
    so those have been removed.

## Breaking
* Complete overhaul of wrapper-generation. (#491)
  * `use_extendr()` now generates `src/rust/document.rs` and adds a `[[bin]]` 
    target to `Cargo.toml` with `crate-type = ["rlib", "staticlib"]`. 
  * `rust_eval()` now returns `extendr_api::error::Result<Robj>`.
  * The header in `R/extendr-wrappers.R` has also been updated to reflect these
    changes, which required a concurrent PR to extendr (extendr/extendr#1048).
  * CI now uses the development version of extendr-api on GitHub.
  * Snapshot and other tests now reflect these changes.
  * Substantial updates to Roxygen documentation.

## Fixed
* `Makevars`(.win) now uses the `vendor/`, if it exists, before unzipping the 
  tarball. (#479)
* `entrypoint.c` now registers extendr's panic handler. (#499)

## Changed

* `callr` has been removed as a dependency.

# rextendr 0.4.2

* Sets the `extendr-api` version to the latest stable version instead of `"*"` when creating a new package. This is fetched from <https://crates.io/api/v1/crates/extendr-api> and will fall back to `"*"` if not available <https://github.com/extendr/rextendr/pull/467>
* Adds `xz` to `SystemRequirements` to ensure extendr based packages build on Posit Package Manager <https://github.com/extendr/rextendr/pull/467>
* Sets the release profile to use `lto=true` and `codegen-units=1` to ensure compatible builds with WebR as well as reduce the overall compiled package size <https://github.com/extendr/rextendr/pull/465>.
* Fixes compatibility with WebR by adding `CARGO_PROFILE_DEV_PANIC="abort" CARGO_PROFILE_RELEASE_PANIC="abort"` when targeting `wasm32-unknown-emsacripten` target <https://github.com/extendr/rextendr/pull/461>

# rextendr 0.4.1

* Fix tests executed on CRAN (#449)

* Added `use_vscode()` and its alias `use_positron()` to create `.vscode/settings.json`, enhancing the `rextendr` experience in VSCode/Positron.
  Additionally, `use_extendr()` now automatically calls `use_vscode()` when VSCode or Positron is detected as the IDE (#441).

# rextendr 0.4.0

* Adds [WebR](https://docs.r-wasm.org/webr/latest/) support out of the box for all extendr packages.
  * Note that not all Rust crates are wasm compatible. This change only enables the package to build in the `wasm32-unknown-emscripten` target. It does not guarantee all dependencies will compile.
* Addresses new CRAN check in R 4.5+ adding warning for `_abort` usage
* `use_extendr_badge()` has been added to add an extendr-specific badge to a `README.Rmd` via `usethis::use_badge()` <https://github.com/extendr/rextendr/pull/417>
* Removes `Makevars.ucrt` as R versions < 4.1 are not supported by extendr <https://github.com/extendr/rextendr/pull/414> 
* `purrr` has been replaced with [`R/standalone-purrr.R`](https://github.com/r-lib/rlang/blob/main/R/standalone-purrr.R) removing `purrr` from `Imports` <https://github.com/extendr/rextendr/pull/408>
* `document()` will no longer try to save all open files using rstudioapi <https://github.com/extendr/rextendr/issues/404> <https://github.com/extendr/rextendr/issues/407>
* `use_cran_default()` has been removed as the default package template is CRAN compatible <https://github.com/extendr/rextendr/pull/394>
* `use_extendr()` now creates `tools/msrv.R`, `configure` and `configure.win`. These have been moved out of `use_cran_defaults()` <https://github.com/extendr/rextendr/pull/393>
* `Makevars` now prints linked static libraries at compile time by adding `--print=native-static-libs` to `RUSTFLAGS` <https://github.com/extendr/rextendr/pull/393>
* `use_extendr()` sets the `DESCRIPTION`'s `SystemRequirements` field according to CRAN policy to `Cargo (Rust's package manager), rustc` (#329)
* Introduces new functions `use_cran_defaults()` and `vendor_pkgs()` to ease the publication of extendr-powered packages on CRAN. See the new article _CRAN compliant extendr packages_ on how to use these (#320).
* `rust_sitrep()` now better communicates the status of the Rust toolchain and available targets. It also guides the user through necessary installation steps to fix Rust setup (#318).
* `use_extendr()` and `document()` now set the `SystemRequirements` field of the `DESCRIPTION` file to
  `Cargo (rustc package manager)` if the field is empty (#298).
* `use_extendr()` gets a new ability to overwrite existing rextendr templates (#292).
* `use_extendr()` sets `publish = false` in the `[package]` section of the `Cargo.toml` (#297).
* `use_extendr()` correctly handles calls with `path` not equal to  `"."` (current folder), or when there is no active `{usethis}` project (#323).
* Fixes an issue in pre-defined set of known features: added `either` (#338)
* `create_extendr_package()` allows user to create project directory using RStudio's **Project Command**. (#321)
* Support `RTOOLS44` (#347)
* Removed `use_try_from` as an option in `rust_function`, and added `use_rng` (#354)
* Added `use_crate()` function to make adding dependencies to Cargo.toml easier within R, similar to `usethis::use_package()` (#361)
* Fixed an issue in `rust_source()` family of functions that prevented usage of `r#` escape sequences in Rust function names (#374)
* `use_cran_defaults()` now checks the `SystemRequirements` field in the `DESCRIPTION` file for cargo and rustc. It will display installation instructions if either is missing or provide the minimum required version if the installed version is outdated.
* Added `use_msrv()` to aid in specifying the minimum supported rust version (MSRV) for an R package
* Added `read_cargo_metadata()` to retrieve Cargo metadata for packages and
  workspaces. (#389)
* `rustup_sitrep()` now checks if a default toolchain has been set. <https://github.com/extendr/rextendr/pull/416>
* Minimum R version is set to `4.1` (#435)
* `{tibble}` is no longer a dependency (#435)

# rextend 0.3.1

* Update package templates to work with Rust >= 1.70 (#285)

# rextendr 0.3.0

* Ilia Kosenkov is now the official maintainer.

* Josiah Parry is now a contributor.

* Support Rtools43 (#231).

* `rextendr` has migrated to the use of `cli` for raising errors and warnings.

* Developer note: new helper function `local_quiet_cli()` introduced in `R/utils.R` to simplify silencing cli output.
  
## New features

* A new function `rust_sitrep()` that prints out a short report on the currently installed Rust toolchain (#274).

* A new function `write_license_note()` to generate `LICENSE.note` file from `Cargo.toml` (#271).

* `extendr_fn_options` parameter of `rust_source()` controls what type of options are emitted to `#[extendr()]` attribute (#252).

* `use_dev_extendr` flag makes `rust_source()` family of functions compile code using development version of `extendr`.
Development configuration is stored as an option named `rextendr.extendr_dev_deps` (#251).

* `features` parameter of `rust_source()` now correctly enables features in `extendr-api` and references required crates.
`features` not available in release version of `extendr` raises a warning (#249).

* A `<pkg_name>-win.def` file containing DLL exports is created by `rextendr::use_extendr()`. It is used during linking phase on Windows and solves the problem of compiling very large projects, such as `polars` (#212)

* Support extendr macro with options (#128).

* `rust_source()` got `features` argument to specify Cargo features to activate
  (#140).

* `rextendr::document()` now sets the envvars that `devtools::document()` sets,
  e.g. `NOT_CRAN` (#135).

# rextendr 0.2.0

First official release.
