Skip to content

Commit

Permalink
Merge branch 'main' into prelude_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilia-Kosenkov authored Sep 8, 2024
2 parents 03037de + 6c53282 commit bf70078
Show file tree
Hide file tree
Showing 34 changed files with 742 additions and 314 deletions.
21 changes: 7 additions & 14 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ on:
branches: [main, master]
pull_request:
branches: [main, master]
types:
- opened
- reopened
- synchronize
- ready_for_review

name: R-CMD-check

Expand Down Expand Up @@ -39,7 +44,7 @@ jobs:
toolchain: ${{ matrix.config.rust-version }}
targets: ${{ matrix.config.rust-target }}

- uses: baptiste0928/cargo-install@v2
- uses: baptiste0928/cargo-install@v3
if: matrix.config.r == 'release'
with:
crate: cargo-license
Expand All @@ -55,18 +60,6 @@ jobs:
cache-version: 2
extra-packages: rcmdcheck

# TODO: allow warnings on oldrel (cf., https://stat.ethz.ch/pipermail/r-package-devel/2023q2/009229.html)
- name: Check R version
id: error-on
run: |
output <- Sys.getenv("GITHUB_OUTPUT")
if (.Platform$OS.type == "windows" && getRversion() < "4.3.0") {
cat('level=error', file = output, append = TRUE)
} else {
cat('level=warning', file = output, append = TRUE)
}
shell: Rscript {0}

- uses: r-lib/actions/check-r-package@v2
with:
error-on: '"${{ steps.error-on.outputs.level }}"'
error-on: '"note"'
5 changes: 5 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
branches: [main, master]
pull_request:
branches: [main, master]
types:
- opened
- reopened
- synchronize
- ready_for_review

name: lint

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
branches: [main, master]
pull_request:
branches: [main, master]
types:
- opened
- reopened
- synchronize
- ready_for_review
release:
types: [published]
workflow_dispatch:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
branches: [main, master]
pull_request:
branches: [main, master]
types:
- opened
- reopened
- synchronize
- ready_for_review

name: test-coverage

Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/test_pkg_gen.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
on:
push:
branches:
- main
- master
branches: [main, master]
pull_request:
branches:
- main
- master
branches: [main, master]
types:
- opened
- reopened
- synchronize
- ready_for_review

name: Test package generation

Expand Down Expand Up @@ -47,8 +48,7 @@ jobs:
with:
r-version: ${{ matrix.config.r }}
rtools-version: ${{ matrix.config.rtools-version }}
# TODO: enable RSPM when all the packages are available
use-public-rspm: false
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: rextendr
Title: Call Rust Code from R using the 'extendr' Crate
Version: 0.3.1.9000
Version: 0.3.1.9001
Authors@R:
c(person(given = "Claus O.",
family = "Wilke",
Expand Down Expand Up @@ -69,6 +69,6 @@ Config/testthat/edition: 3
Config/testthat/parallel: true
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
SystemRequirements: Rust 'cargo'; the crate 'libR-sys' must compile
without error
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export(rust_sitrep)
export(rust_source)
export(to_toml)
export(use_cran_defaults)
export(use_crate)
export(use_extendr)
export(use_msrv)
export(vendor_pkgs)
export(write_license_note)
importFrom(dplyr,"%>%")
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
* `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

# rextend 0.3.1

Expand Down
15 changes: 14 additions & 1 deletion R/cran-compliance.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#' @details
#'
#' `use_cran_defaults()` modifies an existing package to provide CRAN complaint
#' settings and files. It creates `configure` and `configure.win` files as well as
#' settings and files. It creates `tools/msrv.R`, `configure` and `configure.win` files as well as
#' modifies `Makevars` and `Makevars.win` to use required CRAN settings.
#'
#' `vendor_pkgs()` is used to package the dependencies as required by CRAN.
Expand Down Expand Up @@ -52,6 +52,19 @@ use_cran_defaults <- function(path = ".", quiet = FALSE, overwrite = NULL, lib_n
)
}

# create tools directory if it does not exist
if (!dir.exists("tools")) {
dir.create("tools")
}

# add msrv.R template
use_rextendr_template(
"cran/msrv.R",
save_as = file.path("tools", "msrv.R"),
quiet = quiet,
overwrite = overwrite
)

# add configure and configure.win templates
use_rextendr_template(
"cran/configure",
Expand Down
4 changes: 2 additions & 2 deletions R/find_exports.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ find_extendr_attrs_ids <- function(lns) {
}

# Gets function/module metadata from a subset of lines.
# Finds first occurence of `fn` or `impl`.
# Finds first occurrence of `fn` or `impl`.
extract_meta <- function(lns) {
# Matches fn|impl<'a> item_name
result <- stringi::stri_match_first_regex(
glue_collapse(lns, sep = "\n"),
"(?:(fn)|(impl)(?:\\s*<(.+?)>)?)\\s+(_\\w+|[A-z]\\w*)"
"(?:(?<fn>fn)|(?<impl>impl)(?:\\s*<(?<lifetime>.+?)>)?)\\s+(?<name>(?:r#)?(?:_\\w+|[A-z]\\w*))"
) %>%
tibble::as_tibble(.name_repair = "minimal") %>%
rlang::set_names(c("match", "fn", "impl", "lifetime", "name")) %>%
Expand Down
Loading

0 comments on commit bf70078

Please sign in to comment.