diff --git a/R/cran-compliance.R b/R/cran-compliance.R index 1af01806..57323a28 100644 --- a/R/cran-compliance.R +++ b/R/cran-compliance.R @@ -12,9 +12,8 @@ #' - `vendor_pkgs()` returns a data.frame with two columns `crate` and `version` #' #' @examples -#' #' \dontrun{ -#' vendor_pkgs() +#' vendor_pkgs() #' } #' @export vendor_pkgs <- function(path = ".", quiet = FALSE, overwrite = NULL) { @@ -125,31 +124,31 @@ vendor_pkgs <- function(path = ".", quiet = FALSE, overwrite = NULL) { #' CRAN compliant extendr packages -#' -#' R packages developed using extendr are not immediately ready to -#' be published to CRAN. The extendr package template ensures that +#' +#' R packages developed using extendr are not immediately ready to +#' be published to CRAN. The extendr package template ensures that #' CRAN publication is (farily) painless. -#' -#' @section CRAN requirements: -#' -#' In order to publish a Rust based package on CRAN it must meet certain -#' requirements. These are: +#' +#' @section CRAN requirements: +#' +#' In order to publish a Rust based package on CRAN it must meet certain +#' requirements. These are: #' #' - Rust dependencies are vendored #' - The package is compiled offline #' - the `DESCRIPTION` file's `SystemRequirements` field contains `Cargo (Rust's package manager), rustc` -#' -#' The extendr templates handle all of this _except_ vendoring dependencies. +#' +#' The extendr templates handle all of this _except_ vendoring dependencies. #' This must be done prior to publication using [`vendor_pkgs()`]. -#' +#' #' In addition, it is important to make sure that CRAN maintainers -#' are aware that the package they are checking contains Rust code. +#' are aware that the package they are checking contains Rust code. #' Depending on which and how many crates are used as a dependencies -#' the `vendor.tar.xz` will be larger than a few megabytes. If a -#' built package is larger than 5mbs CRAN may reject the submission. -#' +#' the `vendor.tar.xz` will be larger than a few megabytes. If a +#' built package is larger than 5mbs CRAN may reject the submission. +#' #' To prevent rejection make a note in your `cran-comments.md` file #' (create one using [`usethis::use_cran_comments()`]) along the lines of -#' "The package tarball is 6mb because Rust dependencies are vendored within src/rust/vendor.tar.xz which is 5.9mb." +#' "The package tarball is 6mb because Rust dependencies are vendored within src/rust/vendor.tar.xz which is 5.9mb." #' @name cran -NULL \ No newline at end of file +NULL diff --git a/inst/templates/configure.win b/inst/templates/configure.win index bb18d407..1c465d5a 100644 --- a/inst/templates/configure.win +++ b/inst/templates/configure.win @@ -12,4 +12,4 @@ fi [ -f src/Makevars ] && rm src/Makevars.win # Substitute @CRAN_FLAGS@ in Makevars.in with the actual value of $CRAN_FLAGS -sed -e "s|@CRAN_FLAGS@|$CRAN_FLAGS|" src/Makevars.in > src/Makevars \ No newline at end of file +sed -e "s|@CRAN_FLAGS@|$CRAN_FLAGS|" src/Makevars.win.in > src/Makevars.win \ No newline at end of file diff --git a/tests/testthat/_snaps/use_extendr.md b/tests/testthat/_snaps/use_extendr.md index 02b3cc7a..3454f723 100644 --- a/tests/testthat/_snaps/use_extendr.md +++ b/tests/testthat/_snaps/use_extendr.md @@ -58,7 +58,7 @@ [ -f src/Makevars ] && rm src/Makevars.win # Substitute @CRAN_FLAGS@ in Makevars.in with the actual value of $CRAN_FLAGS - sed -e "s|@CRAN_FLAGS@|$CRAN_FLAGS|" src/Makevars.in > src/Makevars + sed -e "s|@CRAN_FLAGS@|$CRAN_FLAGS|" src/Makevars.win.in > src/Makevars.win --- diff --git a/tests/testthat/test-cran-compliance.R b/tests/testthat/test-cran-compliance.R index 4c1e505e..1eac8c7d 100644 --- a/tests/testthat/test-cran-compliance.R +++ b/tests/testthat/test-cran-compliance.R @@ -23,14 +23,19 @@ test_that("rextendr passes CRAN checks", { use_extendr() document() vendor_pkgs() - res <- rcmdcheck::rcmdcheck(env = c("NOT_CRAN" = "")) + + res <- rcmdcheck::rcmdcheck( + env = c("NOT_CRAN" = ""), + args = "--no-manual", + libpath = rev(.libPaths()) + ) # --offline flag should be set expect_true(grepl("--offline", res$install_out)) # -j 2 flag should be set expect_true(grepl("-j 2", res$install_out)) - # "Downloading" should not be present + # "Downloading" should not be present expect_false(grepl("Downloading", res$install_out)) expect_true( diff --git a/tests/testthat/test-use_extendr.R b/tests/testthat/test-use_extendr.R index a770b098..52f1f236 100644 --- a/tests/testthat/test-use_extendr.R +++ b/tests/testthat/test-use_extendr.R @@ -148,7 +148,7 @@ test_that("use_extendr() handles R package name, crate name and library name sep test_that("use_extendr() does not allow invalid rust names", { skip_if_not_installed("usethis") - path <- local_package("testPackage") + path <- local_package("testPackage") expect_rextendr_error(use_extendr(crate_name = "22unsupported")) expect_rextendr_error(use_extendr(lib_name = "@unsupported")) }) @@ -205,9 +205,12 @@ test_that("`use_extendr()` passes R CMD check", { document() # store results - res <- rcmdcheck::rcmdcheck(env = c("NOT_CRAN"="true")) + res <- rcmdcheck::rcmdcheck( + args = "--no-manual", + libpath = rev(.libPaths()) + ) - # check the output + # check the output expect_true( rlang::is_empty(res$errors) && rlang::is_empty(res$warnings) )