Skip to content

Commit

Permalink
use renv::dependencies rather than renv::snapshot to compute dependen…
Browse files Browse the repository at this point in the history
…cies

side-effect: an renv dependency is included when consuming an renv.lock, as
there is no way to distinguish between a code-dependency and
bootstrapping-dependency.

fixes #916
  • Loading branch information
aronatkins committed Jul 18, 2023
1 parent e7a434a commit de01060
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions R/bundlePackageRenv.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ snapshotRenvDependencies <- function(bundleDir,
)
defer(options(old))

renv::snapshot(bundleDir, prompt = FALSE)
# analyze code dependencies ourselves rather than relying on the scan during renv::snapshot, as
# that will add renv to renv.lock as a dependency.
deps <- renv::dependencies(bundleDir)
renv::snapshot(bundleDir, packages = deps$Package, prompt = FALSE)
defer(removeRenv(bundleDir))

parseRenvDependencies(bundleDir, snapshot = TRUE)
Expand Down Expand Up @@ -71,11 +74,6 @@ standardizeRenvPackage <- function(pkg,
biocPackages = NULL,
repos = character(),
bioc) {
# Don't include renv itself
if (identical(pkg$Package, "renv")) {
return(NULL)
}

# Convert renv source to manifest source/repository
# https://github.com/rstudio/renv/blob/0.17.2/R/snapshot.R#L730-L773

Expand Down

0 comments on commit de01060

Please sign in to comment.