Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Why does `build_setup_source` delete `inst/doc`? #58
Comments
This is not true, you can copy folders with the full structure. But you have to be careful how you construct the regular expression in E.g. if I want to copy the
In your |
I stand corrected, thank you for pointing this out :) One thing though is that Doxygen documentation is not negligible in size -- about 100KB (compressed) of overhead for any project (but scales relatively well with project size). So, if possible I'd like for the Doxygen doc not to be duplicated for the purpose of uploading to CRAN. Would love to hear your thoughts on this if you get a chance. |
Actually this can be achieved by adding a line to Anyways, thank you very much for your help. |
Out of curiosity, would it be possible to answer the original question? I really would like to benefit from your insights as to why the standard source location for package documentation ought to be changed from |
It is extremely common for authors to mistakenly have stale vignette outputs in |
Thank you for the explanation -- this makes perfect sense. Might you consider a minimal PR to make the deletion by default but optional? I was thinking along the lines of a |
@mlysy that will not take you very far, because pkgbuild is often called downstream, e.g. by rcmdcheck or |
I realized this (too late), and would have liked to amend my suggestion to the prompt asking whether or not to delete Forgive me for being persistent, but I do hope there is some value in encouraging R package developers to better document their C++ source code, for which Doyxgen (in my mind) is the ideal software. Due to the ubiquitous usage of devtools/pkgbuild among these developers, I think it is important for I should also point out that the approach above of
breaks if Therefore, might a PR to the effect of modifying the prompt from "accept that inst/doc will now be delete" to "decide whether inst/doc will now be deleted" be something that you would consider? |
This setting belongs to the package, so ideally, you would be able to request this behavior in But can't you just put the docs in |
The problem is that if we wish to access the Doxygen doc as a vignette, our HTML redirect (see above) only works for installed packages if the Doxy doc is in a subfolder of
I suppose we could backdoor the Doxygen doc through |
I see. Then maybe a custom field in DESCRIPTION that tells pkgbuild not to delete (some of?) these files, is the best solution. |
If this is something that you (the developers of pkgbuild) would be open to, then it would be my utmost pleasure to submit a PR. Just let me know :) |
I think for sg like pkgbuild, that is often called downstream, it makes sense to have config in DESCRIPTION. @jimhester what do you think? |
I still don't understand this behavior (after reading through this discussion).... probably because I'm just too stuck in my ways. My current (probably soon-to-be-former) process for checking my package before sending it to CRAN was:
Now I'm just nervous about everything. I can't run Am I just living in the past and there's a better way to develop packages now? "inst/doc" is still the canonical home for vignettes on CRAN, correct? ie...CRAN doesn't rebuild the vignettes, or has that changed? I'm basing my understanding on: |
The devel version of R (as of 2019/02/11) wants to delete the inst/doc directory when building, in preparation for putting vignettes there. This breaks the Qhull docs, which are in inst/doc. To work around this, the qhull docs need to be moved to vignettes/qhull, and included using vignettes/.install_extras. Various links need to be changed too. See r-lib/pkgbuild#58 for explanation of the behaviour.
I would just use use |
I know this is an old thread but inst/doc seems to be required to build vignettes. Having vignettes in vignettes does not build vignettes as required. Is there a workaround? |
I arrived here due to a similar issue. Basically, when I develop a package for a client, I sometimes have several very big vignettes with expensive computations that I want to build once and keep both the static HTML/PDF and the Rmd. FYI, I found a nice solution. I put those Rmds under TL;DR: $ ls -1 vignettes/
test.html
test.html.asis
test.Rmd
$ cat test.html.asis
%\VignetteIndexEntry{Test vignette title}
%\VignetteEngine{R.rsp::asis}
%\VignetteEncoding{UTF-8} And add |
Modulo some LaTeX re-running warnings, devtools::build_vignettes() is able to construct vignettes with \VignetteEngine{knitr::rmarkdown}. Yet devtools::check() returns vignettes building errors. This does not appear to me to be a building error in the sense of <R CMD build>, but a <R CMD check> error. A wild guess I can attempt is that the check fails because the former builds from 'vignettes/', whereas the latter rebuilds from another (copied) directory (e.g. 'inst/doc/') and is then unable to find parsers' paths. Nonetheless, \VignetteEngine{rmarkdown::render} is maybe only a workaround and check results report a WARNING of the form: "Files named as vignettes but with no recognized vignette engine: ‘vignettes/*.Rmd’ (Is a VignetteBuilder field missing?) Files named as vignettes but with no recognized vignette engine: ‘vignettes/*.Rmd’" The topics is being discussed right at r-lib/pkgbuild#58. From Writing R Extensions: "When R CMD build builds the vignettes, it copies these and the vignette sources from directory vignettes to inst/doc. To install any other files from the vignettes directory, include a file vignettes/.install_extras which specifies these as Perl-like regular expressions on one or more lines. (See the description of the .Rinstignore file for full details.)" (https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Writing-package-vignettes). Please note this however doesn't directly apply to our problem, as vignettes root.dir is at package root dir. We may be able to better manage the process via '.install_extras'. A related problem arising during checks is as follows. knitr, among other things, produces *.pdf and separates *.R "runnable" scripts from vignettes. As mentioned in 57f28ce, the "HML Devil" parser introduced by a98c0f8 is a potential source of problems. The file shares its name with the vignette, but to my knowledge this is also knitr's default behaviour when extracting runnable code, so what is going on would be that in the check process the file gets overwritten and hence never executes the parser. It should be why knitr is then understandably unable to find objects and as a consequence errors out. In order to show the effects of the attempted fix I'm momentarily copying @JustinMShea and @erolbicero's parser to inst/parsers/, where all the other parsers are. Please note, I am not 100% sure this is the ideal solution, but with the present commit the check is satisfied as opposed to clogged by apparently exotic "building" errors. In particular, it only produces 1 WARNING to my knowledge. Our current Travis config will fail builds WARNINGs, but at the same time '--no-build-vignettes' options are passed, so the vignette building WARNING is hidden to Travis and hence both local and Travis builds&checks should succeed.
This behavior affects the package developer's source directory and is unavoidable when
build(vignettes = TRUE)
. I am curious as to whether this step is necessary, or merely to avoid putting unnecessary things in the the resulting tarball.If it is the latter, would you consider making (or allowing me via PR to make) it optional? The (longish) reason for the request follows below.
If
inst/doc
is forcibly deleted, this essentially precludes the possibility of including other (non-vignette) documentation ininst/doc
via any other mechanism thanvignettes/.install_extras
. This particularly concerns a package I am developing (with @nevrome) which manages the Doxygen documentation for a developers C++ code.Doxygen creates HTML documentation with subdirectories to which the entry point is a main file
Doxygen/index.html
. Unfortunately.install_extras
does not preserve folder structure, so we would be forced to include the Doxygen doc via a non-standard location, e.g.,inst/Doxygen
.This is perhaps merely an aesthetic concern, except we would also like to provide an entry point to the Doxygen documentation via an R vignette. This can easily be achieved from the Rmd file with the HTML "redirect"
However, R forbids any redirects to files stored anywhere other than within
inst/doc
. Given the ubiquitous usage ofdevtools
/pkgbuild
by our intended developer base, I was curious as to whether there is a way around the deletion ofinst/doc
.