forked from r-lib/devtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck-win.R
91 lines (81 loc) · 2.92 KB
/
check-win.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#' Build windows binary package.
#'
#' This function works by bundling source package, and then uploading to
#' <http://win-builder.r-project.org/>. Once building is complete you'll
#' receive a link to the built package in the email address listed in the
#' maintainer field. It usually takes around 30 minutes. As a side effect,
#' win-build also runs `R CMD check` on the package, so `check_win`
#' is also useful to check that your package is ok on windows.
#'
#' @param pkg package description, can be path or package name. See
#' [as.package()] for more information
#' @inheritParams pkgbuild::build
#' @param quiet If `TRUE`, suppresses output.
#' @param ... Additional arguments passed to [pkgbuild::build()].
#' @family build functions
#' @name check_win
NULL
#' @rdname devtools-deprecated
#' @export
build_win <- function(pkg = ".", version = c("R-devel", "R-release")) {
.Deprecated("check_win_*()", package = "devtools")
check_win(pkg = pkg, version = match.arg(version, several.ok = TRUE))
}
#' @describeIn check_win Check package on the development version of R.
#' @export
check_win_devel <- function(pkg = ".", args = NULL, manual = TRUE, quiet = FALSE, ...) {
check_win(
pkg = pkg, version = "R-devel", args = args, manual = manual,
quiet = quiet, ...
)
}
#' @describeIn check_win Check package on the release version of R.
#' @export
check_win_release <- function(pkg = ".", args = NULL, manual = TRUE, quiet = FALSE, ...) {
check_win(
pkg = pkg, version = "R-release", args = args, manual = manual,
quiet = quiet, ...
)
}
#' @describeIn check_win Check package on the previous major release version of R.
#' @export
check_win_oldrelease <- function(pkg = ".", args = NULL, manual = TRUE, quiet = FALSE, ...) {
check_win(
pkg = pkg, version = "R-oldrelease", args = args, manual = manual,
quiet = quiet, ...
)
}
check_win <- function(pkg = ".", version = c("R-devel", "R-release", "R-oldrelease"),
args = NULL, manual = TRUE, quiet = FALSE, ...) {
pkg <- as.package(pkg)
version <- match.arg(version, several.ok = TRUE)
if (!quiet) {
message(
"Building windows version of ", pkg$package, " (", pkg$version, ")",
" for ", paste(version, collapse = ", "),
" with win-builder.r-project.org.\n"
)
if (interactive() && yesno("Email results to ", maintainer(pkg)$email, "?")) {
return(invisible())
}
}
built_path <- pkgbuild::build(pkg$path, tempdir(),
args = args,
manual = manual, quiet = quiet, ...
)
on.exit(unlink(built_path))
url <- paste0(
"ftp://win-builder.r-project.org/", version, "/",
basename(built_path)
)
lapply(url, upload_ftp, file = built_path)
if (!quiet) {
message(
"[", strftime(Sys.time(), "%I:%M %p (%Y-%m-%d)"), "] ",
"Check ", maintainer(pkg)$email, " for a link to the built package",
if (length(version) > 1) "s" else "",
" in 15-30 mins."
)
}
invisible()
}