build_deps: Find Build-Time Package Dependencies

Description Usage Arguments Details Value

Description

Most R package dependencies are run-time dependencies: functions within a package refer to functions or other objects within another package. These references are resolved at runtime, and for evaluating the code of a package (i.e. installing it), the dependencies are not actually needed. This package tries to work out the build-time and run-time dependencies of a package, by trying to evaluate the package code both without and with each dependency.

Usage

1
build_deps(path = ".")

Arguments

path

Path to the package root.

Details

The current algorithms is this:

  1. If a dependency is linked to (i.e. its type is LinkingTo), this is a build-time dependency, and we install it.

  2. We try to evaluate the package code with only the LinkingTo dependencies available. This should already run without errors for most packages, and if it indeed does, then there are no additional build dependencies.

  3. Otherwise we install all dependencies and check that the package installs with them. If it does not then it is not possible to work out the build dependencies, so we give up here.

  4. Otherwise, we try the dependencies one by one. We remove it, and try to install the package without it. If it installs, then it is not a build dependency. If it does not install, then it is a build dependency.

It is important that in step 4., the packages are considered in an appropriate order. E.g. if pkg -> A -> B and also pkg -> B holds, then we cannot try to omit package B first, because even if it is not a build dependency, it is needed for package A, so the installation of pkg will fail. So we create the dependency graph of all recursive dependencies of the package, and try omitting the (directly dependent) packages according to the topological ordering.

E.g. for the example above, we test package A first. (Assuming there are no other direct dependencies depending on A, directly or indirectly.)

Value

Character vector, the names of the packages that are build dependencies.


r-hub/builddeps documentation built on May 26, 2019, 2:32 p.m.