Skip to content

Commit 395c9d3

Browse files
authored
Have use_release_issue() remind tidy packages to bump minimum R version (#1845)
* Release: bump R version if behind tidy min version * Test bump R version * Make tidy_minimum_r_version() return a numeric_version
1 parent a1ef597 commit 395c9d3

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

R/release.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ release_checklist <- function(version, on_cran) {
7777
has_readme <- file_exists(proj_path("README.Rmd"))
7878
has_github_links <- has_github_links()
7979
is_posit_pkg <- is_posit_pkg()
80+
tidy_min_r_version <- tidy_minimum_r_version()
8081

8182
milestone_num <- NA # for testing (and general fallback)
8283
if (uses_git() && curl::has_internet()) {
@@ -111,6 +112,8 @@ release_checklist <- function(version, on_cran) {
111112
Check if any deprecation processes should be advanced, as described in \\
112113
[Gradual deprecation](https://lifecycle.r-lib.org/articles/communicate.html#gradual-deprecation)",
113114
type != "patch" && has_lifecycle),
115+
todo("Bump required R version in DESCRIPTION to {tidy_min_r_version}",
116+
is_posit_pkg && tidy_min_r_version > pkg_minimum_r_version()),
114117
todo("`usethis::use_news_md()`", on_cran && !has_news),
115118
todo("[Polish NEWS](https://style.tidyverse.org/news.html#news-release)", on_cran),
116119
todo("`usethis::use_github_links()`", !has_github_links),
@@ -525,3 +528,12 @@ author_has_rstudio_email <- function() {
525528
desc <- proj_desc()
526529
any(grepl("@rstudio[.]com", tolower(desc$get_authors())))
527530
}
531+
532+
pkg_minimum_r_version <- function() {
533+
deps <- proj_desc()$get_deps()
534+
r_dep <- deps[deps$package == "R" & deps$type == "Depends", "version"]
535+
if (length(r_dep) == 0) {
536+
return(numeric_version(0))
537+
}
538+
numeric_version(gsub("[^0-9.]", "", r_dep))
539+
}

R/upkeep.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ tidy_minimum_r_version <- function() {
283283
version <- jsonlite::fromJSON(json)$version
284284
oldrel_4 <- re_match(version, "[0-9]+[.][0-9]+")$.match
285285
}
286-
oldrel_4
286+
numeric_version(oldrel_4)
287287
}
288288

289289
lowercase_r <- function() {

tests/testthat/_snaps/release.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@
136136
137137
* [ ] `git pull`
138138
* [ ] Check [current CRAN check results](https://cran.rstudio.org/web/checks/check_results_{TESTPKG}.html)
139+
* [ ] Bump required R version in DESCRIPTION to 3.6
139140
* [ ] `usethis::use_news_md()`
140141
* [ ] [Polish NEWS](https://style.tidyverse.org/news.html#news-release)
141142
* [ ] `usethis::use_github_links()`

tests/testthat/test-release.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,17 @@ test_that("construct correct revdep bullet", {
6161
test_that("RStudio-ness detection works", {
6262
withr::local_options(usethis.description = NULL)
6363
create_local_package()
64+
local_mocked_bindings(
65+
tidy_minimum_r_version = function() numeric_version("3.6")
66+
)
6467

6568
expect_false(is_posit_pkg())
6669

6770
desc <- proj_desc()
6871
desc$add_author(given = "PoSiT, PbC", role = "fnd")
6972
desc$add_author(given = "someone", email = "[email protected]")
7073
desc$add_urls("https://github.com/tidyverse/WHATEVER")
74+
desc$set_dep("R", "Depends", version = ">= 3.4")
7175
desc$write()
7276

7377
expect_true(is_posit_pkg())

0 commit comments

Comments
 (0)