Learn R Programming

rscala (version 3.2.6)

scalaSBT: Run SBT and Deploy JAR Files

Description

This function runs SBT (Scala Build Tool) to package JAR files and then copy them to the appropriate directories of the R package source.

Usage

scalaSBT(args = c("+package", "packageSrc"), copy.to.package = TRUE)

Arguments

args

A character vector giving the arguments to be passed to the SBT command.

copy.to.package

Should the jars be to the appropriate directories of the R package source.

Value

NULL

Details

Starting from the current working directory and moving up the file system hierarchy as needed, this function searches for the directory containing the file 'build.sbt', the SBT build file. It temporarily changes the working directory to this directory. Unless the args argument is overwritten, it then runs sbt +package packageSrc +publishLocal to package the cross-compiled the Scala code, package the source code, and publish the JAR files locally. Finally, it optionally copies the JAR files to the appropriate directories of the R package source. Specifically, source JAR files go into (PKGHOME)/java and binary JAR files go into (PKGHOME)/inst/java/scala-(VERSION), where (PKGHOME) is the package home and (VERSION) is the major Scala version (e.g., 2.12). It is assumed that the package home is a subdirectory of the directory containing the 'build.sbt' file.

Note that SBT may give weird errors about not being able to download needed dependences. The issue is that some OpenJDK builds less than version 10 do not include root certificates. The solution is to either: i. manually install OpenJDK version 10 or greater, or ii. manually install Oracle's version of Java. Both are capable with the rscala package.