r-lib / rcmdcheck

Run R CMD check from R and collect the results
https://rcmdcheck.r-lib.org
Other
115 stars 27 forks source link

Fix check() failing when Rtools not installed #178

Open maxsutton opened 2 years ago

maxsutton commented 2 years ago

pkgbuild::local_build_tools() fails if Rtools is missing on Windows when required argument is TRUE, which is the default. This changes required to FALSE, which shouldn't throw an error, but will load Rtools if it is available.

Closes #174.

codecov-commenter commented 2 years ago

Codecov Report

Merging #178 (0c3b082) into main (bda6e71) will not change coverage. The diff coverage is 100.00%.

:exclamation: Current head 0c3b082 differs from pull request most recent head 3fd9f7d. Consider uploading reports for the commit 3fd9f7d to get more accurate results

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #178   +/-   ##
=======================================
  Coverage   80.63%   80.63%           
=======================================
  Files          19       19           
  Lines        1007     1007           
=======================================
  Hits          812      812           
  Misses        195      195           
Impacted Files Coverage Δ
R/package.R 87.09% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update bda6e71...3fd9f7d. Read the comment docs.

gaborcsardi commented 2 years ago

Thanks! So after this patch, what happens if a package needs Rtools, but it is not installed? What is the error you get?

maxsutton commented 2 years ago

I tried this patch out with the dplyr and data.table packages, which require Rtools. I got the following output from rcmdcheck() and devtools::check() (they're the same across both dplyr and data.table). In both cases, a pop-up appears asking if the user wants to install Rtools. I've shown the output if they select No.

This output is very similar to (if not the same as) the output from rcmdcheck 1.4.0, shown below.

With patch

rcmdcheck::rcmdcheck()
WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/.
-- R CMD build ------------------------------------------------------------------------------------------------
pdflatex not found! Not building PDF manual.
WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/.
Error: Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.
==> devtools::check(document = FALSE)

-- Building ------------------------------------------- data.table --
Setting env vars:
* CFLAGS    : -Wall -pedantic
* CXXFLAGS  : -Wall -pedantic
* CXX11FLAGS: -Wall -pedantic
---------------------------------------------------------------------
WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/.
WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/.
Error: Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.
Execution halted

Exited with status 1.

rcmdcheck 1.4.0

> rcmdcheck::rcmdcheck()
WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/.
Error: Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.
==> devtools::check(document = FALSE)

-- Building ------------------------------------------- data.table --
Setting env vars:
* CFLAGS    : -Wall -pedantic
* CXXFLAGS  : -Wall -pedantic
* CXX11FLAGS: -Wall -pedantic
---------------------------------------------------------------------
WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/.
WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/.
Error: Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.
Execution halted

Exited with status 1.
maxsutton commented 2 years ago

Separately, the checks show that the package now fails for R 3.4. I don't know if this is related to this PR, or if that's because of a change somewhere else?