diff --git a/NAMESPACE b/NAMESPACE index b9b6527f3..5e0c111d5 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -13,6 +13,7 @@ export(build_vignettes) export(check) export(check_built) export(check_dep_version) +export(check_mac_devel) export(check_mac_release) export(check_man) export(check_rhub) diff --git a/NEWS.md b/NEWS.md index c67e0bc1c..73c5e6153 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,6 +8,8 @@ * `test_coverage_active_file()` now reports if any tests failed and does a better job of executing snapshot comparisons. +* New `check_mac_devel()` function to check a package using the macOS builder at https://mac.r-project.org/macbuilder/submit.html (@nfrerebeau, #2507) + # devtools 2.4.5 * `check(cleanup =)` was deprecated in devtools v1.11.0 (2016-04-12) and was diff --git a/R/check-mac.R b/R/check-mac.R index 3346775d2..3d444ac89 100644 --- a/R/check-mac.R +++ b/R/check-mac.R @@ -10,12 +10,37 @@ #' the package. #' @family build functions #' @return The url with the check results (invisibly) +#' @name check_mac +NULL + +#' @describeIn check_mac Check package on the development version of R. +#' @export +check_mac_devel <- function(pkg = ".", dep_pkgs = character(), args = NULL, manual = TRUE, quiet = FALSE, ...) { + check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn)) + + check_mac( + pkg = pkg, version = "R-devel", dep_pkgs = dep_pkgs, + args = args, manual = manual, quiet = quiet, ... + ) +} + +#' @describeIn check_mac Check package on the released version of R. #' @export check_mac_release <- function(pkg = ".", dep_pkgs = character(), args = NULL, manual = TRUE, quiet = FALSE, ...) { check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn)) + check_mac( + pkg = pkg, version = "R-release", dep_pkgs = dep_pkgs, + args = args, manual = manual, quiet = quiet, ... + ) +} + +check_mac <- function(pkg = ".", version = c("R-devel", "R-release"), + dep_pkgs = character(), args = NULL, manual = TRUE, quiet = FALSE, ...) { pkg <- as.package(pkg) + version <- match.arg(version, several.ok = FALSE) + if (!quiet) { cli::cli_inform(c( "Building macOS version of {.pkg {pkg$package}} ({pkg$version})", @@ -24,16 +49,16 @@ check_mac_release <- function(pkg = ".", dep_pkgs = character(), args = NULL, ma } built_path <- pkgbuild::build(pkg$path, tempdir(), - args = args, - manual = manual, quiet = quiet, ... + args = args, + manual = manual, quiet = quiet, ... ) dep_built_paths <- character() for (i in seq_along(dep_pkgs)) { dep_pkg <- as.package(dep_pkgs[[i]])$path dep_built_paths[[i]] <- pkgbuild::build(dep_pkg, tempdir(), - args = args, - manual = manual, quiet = quiet, ... + args = args, + manual = manual, quiet = quiet, ... ) } on.exit(file_delete(c(built_path, dep_built_paths)), add = TRUE) @@ -41,7 +66,8 @@ check_mac_release <- function(pkg = ".", dep_pkgs = character(), args = NULL, ma url <- "https://mac.r-project.org/macbuilder/v1/submit" rlang::check_installed("httr") - body <- list(pkgfile = httr::upload_file(built_path)) + body <- list(pkgfile = httr::upload_file(built_path), + rflavor = tolower(version)) if (length(dep_built_paths) > 0) { uploads <- lapply(dep_built_paths, httr::upload_file) @@ -50,11 +76,11 @@ check_mac_release <- function(pkg = ".", dep_pkgs = character(), args = NULL, ma } res <- httr::POST(url, - body = body, - headers = list( - "Content-Type" = "multipart/form-data" - ), - encode = "multipart" + body = body, + headers = list( + "Content-Type" = "multipart/form-data" + ), + encode = "multipart" ) httr::stop_for_status(res, task = "Uploading package") diff --git a/man/check_mac_release.Rd b/man/check_mac.Rd similarity index 77% rename from man/check_mac_release.Rd rename to man/check_mac.Rd index 48fa2fc4b..960432ce4 100644 --- a/man/check_mac_release.Rd +++ b/man/check_mac.Rd @@ -1,9 +1,20 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/check-mac.R -\name{check_mac_release} +\name{check_mac} +\alias{check_mac} +\alias{check_mac_devel} \alias{check_mac_release} \title{Check a package on macOS} \usage{ +check_mac_devel( + pkg = ".", + dep_pkgs = character(), + args = NULL, + manual = TRUE, + quiet = FALSE, + ... +) + check_mac_release( pkg = ".", dep_pkgs = character(), @@ -38,6 +49,13 @@ This function first bundles a source package, then uploads it to \url{https://mac.r-project.org/macbuilder/submit.html}. This function returns a link to the page where the check results will appear. } +\section{Functions}{ +\itemize{ +\item \code{check_mac_devel()}: Check package on the development version of R. + +\item \code{check_mac_release()}: Check package on the released version of R. + +}} \seealso{ Other build functions: \code{\link{check_rhub}()}, diff --git a/man/check_rhub.Rd b/man/check_rhub.Rd index 8eb445901..f48c60450 100644 --- a/man/check_rhub.Rd +++ b/man/check_rhub.Rd @@ -53,7 +53,7 @@ results. See more at \code{\link[rhub:validate_email]{rhub::validate_email()}}. \seealso{ Other build functions: -\code{\link{check_mac_release}()}, +\code{\link{check_mac}()}, \code{\link{check_win}()} } \concept{build functions} diff --git a/man/check_win.Rd b/man/check_win.Rd index 60461fab6..957a87a20 100644 --- a/man/check_win.Rd +++ b/man/check_win.Rd @@ -70,7 +70,7 @@ deleted after a couple of days. }} \seealso{ Other build functions: -\code{\link{check_mac_release}()}, +\code{\link{check_mac}()}, \code{\link{check_rhub}()} } \concept{build functions}