Skip to main content

Build the Julia library

Source: R/library.R

Description

Compiles the Julia code of every installed package that uses jlbind into one shared library, stored in tools::R_user_dir("jlbind", "data"). Run this after you install or update one of those packages. You need Julia 1.13 or later. The first build downloads and compiles the Julia dependencies, which can take a few minutes.

Usage

install_library(
  packages = NULL,
  julia = NULL,
  ask = interactive(),
  force = FALSE,
  versions = c("manifest", "compat"),
  develop = NULL
)

Arguments

packages Names of the installed packages to build. By default, every package listed by jlbind_clients(). The others aren’t bound.
julia Path to the julia executable. By default, the JULIA environment variable, or julia on the PATH.
ask If TRUE, ask before building. Defaults to interactive().
force If TRUE, rebuild even if the library is up to date. Always on with versions = "compat" or develop.
versions Where the Julia dependency versions come from. "manifest" keeps the versions in the first package’s Manifest.toml where the other packages’ [compat] bounds allow. "compat" ignores the manifests and lets Julia’s resolver choose versions from the [compat] bounds alone.
develop Paths to local Julia packages to use instead of their released versions.

Details

All packages share one Julia environment. By default, the dependencies get the versions in the first package’s Manifest.toml. If two packages conflict, the one listed later by jlbind_clients() is left out, and check_bound() says why. See vignette("using-clients", "jlbind") for details.

The library is rebuilt only if it is out of date: built from other versions of the packages or other Julia code in them, by another version of jlbind or Julia, or with develop. If a library is already loaded, restart R to use the new one.

Value

The path to the library (invisibly), or NULL if there was nothing to build.

Examples

install_library()

# With a local checkout of a Julia dependency
install_library(develop = "~/dev/SomePackage.jl")

# Only two of the installed packages
install_library(packages = c("pkgA", "pkgB"))