Skip to content

Commit

Permalink
Switch to thin launchers, support FastR JVM standalone distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-s committed Jan 23, 2024
1 parent 42db253 commit 1d13d7d
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,12 @@ protected List<String> preprocessArguments(List<String> arguments, Map<String, S
client = options.getClient();

if (options.getClient() == null) {
System.err.printf("RMain: the first argument must be either 'R' or 'Rscript'. Given arguments: %s\n.", String.join(",", arguments.toArray(new String[0])));
System.err.println("If you did not run RMain class explicitly, then this is a bug in launcher script, please report it at http://github.com/oracle/fastr.");
System.err.printf("RMain: the first argument must be either 'R' or 'Rscript'. Given arguments: %s\n.",
String.join(",", arguments.toArray(new String[0])));
System.err.println("The RMain launcher is internal and should not be executed directly.");
System.err.println("If you did not run the RMain launcher or Java class explicitly, then this is a bug in " +
"a launcher script or some other component that should delegate to it, " +
"please report it at http://github.com/oracle/fastr.");
if (launcherMode) {
System.exit(1);
}
Expand Down
8 changes: 5 additions & 3 deletions com.oracle.truffle.r.release/src/R_launcher
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
# Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand All @@ -22,8 +22,10 @@
# questions.
#

# This script is deployed under {GRAALVM_HOME}/languages/R/bin/exec/R
# It forwards to the RMain launcher, which is a regular Graal SDK launcher
# This script is deployed under {GRAALVM_HOME}/languages/R/bin/exec/R in legacy
# GraalVM layout, or under {FASTR_HOME}/bin/exec/R in FastR JVM standalone.
#
# It forwards to the RMain launcher, which is a regular Graal SDK thin launcher

source="${BASH_SOURCE[0]}"
while [ -h "$source" ] ; do
Expand Down
9 changes: 6 additions & 3 deletions com.oracle.truffle.r.release/src/Rscript_launcher
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
# Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand All @@ -22,8 +22,11 @@
# questions.
#

# This script is deployed under {GRAALVM_HOME}/languages/R/bin/Rscript
# It forwards to the RMain launcher, which is a regular Graal SDK launcher
# This script is deployed under {GRAALVM_HOME}/languages/R/bin/Rscript in
# legacy GraalVM layout, or under {FASTR_HOME}/bin/Rscript in FastR JVM
# standalone.
#
# It forwards to the RMain launcher, which is a regular Graal SDK thin launcher

source="${BASH_SOURCE[0]}"
while [ -h "$source" ] ; do
Expand Down
30 changes: 11 additions & 19 deletions mx.fastr/mx_fastr_dists.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,24 +178,13 @@ def mx_register_dynamic_suite_constituents(register_project, register_distributi
"bin/exec/R",
],
},
{
"source_type": "extracted-dependency",
"dependency": "FASTR_GRAALVM_RELEASE",
"path": "bin/fastr_jars/fastr*.jar",
},
{
"source_type": "extracted-dependency",
"dependency": "FASTR_GRAALVM_RELEASE",
"path": "bin/fastr_jars/batik-all*.jar",
},
"dependency:fastr:FASTR_LAUNCHER",
],
"LICENSE_FASTR" : "file:LICENSE",
"3rd_party_licenses_fastr.txt" : "file:3rd_party_licenses.txt",
"README_FASTR": "extracted-dependency:fastr:FASTR_GRAALVM_RELEASE/README.md",
"bin/Rscript": "file:com.oracle.truffle.r.release/src/Rscript_launcher",
"bin/exec/R": "file:com.oracle.truffle.r.release/src/R_launcher",
"native-image.properties": "file:mx.fastr/native-image.properties",
# TODO: move to fastr.jar: "native-image.properties": "file:mx.fastr/native-image.properties",
},
path=None,
platformDependent=True,
Expand All @@ -211,22 +200,25 @@ def mx_register_dynamic_suite_constituents(register_project, register_distributi
license_files=['LICENSE_FASTR'],
third_party_license_files=['3rd_party_licenses_fastr.txt'],
dependencies=['Truffle', 'LLVM Runtime Native', 'LLVM.org toolchain', 'XZ'],
truffle_jars=['fastr:FASTR_COMMON', 'fastr:FASTR'],
truffle_jars=['fastr:FASTR_COMMON', 'fastr:FASTR', 'fastr:BATIK-ALL-1.14'],
support_distributions=['fastr:FASTR_GRAALVM_SUPPORT'],
provided_executables=[
'bin/Rscript',
'bin/R',
],
launcher_configs=[
mx_sdk.LanguageLauncherConfig(
destination='bin/RMain',
standalone_dependencies={
'LLVM Runtime Core': ('lib/sulong', []),
'LLVM Runtime Native': ('lib/sulong', []),
'LLVM.org toolchain': ('lib/llvm-toolchain', []),
},
library_configs=[
mx_sdk.LanguageLibraryConfig(
launchers=['bin/<exe:RMain>'],
jar_distributions=['fastr:FASTR_LAUNCHER'],
main_class='com.oracle.truffle.r.launcher.RMain',
build_args=[],
language='R',
is_main_launcher=False,
default_symlinks=False,
)
),
],
stability="experimental",
post_install_msg="NOTES:\n---------------\n" +
Expand Down
2 changes: 1 addition & 1 deletion mx.fastr/native-image.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file contains native-image arguments needed to fastr
#
# TODO: move this into the fastr.jar

Requires = language:nfi language:llvm language:antlr4 language:xz

Expand Down
3 changes: 3 additions & 0 deletions mx.fastr/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,9 @@
"FASTR_LAUNCHER" : {
"moduleInfo" : {
"name" : "org.graalvm.r.launcher",
"exports" : [
"com.oracle.truffle.r.launcher to org.graalvm.launcher"
]
},
"useModulePath": True,
"description" : "launcher for the GraalVM (at the moment used only when native image is installed)",
Expand Down

0 comments on commit 1d13d7d

Please sign in to comment.