Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devtools::install(quick = TRUE) recompiles everything when changing the git branch #2519

Closed
stla opened this issue Jun 20, 2023 · 3 comments
Closed

Comments

@stla
Copy link

stla commented Jun 20, 2023

Hello

I have a package with a lot of C++ code. It takes several hours to install it (especially on Windows). So devtools::install(quick = TRUE) is nice, because it recompiles only the files which have changed.

But when I change the git branch and I come back to the previous one, devtools::install(quick = TRUE) recompiles everything. It would be nice if it could "remember" the state of the branch.

@jennybc
Copy link
Member

jennybc commented Nov 2, 2023

The documentation for the purpose of quick doesn't really match the impression you have:

quick | if TRUE skips docs, multiple-architectures, demos, and vignettes, to make installation as fast as possible.

And this is born out by looking at the source for install(). I.e. quick just influences the arguments passed to base R CMD INSTALL.

So this feels like something that is really out of devtools's hands, so to speak.

@jennybc jennybc closed this as completed Nov 2, 2023
@stla
Copy link
Author

stla commented Nov 2, 2023

Hmm... I feel like this doc is incomplete. When the C(++) files have not changed, the option quick=TRUE allows to not recompile these files ("Nothing to be done for all" is printed). That's why I use it.

@jennybc
Copy link
Member

jennybc commented Nov 3, 2023

I suspect there's some indirection / misattribution in what you're experiencing. For example, quick = TRUE implies build = FALSE, by default. Which means that the package doesn't get built prior to installation. The word "built" is confusing, because it's not about, e.g. compiling code, but rather about making a so-called package bundle. And a package bundle does not contain any compliation artefacts that are lying around. So if quick = FALSE, then build = TRUE, and install() will definitely compile your package from scratch, because it will first be bundled (leaving behind any pre-compiled code) then installed.

But devtools has no direct relationship with your compilation artefacts and is not in a position to take the lead on preserving them across git branch changes, for example.

This chapter is a good reference re: the different package states:
https://r-pkgs.org/structure.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants