Skip to content

Commit 8d4ac68

Browse files
authored
[R-package] [ci] drop support for R 3.x (fixes #7023) (#7038)
1 parent 336a77d commit 8d4ac68

File tree

10 files changed

+16
-99
lines changed

10 files changed

+16
-99
lines changed

.ci/test-r-package-windows.ps1

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,28 +61,24 @@ Remove-From-Path ".*R Client.*"
6161
Remove-From-Path ".*rtools40.*"
6262
Remove-From-Path ".*rtools42.*"
6363
Remove-From-Path ".*rtools43.*"
64+
Remove-From-Path ".*rtools44.*"
65+
Remove-From-Path ".*rtools45.*"
6466
Remove-From-Path ".*shells.*"
6567
Remove-From-Path ".*Strawberry.*"
6668
Remove-From-Path ".*tools.*"
6769

6870
Remove-Item C:\rtools40 -Force -Recurse -ErrorAction Ignore
6971
Remove-Item C:\rtools42 -Force -Recurse -ErrorAction Ignore
7072
Remove-Item C:\rtools43 -Force -Recurse -ErrorAction Ignore
73+
Remove-Item C:\rtools44 -Force -Recurse -ErrorAction Ignore
74+
Remove-Item C:\rtools45 -Force -Recurse -ErrorAction Ignore
7175

7276
# Get details needed for installing R components
7377
#
7478
# NOTES:
7579
# * some paths and file names are different on R4.0
7680
$env:R_MAJOR_VERSION = $env:R_VERSION.split('.')[0]
77-
if ($env:R_MAJOR_VERSION -eq "3") {
78-
# Rtools 3.x has to be installed at C:\Rtools\
79-
# * https://stackoverflow.com/a/46619260/3986677
80-
$RTOOLS_INSTALL_PATH = "C:\Rtools"
81-
$env:RTOOLS_BIN = "$RTOOLS_INSTALL_PATH\bin"
82-
$env:RTOOLS_MINGW_BIN = "$RTOOLS_INSTALL_PATH\mingw_64\bin"
83-
$env:RTOOLS_EXE_FILE = "rtools35-x86_64.exe"
84-
$env:R_WINDOWS_VERSION = "3.6.3"
85-
} elseif ($env:R_MAJOR_VERSION -eq "4") {
81+
if ($env:R_MAJOR_VERSION -eq "4") {
8682
$RTOOLS_INSTALL_PATH = "C:\rtools43"
8783
$env:RTOOLS_BIN = "$RTOOLS_INSTALL_PATH\usr\bin"
8884
$env:RTOOLS_MINGW_BIN = "$RTOOLS_INSTALL_PATH\x86_64-w64-mingw32.static.posix\bin"
@@ -104,11 +100,7 @@ $env:PATH = @(
104100
"$env:CMAKE_PATH/cmake-$env:CMAKE_VERSION-windows-x86_64/bin",
105101
"$env:PATH"
106102
) -join ";"
107-
if ([version]$env:R_VERSION -lt [version]"4.0") {
108-
$env:CRAN_MIRROR = "https://cran-archive.r-project.org"
109-
} else {
110-
$env:CRAN_MIRROR = "https://cran.rstudio.com"
111-
}
103+
$env:CRAN_MIRROR = "https://cran.rstudio.com"
112104
$env:MIKTEX_EXCEPTION_PATH = "$env:TEMP\miktex"
113105

114106
# don't fail builds for long-running examples unless they're very long.
@@ -202,13 +194,6 @@ if ($env:COMPILER -ne "MSVC") {
202194
Invoke-R-Code-Redirect-Stderr "commandArgs <- function(...){$env:BUILD_R_FLAGS}; source('build_r.R')"
203195
Assert-Output $?
204196
} elseif ($env:R_BUILD_TYPE -eq "cran") {
205-
# NOTE: gzip and tar are needed to create a CRAN package on Windows, but
206-
# some flavors of tar.exe can fail in some settings on Windows.
207-
# Putting the msys64 utilities at the beginning of PATH temporarily to be
208-
# sure they're used for that purpose.
209-
if ($env:R_MAJOR_VERSION -eq "3") {
210-
$env:PATH = @("C:\msys64\usr\bin", "$env:PATH") -join ";"
211-
}
212197
$params = -join @(
213198
"result <- processx::run(command = 'sh', args = 'build-cran-package.sh', ",
214199
"echo = TRUE, windows_verbatim_args = FALSE, error_on_status = TRUE)"

.github/workflows/r_package.yml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,6 @@ jobs:
8383
r_version: 4.3
8484
build_type: cmake
8585
container: null
86-
- os: windows-latest
87-
task: r-package
88-
compiler: MINGW
89-
toolchain: MINGW
90-
r_version: 3.6
91-
build_type: cmake
92-
container: null
9386
- os: windows-latest
9487
task: r-package
9588
compiler: MINGW
@@ -98,13 +91,6 @@ jobs:
9891
build_type: cmake
9992
container: null
10093
# Visual Studio 2022
101-
- os: windows-2022
102-
task: r-package
103-
compiler: MSVC
104-
toolchain: MSVC
105-
r_version: 3.6
106-
build_type: cmake
107-
container: null
10894
- os: windows-2022
10995
task: r-package
11096
compiler: MSVC
@@ -115,13 +101,6 @@ jobs:
115101
###############
116102
# CRAN builds #
117103
###############
118-
- os: windows-latest
119-
task: r-package
120-
compiler: MINGW
121-
toolchain: MINGW
122-
r_version: 3.6
123-
build_type: cran
124-
container: null
125104
- os: windows-latest
126105
task: r-package
127106
compiler: MINGW

R-package/DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Suggests:
5151
RhpcBLASctl,
5252
testthat
5353
Depends:
54-
R (>= 3.5)
54+
R (>= 4.0)
5555
Imports:
5656
R6 (>= 2.4.0),
5757
data.table (>= 1.9.6),
@@ -62,5 +62,5 @@ Imports:
6262
parallel,
6363
utils
6464
SystemRequirements:
65-
~~CXXSTD~~
65+
C++17
6666
RoxygenNote: 7.3.2

R-package/R/lgb.Dataset.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ Dataset <- R6::R6Class(
266266
handle <- .Call(
267267
LGBM_DatasetGetSubset_R
268268
, ref_handle
269-
, c(private$used_indices) # Adding c() fixes issue in R v3.5
269+
, c(private$used_indices)
270270
, length(private$used_indices)
271271
, params_str
272272
)

R-package/README.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ Installing a 64-bit version of [Rtools](https://cran.r-project.org/bin/windows/R
9292
After installing `Rtools` and `CMake`, be sure the following paths are added to the environment variable `PATH`. These may have been automatically added when installing other software.
9393

9494
* `Rtools`
95-
- If you have `Rtools` 3.x, example:
96-
- `C:\Rtools\mingw_64\bin`
9795
- If you have `Rtools` 4.0, example:
9896
- `C:\rtools40\mingw64\bin`
9997
- `C:\rtools40\usr\bin`
@@ -104,7 +102,7 @@ After installing `Rtools` and `CMake`, be sure the following paths are added to
104102
* `CMake`
105103
- example: `C:\Program Files\CMake\bin`
106104
* `R`
107-
- example: `C:\Program Files\R\R-3.6.1\bin`
105+
- example: `C:\Program Files\R\R-4.5.1\bin`
108106

109107
NOTE: Two `Rtools` paths are required from `Rtools` 4.0 onwards because paths and the list of included software was changed in `Rtools` 4.0.
110108

@@ -120,16 +118,6 @@ A "toolchain" refers to the collection of software used to build the library. Th
120118

121119
By default, the package will be built with [Visual Studio Build Tools](https://visualstudio.microsoft.com/downloads/).
122120

123-
**MinGW (R 3.x)**
124-
125-
If you are using R 3.x and installation fails with Visual Studio, `LightGBM` will fall back to using [MinGW](https://www.mingw-w64.org/) bundled with `Rtools`.
126-
127-
If you want to force `LightGBM` to use MinGW (for any R version), pass `--use-mingw` to the installation script.
128-
129-
```shell
130-
Rscript build_r.R --use-mingw
131-
```
132-
133121
**MSYS2 (R 4.x)**
134122

135123
If you are using R 4.x and installation fails with Visual Studio, `LightGBM` will fall back to using [MSYS2](https://www.msys2.org/). This should work with the tools already bundled in `Rtools` 4.0.

R-package/configure.win

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,11 @@
77

88
R_EXE="${R_HOME}/bin${R_ARCH_BIN}/R"
99

10-
# As described in "Using C++ code" in "Writing R Extensions",
11-
# Rtools35 shipped with g++ 4.9, which didn't support C++17.
12-
#
13-
# Testing here for C++17 support, to account for that possibility
14-
# and to continue supporting R 3.6.
15-
#
1610
CXX17=`"${R_EXE}" CMD config CXX17`
1711
CXX17STD=`"${R_EXE}" CMD config CXX17STD`
1812
CXX="${CXX17} ${CXX17STD}"
1913
CXXFLAGS=`"${R_EXE}" CMD config CXX17FLAGS`
2014
CXX_STD="CXX17"
21-
22-
cpp17_supported="yes"
23-
if test "${CXX17}" = "";
24-
then
25-
cpp17_supported="no"
26-
CXX11=`"${R_EXE}" CMD config CXX11`
27-
CXX11STD=`"${R_EXE}" CMD config CXX11STD`
28-
CXX="${CXX11} ${CXX11STD}"
29-
CXXFLAGS=`"${R_EXE}" CMD config CXX11FLAGS`
30-
CXX_STD="CXX11"
31-
fi
32-
echo "checking whether C++17 is supported...${cpp17_supported}"
33-
3415
CPPFLAGS=`"${R_EXE}" CMD config CPPFLAGS`
3516

3617
# LightGBM-specific flags

R-package/tests/testthat/helper.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@ data.table::setDTthreads(1L)
3535
Sys.getenv("LIGHTGBM_TEST_VERBOSITY", "-1")
3636
)
3737

38+
3839
# [description]
3940
# test that every element of 'x' is in 'y'
4041
#
41-
# testthat::expect_in() is not available in version of {testthat}
42-
# built for R 3.6, this is here to support a similar interface on R 3.6
42+
# testthat::expect_in() was added in {testthat} v3.1.19
43+
# This is here to support a similar interface on older {testthat} versions.
4344
.expect_in <- function(x, y) {
4445
if (exists("expect_in")) {
4546
expect_in(x, y)

build-cran-package.sh

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,6 @@ cd "${TEMP_R_DIR}"
127127
sed -i.bak -e "s/~~VERSION~~/${LGB_VERSION}/" DESCRIPTION
128128
sed -i.bak -e "s/~~DATE~~/${CURRENT_DATE}/" DESCRIPTION
129129

130-
# Rtools35 (used with R 3.6 on Windows) doesn't support C++17
131-
LGB_CXX_STD="C++17"
132-
using_windows_and_r3=$(
133-
# shellcheck disable=SC2016
134-
Rscript -e 'cat(.Platform$OS.type == "windows" && R.version[["major"]] < 4)'
135-
)
136-
if test "${using_windows_and_r3}" = "TRUE"; then
137-
LGB_CXX_STD="C++11"
138-
fi
139-
sed -i.bak -e "s/~~CXXSTD~~/${LGB_CXX_STD}/" DESCRIPTION
140-
141130
# Remove 'region', 'endregion', and 'warning' pragmas.
142131
# This won't change the correctness of the code. CRAN does
143132
# not allow you to use compiler flag '-Wno-unknown-pragmas' or

build_r.R

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -390,12 +390,6 @@ description_contents <- gsub(
390390
, x = description_contents
391391
, fixed = TRUE
392392
)
393-
description_contents <- gsub(
394-
pattern = "~~CXXSTD~~"
395-
, replacement = "C++11"
396-
, x = description_contents
397-
, fixed = TRUE
398-
)
399393
writeLines(description_contents, DESCRIPTION_FILE)
400394

401395
# NOTE: --keep-empty-dirs is necessary to keep the deep paths expected

docker/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,12 @@ Then navigate to `localhost:8787` in your local web browser, and log in with use
185185

186186
To target a different R version, pass any [valid rocker/verse tag](https://hub.docker.com/r/rocker/verse/tags) to `docker build`.
187187

188-
For example, to test LightGBM with R 3.5:
188+
For example, to test LightGBM with R 4.5:
189189

190190
```shell
191191
docker build \
192-
-t lightgbm-r-35 \
192+
-t lightgbm-r-45 \
193193
-f dockerfile-r \
194-
--build-arg R_VERSION=3.5 \
194+
--build-arg R_VERSION=4.5 \
195195
.
196196
```

0 commit comments

Comments
 (0)