Skip to content

Commit

Permalink
use tools/msrv.R and configure to address R-devel warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
JosiahParry committed Oct 27, 2024
1 parent 154fedb commit 6823c4b
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 3 deletions.
37 changes: 37 additions & 0 deletions R/use_extendr.R
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,43 @@ use_extendr <- function(path = ".",
data = list(pkg_name = pkg_name)
)

# 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",
save_as = "configure",
quiet = quiet,
overwrite = overwrite,
data = list(lib_name = lib_name)
)

# configure needs to be made executable
# ignore for Windows
if (.Platform[["OS.type"]] == "unix") {
Sys.chmod("configure", "0755")
}

use_rextendr_template(
"cran/configure.win",
save_as = "configure.win",
quiet = quiet,
overwrite = overwrite,
data = list(lib_name = lib_name)
)


if (!isTRUE(quiet)) {
cli::cli_alert_success("Finished configuring {.pkg extendr} for package {.pkg {pkg_name}}.")
cli::cli_ul(
Expand Down
9 changes: 6 additions & 3 deletions tests/testthat/_snaps/use_cran_defaults.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
v Writing 'src/rust/src/lib.rs'
v Writing 'src/testpkg-win.def'
v Writing 'R/extendr-wrappers.R'
v Writing 'tools/msrv.R'
v Writing 'configure'
v Writing 'configure.win'
v Finished configuring extendr for package testpkg.
* Please run `rextendr::document()` for changes to take effect.

Expand All @@ -25,9 +28,9 @@
Code
use_cran_defaults()
Message
v Writing 'tools/msrv.R'
v Writing 'configure'
v Writing 'configure.win'
> File 'tools/msrv.R' already exists. Skip writing the file.
> File 'configure' already exists. Skip writing the file.
> File 'configure.win' already exists. Skip writing the file.
> File 'src/Makevars' already exists. Skip writing the file.
> File 'src/Makevars.win' already exists. Skip writing the file.
v Adding "^src/rust/vendor$" to '.Rbuildignore'.
Expand Down
9 changes: 9 additions & 0 deletions tests/testthat/_snaps/use_extendr.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
v Writing 'src/rust/src/lib.rs'
v Writing 'src/testpkg-win.def'
v Writing 'R/extendr-wrappers.R'
v Writing 'tools/msrv.R'
v Writing 'configure'
v Writing 'configure.win'
v Finished configuring extendr for package testpkg.
* Please run `rextendr::document()` for changes to take effect.

Expand Down Expand Up @@ -218,6 +221,9 @@
> File 'src/rust/src/lib.rs' already exists. Skip writing the file.
> File 'src/testpkg.wrap-win.def' already exists. Skip writing the file.
> File 'R/extendr-wrappers.R' already exists. Skip writing the file.
> File 'tools/msrv.R' already exists. Skip writing the file.
> File 'configure' already exists. Skip writing the file.
> File 'configure.win' already exists. Skip writing the file.
v Finished configuring extendr for package testpkg.wrap.
* Please run `rextendr::document()` for changes to take effect.

Expand All @@ -235,6 +241,9 @@
v Writing 'src/rust/src/lib.rs'
v Writing 'src/testpkg-win.def'
> File 'R/extendr-wrappers.R' already exists. Skip writing the file.
v Writing 'tools/msrv.R'
v Writing 'configure'
v Writing 'configure.win'
v Finished configuring extendr for package testpkg.
* Please run `rextendr::document()` for changes to take effect.

Expand Down

0 comments on commit 6823c4b

Please sign in to comment.