Skip to content

Commit

Permalink
Add a vignettes argument to check
Browse files Browse the repository at this point in the history
It is too esoteric for people to remember they need to disable building
vignettes for R CMD build as well as for R CMD check, so we now have a
vignette argument in check() that can be used to do both.

Fixes #2165
  • Loading branch information
jimhester committed Dec 17, 2019
1 parent e463a32 commit 4cbed16
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions NEWS.md
@@ -1,5 +1,6 @@
# devtools (development version)

* `check()` gains a `vignettes` argument, to more easily disable checks for vignettes (#2165).
* `check_win_*()` function now resets the email to the original email after execution (@muschellij2, #2152).
* `check()` now sets `NOT_CRAN=true` by default, as was originally intended
(#2135).
Expand Down
8 changes: 8 additions & 0 deletions R/check.R
Expand Up @@ -47,6 +47,8 @@
#' compatibility. `args = "--output=/foo/bar"` can be used to change the
#' check directory.
#' @param ... Additional arguments passed on to [pkgbuild::build()].
#' @param vignettes If `FALSE`, do not build or check vignettes, equivalent to
#' using `args = '--ignore-vignettes' and `build_args = '--no-build-vignettes'.
#' @param cleanup Deprecated.
#' @seealso [release()] if you want to send the checked package to
#' CRAN.
Expand All @@ -66,6 +68,7 @@ check <- function(pkg = ".",
quiet = FALSE,
check_dir = tempdir(),
cleanup = TRUE,
vignettes = TRUE,
error_on = c("never", "error", "warning", "note")) {
pkg <- as.package(pkg)
withr::local_options(list(warn = 1))
Expand Down Expand Up @@ -100,13 +103,18 @@ check <- function(pkg = ".",

check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn))

if (identical(vignettes, FALSE)) {
args <- union(args, "--ignore-vignettes")
}

withr::with_envvar(pkgbuild::compiler_flags(FALSE), action = "prefix", {
built_path <- pkgbuild::build(
pkg$path,
tempdir(),
args = build_args,
quiet = quiet,
manual = manual,
vignettes = vignettes,
...
)
on.exit(unlink(built_path), add = TRUE)
Expand Down
4 changes: 4 additions & 0 deletions man/check.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4cbed16

Please sign in to comment.