I have an R package on github. This R package has C++ dependencies which I include in /src
.
The correct way I would normally do this (outside of R) is create submodules within the github repo, which could link to the correct commits as dependencies.
The problem with doing this in R is that these subdirectories will be interpreted as "empty" and the installation won't work, e.g.
> devtools::install_github("reponame/packagename")
* checking for file 'bambi/DESCRIPTION' ... OK
* preparing 'packagename':
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
...
So, the checking for empty or unneeded directories
causes the errors, because the submodules are interpreted as empty subdirectories. Therefore, it cannot find the necessary dependencies, and I'll run into a fatal error upon build
(1) Yes, one way to solve this is to physically put the dependencies within the R package. That does defeat the purpose of submodules though, which are very useful.
(2) It appears using the following argument works:
devtools::install_git("reponame/packagename", args="--recursive")
The problem with this is, this isn't default behavior. I'm nervous about getting dozens of github issues from users who ran devtools::install_git("reponame/packagename")
and didn't read the fine print in the README
(3) Is there a better way? What is the standard method of releasing R packages as a github repo using submodules?
install_*
functions are meant to be migrated toremotes
. – Valuation.Rbuildignore
file, adding a line like this:^src/your_submodule/*
. – Pt