r-lib / devtools

Tools to make an R developer's life easier
https://devtools.r-lib.org
Other
2.41k stars 756 forks source link

`check_win_*`: accept a path to `*.tar.gz` #2588

Open MLopez-Ibanez opened 4 days ago

MLopez-Ibanez commented 4 days ago

Building my package is not trivial so it would be great if check_win_* functions accepted already built *.tar.gz packages and avoided rebuilding them. The documentation gives the impression that this should be possible "pkg: The package to use, can be a file path to the package or a package object." but only the path to the source directory of the package is accepted.

jennybc commented 4 days ago

Well, the "package object" here:

The package to use, can be a file path to the package or a package object.

is referring to an actual S3 class used (mostly) internally inside devtools.

x <- devtools::as.package("~/rrr/devtools")
class(x)
#> [1] "package"
str(x, list.len = 5)
#> List of 20
#>  $ package                : chr "devtools"
#>  $ title                  : chr "Tools to Make Developing R Packages Easier"
#>  $ version                : chr "2.4.5.9000"
#>  $ authors@r              : chr "c(\nperson(\"Hadley\", \"Wickham\", role = \"aut\"),\nperson(\"Jim\", \"Hester\", role = \"aut\"),\nperson(\"Wi"| __truncated__
#>  $ description            : chr "Collection of package development tools."
#>   [list output truncated]
#>  - attr(*, "class")= chr "package"

It's not referring to a *.tar.gz.

I too have felt a related need (#2485), so I do understand where you're coming from.

But I also think, whenever possible, it's worth asking "why does it take so long to build my package?" and seeing if there are other measures you can take to give yourself a smoother dev experience.

What is taking so long? Meaning: is it compilation, super slow vignettes, etc.

MLopez-Ibanez commented 3 days ago

What is taking so long? Meaning: is it compilation, super slow vignettes, etc.

The time is not the issue. I further compress the PDF vignette after creating the *.tar.gz because R CMD build does not go far enough.

You can see the script I am using here: https://github.com/MLopez-Ibanez/irace/blob/master/scripts/recompact.sh

It is not inserting a new vignette. It is just replacing the vignette PDF with one that is compressed as much as it is possible.

It seems to work fine in CRAN. Yes I cannot use devtools to submit, but the alternative is that CRAN complains that my vignettes are too large, which is even more painful. If devtools could do what my script does, then I'll happily get rid of my script and use devtools to submit.