From 623d90a80df36dbed605865768ecd3cc09f502ff Mon Sep 17 00:00:00 2001 From: Marco Colombo Date: Sun, 3 Nov 2024 18:37:42 +0100 Subject: [PATCH] Add the debug parameter to load_all() (#301) --- R/load.R | 11 +++++++---- man/load_all.Rd | 6 +++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/R/load.R b/R/load.R index a32df207..6cebae17 100644 --- a/R/load.R +++ b/R/load.R @@ -95,6 +95,8 @@ #' define a function directly in the R console. This is frustrating to debug, #' as it feels like the changes you make to the package source aren't having #' the expected effect. +#' @param debug if `TRUE` (the default) [pkgbuild::compile_dll()] will +#' add debugging flags; `FALSE` will prevent that from happening. #' @keywords programming #' @examples #' \dontrun{ @@ -119,10 +121,11 @@ load_all <- function(path = ".", attach_testthat = uses_testthat(path), quiet = NULL, recompile = FALSE, - warn_conflicts = TRUE) { + warn_conflicts = TRUE, + debug = TRUE) { if (!isTRUE(reset)) { lifecycle::deprecate_warn( - when = "1.3.5", + when = "1.3.5", what = "load_all(reset)", details = "`reset = FALSE` is no longer supported." ) @@ -155,9 +158,9 @@ load_all <- function(path = ".", if (isTRUE(compile)) { pkgbuild::clean_dll(path) - pkgbuild::compile_dll(path, quiet = quiet) + pkgbuild::compile_dll(path, quiet = quiet, debug = debug) } else if (identical(compile, NA)) { - pkgbuild::compile_dll(path, quiet = quiet) + pkgbuild::compile_dll(path, quiet = quiet, debug = debug) } else if (identical(compile, FALSE)) { # don't compile } else { diff --git a/man/load_all.Rd b/man/load_all.Rd index 2c2c7bf2..c70a5b5b 100644 --- a/man/load_all.Rd +++ b/man/load_all.Rd @@ -16,7 +16,8 @@ load_all( attach_testthat = uses_testthat(path), quiet = NULL, recompile = FALSE, - warn_conflicts = TRUE + warn_conflicts = TRUE, + debug = TRUE ) is_loading(pkg = NULL) @@ -64,6 +65,9 @@ define a function directly in the R console. This is frustrating to debug, as it feels like the changes you make to the package source aren't having the expected effect.} +\item{debug}{if \code{TRUE} (the default) \code{\link[pkgbuild:compile_dll]{pkgbuild::compile_dll()}} will +add debugging flags; \code{FALSE} will prevent that from happening.} + \item{pkg}{If supplied, \code{is_loading()} only returns \code{TRUE} if the package being loaded is \code{pkg}.} }