Skip to content

Commit f239dc9

Browse files
committed
[GR-14363] Switch to the new format of "VM" options: --vm.Dproperty=false.
PullRequest: fastr/1950
2 parents 2abc36d + e54c89c commit f239dc9

File tree

3 files changed

+72
-26
lines changed

3 files changed

+72
-26
lines changed

com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RMain.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ protected List<String> preprocessArguments(List<String> arguments, Map<String, S
135135

136136
List<String> unrecognizedArgs = new ArrayList<>();
137137
for (int i = 0; i < arguments.size(); i++) {
138-
if (!ignoreJvmArguments && "--jvm.help".equals(arguments.get(i))) {
138+
if (!ignoreJvmArguments && ("--jvm.help".equals(arguments.get(i)) || "--vm.help".equals(arguments.get(i)))) {
139139
// This condition should be removed when FastR always ships with native launcher
140140
// that handles this option for us
141141
printJvmHelp();
@@ -378,21 +378,21 @@ public synchronized Throwable fillInStackTrace() {
378378
}
379379

380380
// The following code is copied from org.graalvm.launcher.Launcher and it should be removed
381-
// when the R launcher always ships native version that handles --jvm.help for us.
381+
// when the R launcher always ships native version that handles --vm.help for us.
382382

383383
private static void printJvmHelp() {
384384
System.out.println("JVM options:");
385-
printOption("--jvm.classpath <...>", "A " + File.pathSeparator + " separated list of classpath entries that will be added to the JVM's classpath");
386-
printOption("--jvm.D<name>=<value>", "Set a system property");
387-
printOption("--jvm.esa", "Enable system assertions");
388-
printOption("--jvm.ea[:<packagename>...|:<classname>]", "Enable assertions with specified granularity");
389-
printOption("--jvm.agentlib:<libname>[=<options>]", "Load native agent library <libname>");
390-
printOption("--jvm.agentpath:<pathname>[=<options>]", "Load native agent library by full pathname");
391-
printOption("--jvm.javaagent:<jarpath>[=<options>]", "Load Java programming language agent");
392-
printOption("--jvm.Xbootclasspath/a:<...>", "A " + File.pathSeparator + " separated list of classpath entries that will be added to the JVM's boot classpath");
393-
printOption("--jvm.Xmx<size>", "Set maximum Java heap size");
394-
printOption("--jvm.Xms<size>", "Set initial Java heap size");
395-
printOption("--jvm.Xss<size>", "Set java thread stack size");
385+
printOption("--vm.classpath <...>", "A " + File.pathSeparator + " separated list of classpath entries that will be added to the JVM's classpath");
386+
printOption("--vm.D<name>=<value>", "Set a system property");
387+
printOption("--vm.esa", "Enable system assertions");
388+
printOption("--vm.ea[:<packagename>...|:<classname>]", "Enable assertions with specified granularity");
389+
printOption("--vm.agentlib:<libname>[=<options>]", "Load native agent library <libname>");
390+
printOption("--vm.agentpath:<pathname>[=<options>]", "Load native agent library by full pathname");
391+
printOption("--vm.javaagent:<jarpath>[=<options>]", "Load Java programming language agent");
392+
printOption("--vm.Xbootclasspath/a:<...>", "A " + File.pathSeparator + " separated list of classpath entries that will be added to the JVM's boot classpath");
393+
printOption("--vm.Xmx<size>", "Set maximum Java heap size");
394+
printOption("--vm.Xms<size>", "Set initial Java heap size");
395+
printOption("--vm.Xss<size>", "Set java thread stack size");
396396
}
397397

398398
private static void printOption(String option, String description, int indentation) {

com.oracle.truffle.r.release/src/R_legacy

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ for o in "$@"; do
5858
# TODO This condition should be removed when the Launcher handles --jvm.help correctly.
5959
launcher_args+=("$o")
6060
elif [[ "$o" == --jvm.* ]]; then
61+
>&2 echo "'--jvm.*' options are deprecated, use '--vm.*' instead."
6162
jvm_arg="${o#--jvm.}"
62-
6363
if [[ "$jvm_arg" == "cp" ]]; then
64-
>&2 echo "--jvm.cp argument must be of the form --jvm.cp=<classpath>, not two separate arguments"
64+
>&2 echo "'--jvm.cp' argument must be of the form '--jvm.cp=<classpath>', not two separate arguments"
6565
exit 1
6666
fi
6767
if [[ "$jvm_arg" == "classpath" ]]; then
68-
>&2 echo "--jvm.classpath argument must be of the form --jvm.classpath=<classpath>, not two separate arguments"
68+
>&2 echo "'--jvm.classpath' argument must be of the form '--jvm.classpath=<classpath>', not two separate arguments"
6969
exit 1
7070
fi
7171
if [[ "$jvm_arg" == "cp="* ]]; then
@@ -81,6 +81,29 @@ for o in "$@"; do
8181
absolute_cp+=("${e}")
8282
done
8383
fi
84+
elif [[ "$o" == --vm.* ]]; then
85+
vm_arg=("${o#--vm.}")
86+
if [[ "$vm_arg" == "cp" ]]; then
87+
>&2 echo "'--vm.cp' argument must be of the form '--vm.cp=<classpath>', not two separate arguments"
88+
exit 1
89+
fi
90+
if [[ "$vm_arg" == "classpath" ]]; then
91+
>&2 echo "'--vm.classpath' argument must be of the form '--vm.classpath=<classpath>', not two separate arguments"
92+
exit 1
93+
fi
94+
if [[ "$vm_arg" == "cp="* ]]; then
95+
custom_cp=${vm_arg#cp=}
96+
elif [[ "$vm_arg" == "classpath="* ]]; then
97+
custom_cp=${vm_arg#classpath=}
98+
fi
99+
if [[ -z "${custom_cp+x}" ]]; then
100+
jvm_args+=("-${vm_arg}")
101+
else
102+
IFS=: read -ra custom_cp_a <<< "${custom_cp}"
103+
for e in "${custom_cp_a[@]}"; do
104+
absolute_cp+=("${e}")
105+
done
106+
fi
84107
else
85108
launcher_args+=("$o")
86109
fi

com.oracle.truffle.r.release/src/Rscript_legacy

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727

2828
source="${BASH_SOURCE[0]}"
2929
while [ -h "$source" ] ; do
30-
prev_source="$source"
31-
source="$(readlink "$source")";
32-
if [[ "$source" != /* ]]; then
33-
# if the link was relative, it was relative to where it came from
34-
dir="$( cd -P "$( dirname "$prev_source" )" && pwd )"
35-
source="$dir/$source"
36-
fi
30+
prev_source="$source"
31+
source="$(readlink "$source")";
32+
if [[ "$source" != /* ]]; then
33+
# if the link was relative, it was relative to where it came from
34+
dir="$( cd -P "$( dirname "$prev_source" )" && pwd )"
35+
source="$dir/$source"
36+
fi
3737
done
3838
BIN="$( cd -P "$( dirname "$source" )" && pwd )"
3939

@@ -58,14 +58,14 @@ for o in "$@"; do
5858
# TODO This condition should be removed when the Launcher handles --jvm.help correctly.
5959
launcher_args+=("$o")
6060
elif [[ "$o" == --jvm.* ]]; then
61+
>&2 echo "'--jvm.*' options are deprecated, use '--vm.*' instead."
6162
jvm_arg="${o#--jvm.}"
62-
6363
if [[ "$jvm_arg" == "cp" ]]; then
64-
>&2 echo "--jvm.cp argument must be of the form --jvm.cp=<classpath>, not two separate arguments"
64+
>&2 echo "'--jvm.cp' argument must be of the form '--jvm.cp=<classpath>', not two separate arguments"
6565
exit 1
6666
fi
6767
if [[ "$jvm_arg" == "classpath" ]]; then
68-
>&2 echo "--jvm.classpath argument must be of the form --jvm.classpath=<classpath>, not two separate arguments"
68+
>&2 echo "'--jvm.classpath' argument must be of the form '--jvm.classpath=<classpath>', not two separate arguments"
6969
exit 1
7070
fi
7171
if [[ "$jvm_arg" == "cp="* ]]; then
@@ -81,6 +81,29 @@ for o in "$@"; do
8181
absolute_cp+=("${e}")
8282
done
8383
fi
84+
elif [[ "$o" == --vm.* ]]; then
85+
vm_arg=("${o#--vm.}")
86+
if [[ "$vm_arg" == "cp" ]]; then
87+
>&2 echo "'--vm.cp' argument must be of the form '--vm.cp=<classpath>', not two separate arguments"
88+
exit 1
89+
fi
90+
if [[ "$vm_arg" == "classpath" ]]; then
91+
>&2 echo "'--vm.classpath' argument must be of the form '--vm.classpath=<classpath>', not two separate arguments"
92+
exit 1
93+
fi
94+
if [[ "$vm_arg" == "cp="* ]]; then
95+
custom_cp=${vm_arg#cp=}
96+
elif [[ "$vm_arg" == "classpath="* ]]; then
97+
custom_cp=${vm_arg#classpath=}
98+
fi
99+
if [[ -z "${custom_cp+x}" ]]; then
100+
jvm_args+=("-${vm_arg}")
101+
else
102+
IFS=: read -ra custom_cp_a <<< "${custom_cp}"
103+
for e in "${custom_cp_a[@]}"; do
104+
absolute_cp+=("${e}")
105+
done
106+
fi
84107
else
85108
launcher_args+=("$o")
86109
fi

0 commit comments

Comments
 (0)