Skip to content
Snippets Groups Projects
Commit 48e2169c authored by Tomas Stupka's avatar Tomas Stupka Committed by stepan
Browse files

propagate R arguments like e.g.--jvm through launcher scripts and spawned children processes

parent d44bf299
No related branches found
No related tags found
No related merge requests found
......@@ -69,6 +69,8 @@ rcmds: $(FASTR_BIN_DIR)/R
$(FASTR_BIN_DIR)/R: Makefile R.sh Rscript.sh Rscript_exec.sh Rclasspath.sh
cp -r $(BIN_FILES) $(FASTR_BIN_DIR)
# cp $(FASTR_R_HOME)/com.oracle.truffle.r.native/gnur/patch/bin-patch/* $(FASTR_BIN_DIR)
# overide bin/R
cp R.sh $(FASTR_BIN_DIR)/exec/R
# override bin/Rscript
......@@ -77,8 +79,10 @@ $(FASTR_BIN_DIR)/R: Makefile R.sh Rscript.sh Rscript_exec.sh Rclasspath.sh
# for embedded support
cp Rclasspath.sh $(FASTR_BIN_DIR)/execRextras/Rclasspath
chmod +x $(FASTR_BIN_DIR)/exec/R $(FASTR_BIN_DIR)/execRextras/Rscript $(FASTR_BIN_DIR)/Rscript $(FASTR_BIN_DIR)/execRextras/Rclasspath
# update R_HOME_DIR to FastR
(sed -e 's!^\(R_HOME_DIR=\)\(.*\)!\1"$(FASTR_R_HOME)"!' | sed -e 's/ -h.--help./ --r-help\)/') < $(R_SCRIPT) > $(FASTR_BIN_DIR)/R
# update R_HOME_DIR to FastR, --help to -r-help because --help is handled by FastR, and pass args to Rcmd (esp. --jvm)
(sed -e 's!^\(R_HOME_DIR=\)\(.*\)!\1"$(FASTR_R_HOME)"!' | \
sed -e 's/ -h.--help./ --r-help\)/' | \
sed -e 's! exec sh "$${R_HOME}/bin/Rcmd" "$${@}" ;;! FASTR_INTERNAL_ARGS="$${FASTR_INTERNAL_ARGS} $${args}" exec sh "$${R_HOME}/bin/Rcmd" "$${@}" ;;!') < $(R_SCRIPT) > $(FASTR_BIN_DIR)/R
chmod +x $(FASTR_BIN_DIR)/R
touch $(FASTR_ETC_DIR)/ldpaths
sed -e "s|\(R_LIBS_USER=.*-'\)\(.*\)'}|\1$(FASTR_R_HOME)/library'}|" < $(GNUR_HOME_BINARY)/etc/Renviron > $(FASTR_ETC_DIR)/Renviron
......
......@@ -46,4 +46,4 @@ else
mx=`which mx`
fi
exec $mx --primary-suite-path $PRIMARY_PATH $MX_R_GLOBAL_ARGS R $MX_R_CMD_ARGS "$@"
exec $mx --primary-suite-path $PRIMARY_PATH $MX_R_GLOBAL_ARGS R $FASTR_INTERNAL_ARGS $MX_R_CMD_ARGS "$@"
......@@ -42,4 +42,4 @@ else
mx=`which mx`
fi
exec $mx --primary-suite-path $PRIMARY_PATH $MX_R_GLOBAL_ARGS Rscript $MX_R_CMD_ARGS "$@"
exec $mx --primary-suite-path $PRIMARY_PATH $MX_R_GLOBAL_ARGS Rscript $FASTR_INTERNAL_ARGS $MX_R_CMD_ARGS "$@"
......@@ -73,6 +73,19 @@ public final class REnvVars implements RContext.ContextState {
// Always read the system file
FileSystem fileSystem = FileSystems.getDefault();
safeReadEnvironFile(fileSystem.getPath(rHome, "etc", "Renviron").toString());
String internalArgs = System.getenv("FASTR_INTERNAL_ARGS");
if (context.getEnv().isHostLookupAllowed()) {
if (internalArgs == null) {
internalArgs = "--jvm";
} else if (!internalArgs.contains("--jvm")) {
internalArgs += " --jvm";
}
}
if (internalArgs != null) {
envVars.put("FASTR_INTERNAL_ARGS", internalArgs);
}
envVars.put("R_DOC_DIR", fileSystem.getPath(rHome, "doc").toString());
envVars.put("R_INCLUDE_DIR", fileSystem.getPath(rHome, "include").toString());
envVars.put("R_SHARE_DIR", fileSystem.getPath(rHome, "share").toString());
......
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