Skip to content

Commit 18f4944

Browse files
committed
Add check_mac_devel()
1 parent 2aa51ef commit 18f4944

File tree

6 files changed

+60
-13
lines changed

6 files changed

+60
-13
lines changed

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export(build_vignettes)
1313
export(check)
1414
export(check_built)
1515
export(check_dep_version)
16+
export(check_mac_devel)
1617
export(check_mac_release)
1718
export(check_man)
1819
export(check_rhub)

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
* `test_coverage_active_file()` now reports if any tests failed and does
99
a better job of executing snapshot comparisons.
1010

11+
* New `check_mac_devel()` function to check a package using the macOS builder at https://mac.r-project.org/macbuilder/submit.html (@nfrerebeau, #2507)
12+
1113
# devtools 2.4.5
1214

1315
* `check(cleanup =)` was deprecated in devtools v1.11.0 (2016-04-12) and was

R/check-mac.R

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,37 @@
1010
#' the package.
1111
#' @family build functions
1212
#' @return The url with the check results (invisibly)
13+
#' @name check_mac
14+
NULL
15+
16+
#' @describeIn check_mac Check package on the development version of R.
17+
#' @export
18+
check_mac_devel <- function(pkg = ".", dep_pkgs = character(), args = NULL, manual = TRUE, quiet = FALSE, ...) {
19+
check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn))
20+
21+
check_mac(
22+
pkg = pkg, version = "R-devel", dep_pkgs = dep_pkgs,
23+
args = args, manual = manual, quiet = quiet, ...
24+
)
25+
}
26+
27+
#' @describeIn check_mac Check package on the released version of R.
1328
#' @export
1429
check_mac_release <- function(pkg = ".", dep_pkgs = character(), args = NULL, manual = TRUE, quiet = FALSE, ...) {
1530
check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn))
1631

32+
check_mac(
33+
pkg = pkg, version = "R-release", dep_pkgs = dep_pkgs,
34+
args = args, manual = manual, quiet = quiet, ...
35+
)
36+
}
37+
38+
check_mac <- function(pkg = ".", version = c("R-devel", "R-release"),
39+
dep_pkgs = character(), args = NULL, manual = TRUE, quiet = FALSE, ...) {
1740
pkg <- as.package(pkg)
1841

42+
version <- match.arg(version, several.ok = FALSE)
43+
1944
if (!quiet) {
2045
cli::cli_inform(c(
2146
"Building macOS version of {.pkg {pkg$package}} ({pkg$version})",
@@ -24,24 +49,25 @@ check_mac_release <- function(pkg = ".", dep_pkgs = character(), args = NULL, ma
2449
}
2550

2651
built_path <- pkgbuild::build(pkg$path, tempdir(),
27-
args = args,
28-
manual = manual, quiet = quiet, ...
52+
args = args,
53+
manual = manual, quiet = quiet, ...
2954
)
3055

3156
dep_built_paths <- character()
3257
for (i in seq_along(dep_pkgs)) {
3358
dep_pkg <- as.package(dep_pkgs[[i]])$path
3459
dep_built_paths[[i]] <- pkgbuild::build(dep_pkg, tempdir(),
35-
args = args,
36-
manual = manual, quiet = quiet, ...
60+
args = args,
61+
manual = manual, quiet = quiet, ...
3762
)
3863
}
3964
on.exit(file_delete(c(built_path, dep_built_paths)), add = TRUE)
4065

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

4368
rlang::check_installed("httr")
44-
body <- list(pkgfile = httr::upload_file(built_path))
69+
body <- list(pkgfile = httr::upload_file(built_path),
70+
rflavor = tolower(version))
4571

4672
if (length(dep_built_paths) > 0) {
4773
uploads <- lapply(dep_built_paths, httr::upload_file)
@@ -50,11 +76,11 @@ check_mac_release <- function(pkg = ".", dep_pkgs = character(), args = NULL, ma
5076
}
5177

5278
res <- httr::POST(url,
53-
body = body,
54-
headers = list(
55-
"Content-Type" = "multipart/form-data"
56-
),
57-
encode = "multipart"
79+
body = body,
80+
headers = list(
81+
"Content-Type" = "multipart/form-data"
82+
),
83+
encode = "multipart"
5884
)
5985

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

man/check_mac_release.Rd renamed to man/check_mac.Rd

Lines changed: 19 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/check_rhub.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/check_win.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)