Skip to content

Commit 19d7ef1

Browse files
committed
Add -X fallthrough for shortening property sets of the form -J-Djruby.prop.erty=value to -Xprop.erty=value.
1 parent da7387d commit 19d7ef1

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

argparser.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ Options:\n\
3737
-Xnobootclasspath don't put jruby jars on the bootclasspath\n\
3838
\nMisc:\n\
3939
-Xtrace <path> path for launcher log (for troubleshooting)\n\
40-
-Xcommand just print the equivalent java command and exit\n"
40+
-Xcommand just print the equivalent java command and exit\n\
41+
-Xprop.erty[=value] equivalent to -J-Djruby.<prop.erty>[=value]\n\
42+
see --properties for a list (omit \"jruby.\" with -X\n"
4143
#ifdef WIN32
4244
" -Xconsole <mode> jrubyw console attach mode (new|attach|suppress)\n\n"
4345
#endif
@@ -316,6 +318,12 @@ bool ArgParser::parseArgs(int argc, char *argv[]) {
316318
} else if (strcmp(it->c_str(), "-Xversion") == 0) {
317319
printToConsole("JRuby Launcher Version " JRUBY_LAUNCHER_VERSION "\n");
318320
return false;
321+
} else if (it->compare(0, 2, "-X", 2) == 0 && islower(it->c_str()[2])) {
322+
// Any other /-X([a-z].*)/ get turned into a -Djruby.\1 property
323+
std::string propPart = it->substr(2);
324+
std::string propSet = std::string("-Djruby.");
325+
propSet += propPart;
326+
javaOptions.push_back(propSet);
319327
} else {
320328
progArgs.push_back(*it);
321329
}

spec/launcher_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@
6060
jruby_launcher_args("-J-Darg1=value1 -J-Darg2=value2").should include("-Darg1=value1", "-Darg2=value2")
6161
end
6262

63+
it "should pass -Xprop.erty=value as -J-Djruby.prop.erty=value" do
64+
jruby_launcher_args("-Xprop.erty=value").should include("-Djruby.prop.erty=value")
65+
end
66+
6367
it "should default to 500m max heap" do
6468
jruby_launcher_args("").should include("-Xmx500m", "-Djruby.memory.max=500m")
6569
end

0 commit comments

Comments
 (0)