Skip to content
Snippets Groups Projects
Commit 5a80b3b0 authored by Zbyněk Šlajchrt's avatar Zbyněk Šlajchrt
Browse files

[GR-3194] Java options for GraalVM can be specified through graalvm.setup.

parents e6d60f6d 25dca48d
No related branches found
No related tags found
No related merge requests found
......@@ -35,11 +35,16 @@ graalvm.status <- function() {
#' @param port The port at which the GraalVM agent is listening
#' @param rlibs The value of the FastR R_LIBS environmental variable. The default
#' value is calculated as paste0(graalvm.home, "/language/R/library").
#' @param javaOpts a character vector of Java options
#' @examples
#' graalvm.setup("~/work/graalvm-0.21")
#' # Running GraalVM in debug mode
#' graalvm.setup("~/work/graalvm-0.21", javaOpts = c("-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=y"))
#' @export
graalvm.setup <- function(home, host = "localhost", port = 9876, rlibs = paste0(home, "/language/R/library")) {
options(graalvm.home = home, graalvm.host = host, graalvm.port = port, graalvm.rlibs = rlibs)
graalvm.setup <- function(home, host = "localhost", port = 9876, rlibs = paste0(home, "/language/R/library"),
javaOpts = character(0)) {
options(graalvm.home = home, graalvm.host = host, graalvm.port = port, graalvm.rlibs = rlibs,
graalvm.javaOpts = paste(sapply(javaOpts, function(opt) { paste0("-J'", opt, "'") }), collapse = " "))
}
commandURL <- function(cmd) {
......@@ -70,8 +75,9 @@ graalvm.start <- function() {
gHost <- getOption("graalvm.host");
gPort <- getOption("graalvm.port");
javaOpts <- getOption("graalvm.javaOpts");
nodeLaunchCmd <- paste0(libEnvVar, " ", gHome, "/bin/node ", serverScriptPath, " ", gHost, " ", gPort, " &")
nodeLaunchCmd <- paste0(libEnvVar, " ", gHome, "/bin/node ", javaOpts, " ", serverScriptPath, " ", gHost, " ", gPort, " &")
system(nodeLaunchCmd, ignore.stdout = TRUE, ignore.stderr = TRUE)
attempts <- 0L
......
......@@ -37,7 +37,7 @@ g.r("a1")
g.js("a2")
g.rb("$a3")
g(a1 = FALSE)
g(a1 <- FALSE)
gget(a1)
a1
......
......@@ -5,7 +5,7 @@
\title{Set up the GraalVM agent}
\usage{
graalvm.setup(home, host = "localhost", port = 9876, rlibs = paste0(home,
"/language/R/library"))
"/language/R/library"), javaOpts = character(0))
}
\arguments{
\item{home}{The home folder of the GraalVM installation}
......@@ -16,10 +16,14 @@ graalvm.setup(home, host = "localhost", port = 9876, rlibs = paste0(home,
\item{rlibs}{The value of the FastR R_LIBS environmental variable. The default
value is calculated as paste0(graalvm.home, "/language/R/library").}
\item{javaOpts}{a character vector of Java options}
}
\description{
Set up the GraalVM agent
}
\examples{
graalvm.setup("~/work/graalvm-0.21")
# Running GraalVM in debug mode
graalvm.setup("~/work/graalvm-0.21", javaOpts = c("-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=y"))
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment