Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ VignetteBuilder:
Encoding: UTF-8
Language: en-US
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.1
RoxygenNote: 7.1.2
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export(build_vignettes)
export(check)
export(check_built)
export(check_dep_version)
export(check_mac_release)
export(check_man)
export(check_rhub)
export(check_win_devel)
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# devtools (development version)

`release()` and `submit_cran()` now record submission details using the Debian Control File format, for better machine-readability. This file has a new name, CRAN-SUBMISSION (instead of CRAN-RELEASE) and now includes package version, in addition to the full SHA and a timestamp.
* New `check_mac_release()` function to check a package using the macOS builder at https://mac.r-project.org/macbuilder/submit.html (#2375)

* `release()` and `submit_cran()` now record submission details using the Debian Control File format, for better machine-readability. This file has a new name, CRAN-SUBMISSION (instead of CRAN-RELEASE) and now includes package version, in addition to the full SHA and a timestamp.

# devtools 2.4.2

Expand Down
73 changes: 73 additions & 0 deletions R/check-mac.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#' Check macOS package
#'
#' This function works by bundling source package, and then uploading to
#' <https://mac.r-project.org/macbuilder/submit.html>. This function returns a
#' link to the page with the check results.
#'
#' @template devtools
#' @inheritParams pkgbuild::build
#' @param dep_pkgs Additional custom dependencies to install prior to checking the package.
#' @param quiet If `TRUE`, suppresses output.
#' @param ... Additional arguments passed to [pkgbuild::build()].
#' @family build functions
#' @return The url with the check results (invisibly)
#' @export
check_mac_release <- function(pkg = ".", dep_pkgs = ".", args = NULL, manual = TRUE, quiet = FALSE, ...) {
check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn))

pkg <- as.package(pkg)

if (!quiet) {
cli::cli_alert_info(
"Building macOS version of {.pkg {pkg$package}} ({pkg$version})",
"with https://mac.r-project.org/macbuilder/submit.html."
)
}

built_path <- pkgbuild::build(pkg$path, tempdir(),
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, ...
)
}
on.exit(file_delete(c(built_path, dep_built_paths)), add = TRUE)

url <- "https://mac.r-project.org/macbuilder/v1/submit"

body <- list(pkgfile = httr::upload_file(built_path))

if (length(dep_built_paths) > 0) {
uploads <- lapply(dep_built_paths, httr::upload_file)
names(uploads) <- rep("depfiles", length(uploads))
body <- append(body, uploads)
}

res <- httr::POST(url,
body = body,
headers = list(
"Content-Type" = "multipart/form-data"
),
encode = "multipart"
)

httr::stop_for_status(res, task = "Uploading package")

response_url <- httr::content(res)$url

if (!quiet) {
time <- strftime(Sys.time() + 10 * 60, "%I:%M %p")

cli::cli_alert_success(
"[{Sys.Date()}] Check {.url {response_url}} for the results in 5-10 mins (~{time})."
)
}

invisible(response_url)
}
16 changes: 10 additions & 6 deletions man/check.Rd

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

46 changes: 46 additions & 0 deletions man/check_mac_release.Rd

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

1 change: 1 addition & 0 deletions man/check_rhub.Rd

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

1 change: 1 addition & 0 deletions man/check_win.Rd

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