jruby-launcher 2.0.0.pr1-java → 2.0.0.pre2-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Makefile +1 -19
- data/Rakefile +1 -1
- data/exe/jruby.sh +964 -0
- data/lib/jruby-launcher.rb +1 -1
- data/spec/launcher_spec.rb +1 -1
- data/unixlauncher.c +0 -1
- data/version.h +1 -1
- metadata +3 -3
- data/lib/rubygems/defaults/jruby_native.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 297592e7324c369c06ff548ab5531631965e16f4ee3c04da498e145be259298e
|
4
|
+
data.tar.gz: 7301d02d2c0d4aaa8984e4a03ab049cb68a7ffea4f1b66c6c6f0e6f813ae91e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1dd776996f59ec4d9fb6cfc150b85d4e0689791ded13e218fe40b74b49300ecdd4caec0e0a6876ecf276a46c6d1ffd970eb98a46152b1707fb79b0b8d139734
|
7
|
+
data.tar.gz: 153c9f77f4042930b91fdd7703aeee9b2574deb8aa5f35e6f93feaf00f7a4e1b4762b31c34b5ba6e33b63afe57dfc6ad54c678e8c1a1d77724c0c17d13704196
|
data/Makefile
CHANGED
@@ -3,9 +3,6 @@ PREFIX = notspecified
|
|
3
3
|
BINDIR = $(PREFIX)/bin
|
4
4
|
JRUBY_VERSION = notspecified
|
5
5
|
JRUBY_MODULE = 1
|
6
|
-
INSTALLDIR = $(PREFIX)/lib/ruby/shared/rubygems/defaults
|
7
|
-
INSTALLDIR9000 = $(PREFIX)/lib/ruby/stdlib/rubygems/defaults
|
8
|
-
OLDINSTALLDIR = $(PREFIX)/lib/ruby/site_ruby/1.8/rubygems/defaults
|
9
6
|
|
10
7
|
ifeq (true,$(shell test -x $(BINDIR)/jruby && echo true))
|
11
8
|
RAKE=$(BINDIR)/jruby -S rake
|
@@ -42,22 +39,7 @@ install:
|
|
42
39
|
@if [ -f $(BINDIR)/jruby -a ! -w $(BINDIR)/jruby ]; then echo "Cannot write to '$(BINDIR)/jruby'."; exit 1; fi
|
43
40
|
cp ./jruby $(BINDIR)/jruby
|
44
41
|
@if [ x$(PREFIX) = xnotspecified ]; then echo "Please define where to install by passing PREFIX=<jruby-home>."; exit 1; fi
|
45
|
-
@if [ ! -
|
46
|
-
if [ ! -w $(OLDINSTALLDIR) ]; then \
|
47
|
-
if [ ! -w $(INSTALLDIR9000) ]; then \
|
48
|
-
echo "Neither '$(INSTALLDIR9000)' nor '$(INSTALLDIR)' nor '$(OLDINSTALLDIR)' exist and are writable"; exit 1; \
|
49
|
-
else \
|
50
|
-
echo "cp ./lib/rubygems/defaults/jruby_native.rb $(INSTALLDIR9000)"; \
|
51
|
-
cp ./lib/rubygems/defaults/jruby_native.rb $(INSTALLDIR9000); \
|
52
|
-
fi; \
|
53
|
-
else \
|
54
|
-
echo "cp ./lib/rubygems/defaults/jruby_native.rb $(OLDINSTALLDIR)"; \
|
55
|
-
cp ./lib/rubygems/defaults/jruby_native.rb $(OLDINSTALLDIR); \
|
56
|
-
fi; \
|
57
|
-
else \
|
58
|
-
echo "cp ./lib/rubygems/defaults/jruby_native.rb $(INSTALLDIR)"; \
|
59
|
-
cp ./lib/rubygems/defaults/jruby_native.rb $(INSTALLDIR); \
|
60
|
-
fi;
|
42
|
+
@if [ ! -f $(BINDIR)/jruby.sh ]; then cp ./exe/jruby.sh $(BINDIR)/jruby.sh; fi
|
61
43
|
|
62
44
|
test:
|
63
45
|
$(RAKE)
|
data/Rakefile
CHANGED
@@ -26,7 +26,7 @@ task :gemspec => './lib/jruby-launcher.rb' do
|
|
26
26
|
s.summary = %q{Native launcher for JRuby}
|
27
27
|
s.email = ["nick@nicksieger.com", "vsizikov@gmail.com"]
|
28
28
|
s.extensions = ["extconf.rb"]
|
29
|
-
s.files = FileList["COPYING", "README.md", "Makefile", "Rakefile", "*.c", "*.cpp", "*.h", "inc/*.*", "**/*.rb", "resources/*.*"]
|
29
|
+
s.files = FileList["COPYING", "README.md", "Makefile", "Rakefile", "*.c", "*.cpp", "*.h", "inc/*.*", "**/*.rb", "resources/*.*", "exe/jruby.sh"]
|
30
30
|
s.homepage = %q{http://jruby.org}
|
31
31
|
end
|
32
32
|
end
|
data/exe/jruby.sh
ADDED
@@ -0,0 +1,964 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
# shellcheck shell=dash # local variable support
|
3
|
+
# shellcheck disable=1007 # spurious warnings when initializing multiple vars
|
4
|
+
|
5
|
+
# -----------------------------------------------------------------------------
|
6
|
+
# jruby.sh - Start Script for the JRuby interpreter
|
7
|
+
#
|
8
|
+
# This script handles all Ruby and JRuby command-line arguments, detects the
|
9
|
+
# location of the `java` command and JRuby standard library, and launches JRuby
|
10
|
+
# using appropriate flags and configuration. A few flags provide additional
|
11
|
+
# information:
|
12
|
+
#
|
13
|
+
# * `jruby --help` for standard options, most based on Ruby flags.
|
14
|
+
# * `jruby --properties` to list all JRuby JVM properties for finer-grained
|
15
|
+
# configuration.
|
16
|
+
# * `jruby --environment` to show the `java` command line that will be run and
|
17
|
+
# log output explaining how we got there.
|
18
|
+
#
|
19
|
+
# This script is intended to be compatible with POSIX shell as much as possible
|
20
|
+
# modulo a few small features known to be nonstandard but present in nearly all
|
21
|
+
# POSIX shell implementations. We tell shellcheck to treat this source as dash,
|
22
|
+
# a version of ash that adds those features and which has been the standard
|
23
|
+
# Debian /bin/sh since 2011.
|
24
|
+
#
|
25
|
+
# See https://en.wikipedia.org/wiki/Almquist_shell#Adoption_in_Debian_and_Ubuntu
|
26
|
+
#
|
27
|
+
# There are a number of utility functions defined here to cope with the lack of
|
28
|
+
# arrays in shell. These functions simulate arrays through other mechanism and
|
29
|
+
# ensure we do not damage quoting during argument processing.
|
30
|
+
# -----------------------------------------------------------------------------
|
31
|
+
|
32
|
+
# Enable uninitialized variable warnings
|
33
|
+
set -u
|
34
|
+
|
35
|
+
# ----- Guarantee local variables are available -------------------------------
|
36
|
+
if command -v local >/dev/null; then
|
37
|
+
:
|
38
|
+
elif command -v typeset >/dev/null; then
|
39
|
+
# ksh93 and older have typeset but not local, and expand aliases at parse
|
40
|
+
# time so require re-sourcing the script
|
41
|
+
alias local=typeset
|
42
|
+
if [ -z "${KSH_VERSION-}" ] || (eval : '"${.sh.version}"' >/dev/null 2>&1); then
|
43
|
+
# shellcheck source=/dev/null
|
44
|
+
. "$0"
|
45
|
+
exit
|
46
|
+
fi
|
47
|
+
else
|
48
|
+
echo >&2 "Error: Your shell does not support local variables. Re-run this script with one that does (e.g. bash, ksh)"
|
49
|
+
exit 1
|
50
|
+
fi
|
51
|
+
|
52
|
+
# ----- Helper functions ------------------------------------------------------
|
53
|
+
|
54
|
+
# esceval [ARGUMENT...]
|
55
|
+
#
|
56
|
+
# Escape ARGUMENT for safe use with eval
|
57
|
+
# Returns escaped arguments via $REPLY
|
58
|
+
# Thanks to @mentalisttraceur for original implementation:
|
59
|
+
# https://github.com/mentalisttraceur/esceval
|
60
|
+
esceval()
|
61
|
+
{
|
62
|
+
local escaped= unescaped= output=
|
63
|
+
REPLY=
|
64
|
+
|
65
|
+
[ $# -gt 0 ] || return 0
|
66
|
+
while true; do
|
67
|
+
escaped=\'
|
68
|
+
unescaped=$1
|
69
|
+
while true; do
|
70
|
+
case $unescaped in
|
71
|
+
(*\'*)
|
72
|
+
escaped="$escaped${unescaped%%\'*}'\''"
|
73
|
+
unescaped=${unescaped#*\'}
|
74
|
+
;;
|
75
|
+
(*) break ;;
|
76
|
+
esac
|
77
|
+
done
|
78
|
+
escaped=$escaped$unescaped\'
|
79
|
+
shift
|
80
|
+
[ $# -gt 0 ] || break
|
81
|
+
output="$output $escaped"
|
82
|
+
done
|
83
|
+
REPLY="$output $escaped"
|
84
|
+
}
|
85
|
+
|
86
|
+
# assign LISTNAME ELEMENT [ELEMENT...]
|
87
|
+
#
|
88
|
+
# Assign ELEMENT to the list named by LISTNAME.
|
89
|
+
assign() {
|
90
|
+
local listname="$1"
|
91
|
+
local REPLY=
|
92
|
+
shift
|
93
|
+
|
94
|
+
esceval "$@"
|
95
|
+
eval "$listname=\"\${REPLY}\""
|
96
|
+
}
|
97
|
+
|
98
|
+
# append LISTNAME ELEMENT [ELEMENT...]
|
99
|
+
#
|
100
|
+
# Append ELEMENT to the list named by LISTNAME.
|
101
|
+
append() {
|
102
|
+
local listname="$1"
|
103
|
+
local REPLY=
|
104
|
+
shift
|
105
|
+
|
106
|
+
esceval "$@"
|
107
|
+
eval "$listname=\"\${$listname} \${REPLY}\""
|
108
|
+
}
|
109
|
+
|
110
|
+
# prepend LISTNAME ELEMENT [ELEMENT...]
|
111
|
+
#
|
112
|
+
# Prepend ELEMENT to the list named by LISTNAME, preserving order.
|
113
|
+
prepend() {
|
114
|
+
local listname="$1"
|
115
|
+
local REPLY=
|
116
|
+
shift
|
117
|
+
|
118
|
+
esceval "$@"
|
119
|
+
eval "$listname=\"\${REPLY} \${$listname}\""
|
120
|
+
}
|
121
|
+
|
122
|
+
# extend LISTNAME1 LISTNAME2
|
123
|
+
#
|
124
|
+
# Append the elements stored in the list named by LISTNAME2
|
125
|
+
# to the list named by LISTNAME1.
|
126
|
+
extend() {
|
127
|
+
eval "$1=\"\${$1} \${$2}\""
|
128
|
+
}
|
129
|
+
|
130
|
+
# preextend LISTNAME1 LISTNAME2
|
131
|
+
#
|
132
|
+
# Prepend the elements stored in the list named by LISTNAME2
|
133
|
+
# to the named by LISTNAME1, preserving order.
|
134
|
+
preextend() {
|
135
|
+
eval "$1=\"\${$2} \${$1}\""
|
136
|
+
}
|
137
|
+
|
138
|
+
# a_isempty
|
139
|
+
#
|
140
|
+
# Return 0 if an array is empty, otherwise return 1
|
141
|
+
a_isempty() {
|
142
|
+
case $ruby_args in
|
143
|
+
(*[![:space:]]*) return 1 ;; # If any nonblank, not empty
|
144
|
+
esac
|
145
|
+
return 0
|
146
|
+
}
|
147
|
+
|
148
|
+
# exists [FILE...]
|
149
|
+
#
|
150
|
+
# Returns 0 if all FILEs exist or none provided, otherwise returns 1
|
151
|
+
exists() {
|
152
|
+
while [ "$#" -gt 0 ]; do
|
153
|
+
[ -e "$1" ] || return
|
154
|
+
shift
|
155
|
+
done
|
156
|
+
|
157
|
+
return 0
|
158
|
+
}
|
159
|
+
|
160
|
+
# is_newer FILE OTHER...
|
161
|
+
#
|
162
|
+
# Returns 0 if FILE is newer than all OTHER files. If FILE doesn't exist,
|
163
|
+
# return error. If OTHER files don't exist, pretend they're older than FILE.
|
164
|
+
is_newer() {
|
165
|
+
local output master
|
166
|
+
master="$1"
|
167
|
+
shift
|
168
|
+
|
169
|
+
# Find any other files that are newer, negate outside find in case any don't exist
|
170
|
+
[ -e "$master" ] && ! find "$@" -newer "$master" 2>/dev/null | read -r _
|
171
|
+
}
|
172
|
+
|
173
|
+
# echo [STRING...]
|
174
|
+
#
|
175
|
+
# Dumb echo, i.e. print arguments joined by spaces with no further processing
|
176
|
+
echo() {
|
177
|
+
printf "%s\n" "$*"
|
178
|
+
}
|
179
|
+
|
180
|
+
# ----- Set variable defaults -------------------------------------------------
|
181
|
+
|
182
|
+
java_class=org.jruby.Main
|
183
|
+
JRUBY_SHELL=/bin/sh
|
184
|
+
|
185
|
+
# Detect cygwin and mingw environments
|
186
|
+
cygwin=false
|
187
|
+
case "$(uname)" in
|
188
|
+
CYGWIN*) cygwin=true ;;
|
189
|
+
MINGW*)
|
190
|
+
release_id=$(awk -F= '$1=="ID" { print $2; }' /etc/os-release 2> /dev/null)
|
191
|
+
case $release_id in
|
192
|
+
"msys2") ;;
|
193
|
+
*)
|
194
|
+
jruby.exe "$@"
|
195
|
+
exit $?
|
196
|
+
;;
|
197
|
+
esac
|
198
|
+
;;
|
199
|
+
esac
|
200
|
+
readonly cygwin
|
201
|
+
|
202
|
+
use_exec=true
|
203
|
+
jdb=false
|
204
|
+
|
205
|
+
NO_BOOTCLASSPATH=false
|
206
|
+
VERIFY_JRUBY=false
|
207
|
+
print_environment_log=false
|
208
|
+
regenerate_jsa_file=false
|
209
|
+
remove_jsa_files=false
|
210
|
+
log_cds=false
|
211
|
+
|
212
|
+
if [ -z "${JRUBY_OPTS-}" ]; then
|
213
|
+
JRUBY_OPTS=""
|
214
|
+
fi
|
215
|
+
|
216
|
+
if [ -z "${JAVA_STACK-}" ]; then
|
217
|
+
JAVA_STACK=-Xss2048k
|
218
|
+
fi
|
219
|
+
|
220
|
+
java_args=""
|
221
|
+
ruby_args=""
|
222
|
+
|
223
|
+
# shellcheck disable=2034 # variable is only read in an eval
|
224
|
+
java_opts_from_files=""
|
225
|
+
# shellcheck disable=2034 # variable is only read in an eval
|
226
|
+
jdb_args=""
|
227
|
+
|
228
|
+
# Force OpenJDK-based JVMs to use /dev/urandom for random number generation
|
229
|
+
# See https://github.com/jruby/jruby/issues/4685 among others.
|
230
|
+
# OpenJDK tries really hard to prevent you from using urandom.
|
231
|
+
# See https://bugs.openjdk.java.net/browse/JDK-6202721
|
232
|
+
# Non-file URL causes fallback to slow threaded SeedGenerator.
|
233
|
+
# See https://bz.apache.org/bugzilla/show_bug.cgi?id=56139
|
234
|
+
if [ -r "/dev/urandom" ]; then
|
235
|
+
JAVA_SECURITY_EGD="file:/dev/urandom"
|
236
|
+
fi
|
237
|
+
|
238
|
+
# Gather environment information as we go
|
239
|
+
readonly cr='
|
240
|
+
'
|
241
|
+
environment_log="JRuby Environment$cr================="
|
242
|
+
add_log() {
|
243
|
+
environment_log="${environment_log}${cr}${*-}"
|
244
|
+
}
|
245
|
+
|
246
|
+
# Logic to process "arguments files" on both Java 8 and Java 9+
|
247
|
+
process_java_opts() {
|
248
|
+
local java_opts_file="$1"
|
249
|
+
if [ -r "$java_opts_file" ]; then
|
250
|
+
add_log
|
251
|
+
add_log "Adding Java options from: $java_opts_file"
|
252
|
+
|
253
|
+
# On Java 9+, add an @argument for the given file.
|
254
|
+
# On earlier versions the file contents will be read and expanded on the Java command line.
|
255
|
+
if $use_modules; then
|
256
|
+
append java_opts_from_files "@$java_opts_file"
|
257
|
+
else
|
258
|
+
local line=
|
259
|
+
while read -r line; do
|
260
|
+
if [ "$line" ]; then
|
261
|
+
# shellcheck disable=2086 # Split options on whitespace
|
262
|
+
append java_opts_from_files $line
|
263
|
+
add_log " $line"
|
264
|
+
fi
|
265
|
+
done < "$java_opts_file"
|
266
|
+
fi
|
267
|
+
fi
|
268
|
+
}
|
269
|
+
|
270
|
+
# Pure shell dirname/basename
|
271
|
+
dir_name() {
|
272
|
+
local filename="$1" trail=
|
273
|
+
case $filename in
|
274
|
+
*/*[!/]*)
|
275
|
+
trail=${filename##*[!/]}
|
276
|
+
filename=${filename%%"$trail"}
|
277
|
+
REPLY=${filename%/*}
|
278
|
+
;;
|
279
|
+
*[!/]*)
|
280
|
+
trail=${filename##*[!/]}
|
281
|
+
REPLY="."
|
282
|
+
;;
|
283
|
+
*)
|
284
|
+
REPLY="/"
|
285
|
+
;;
|
286
|
+
esac
|
287
|
+
}
|
288
|
+
|
289
|
+
base_name() {
|
290
|
+
local filename="$1" trail=
|
291
|
+
case $filename in
|
292
|
+
*/*[!/]*)
|
293
|
+
trail=${filename##*[!/]}
|
294
|
+
filename=${filename%%"$trail"}
|
295
|
+
REPLY=${filename##*/}
|
296
|
+
;;
|
297
|
+
*[!/]*)
|
298
|
+
trail=${filename##*[!/]}
|
299
|
+
REPLY=${filename%%"$trail"}
|
300
|
+
;;
|
301
|
+
*)
|
302
|
+
REPLY="/"
|
303
|
+
;;
|
304
|
+
esac
|
305
|
+
}
|
306
|
+
|
307
|
+
# Determine whether path is absolute and contains no relative segments or symlinks
|
308
|
+
path_is_canonical() {
|
309
|
+
local path=
|
310
|
+
for path; do
|
311
|
+
case $path in
|
312
|
+
([!/]*) return 1 ;;
|
313
|
+
(./*|../*) return 1 ;;
|
314
|
+
(*/.|*/..) return 1 ;;
|
315
|
+
(*/./*|*/../*) return 1 ;;
|
316
|
+
esac
|
317
|
+
while [ "$path" ]; do
|
318
|
+
[ -h "$path" ] && return 1
|
319
|
+
path="${path%/*}"
|
320
|
+
done
|
321
|
+
done
|
322
|
+
return 0
|
323
|
+
}
|
324
|
+
|
325
|
+
# Resolve directory to its canonical value
|
326
|
+
resolve_dir() {
|
327
|
+
# Some shells (dash, ksh) resolve relative paths by default before cd'ing, i.e.
|
328
|
+
# cd /foo/bar/../baz = cd /foo/baz
|
329
|
+
# This is fine unless bar is a symlink, in which case the second form is
|
330
|
+
# invalid. Passing -P to cd fixes this behaviour.
|
331
|
+
REPLY="$(cd -P -- "$1" && pwd)"
|
332
|
+
}
|
333
|
+
|
334
|
+
# Resolve symlink until it's not a symlink
|
335
|
+
resolve_file() {
|
336
|
+
local current="$1" target=
|
337
|
+
|
338
|
+
while [ -h "$current" ]; do
|
339
|
+
target="$(readlink "$current")" || return
|
340
|
+
case $target in
|
341
|
+
(/*) current="$target" ;;
|
342
|
+
# handle relative symlinks
|
343
|
+
(*) dir_name "$current"; current="$REPLY/$target" ;;
|
344
|
+
esac
|
345
|
+
done
|
346
|
+
REPLY="$current"
|
347
|
+
}
|
348
|
+
|
349
|
+
# Resolve path to its canonical value
|
350
|
+
resolve() {
|
351
|
+
local target="$1" base=
|
352
|
+
REPLY=
|
353
|
+
|
354
|
+
# Verify target actually exists (and isn't too deep in symlinks)
|
355
|
+
if ! [ -e "$target" ]; then
|
356
|
+
echo >&2 "Error: No such file or directory: $target"
|
357
|
+
return 1
|
358
|
+
fi
|
359
|
+
|
360
|
+
# Realpath is way faster than repeatedly calling readlink, so use it if possible
|
361
|
+
if command -v realpath >/dev/null; then
|
362
|
+
REPLY="$(realpath "$target")" && return
|
363
|
+
fi
|
364
|
+
|
365
|
+
# Take shortcut for directories
|
366
|
+
if [ -d "$target" ]; then
|
367
|
+
resolve_dir "$target" && return
|
368
|
+
fi
|
369
|
+
|
370
|
+
# Ensure $target is not a symlink
|
371
|
+
resolve_file "$target" || return
|
372
|
+
target="$REPLY"
|
373
|
+
|
374
|
+
# Resolve parent directory if it's not absolute
|
375
|
+
if ! path_is_canonical "$target"; then
|
376
|
+
dir_name "$target"
|
377
|
+
resolve_dir "$REPLY" || return
|
378
|
+
base="$REPLY"
|
379
|
+
|
380
|
+
base_name "$target"
|
381
|
+
target="$base/$REPLY"
|
382
|
+
fi
|
383
|
+
REPLY="$target"
|
384
|
+
}
|
385
|
+
|
386
|
+
# ----- Determine JRUBY_HOME based on this executable's path ------------------
|
387
|
+
|
388
|
+
# get the absolute path of the executable
|
389
|
+
if [ "${BASH-}" ]; then
|
390
|
+
# shellcheck disable=2128,3028
|
391
|
+
script_src="${BASH_SOURCE-}"
|
392
|
+
else
|
393
|
+
script_src="$0"
|
394
|
+
fi
|
395
|
+
dir_name "$script_src"
|
396
|
+
BASE_DIR="$(cd -P -- "$REPLY" >/dev/null && pwd -P)"
|
397
|
+
base_name "$script_src"
|
398
|
+
resolve "$BASE_DIR/$REPLY"
|
399
|
+
SELF_PATH="$REPLY"
|
400
|
+
|
401
|
+
JRUBY_HOME="${SELF_PATH%/*/*}"
|
402
|
+
|
403
|
+
# ----- File paths for various options and files we'll process later ----------
|
404
|
+
|
405
|
+
# Module options to open up packages we need to reflect
|
406
|
+
readonly jruby_module_opts_file="$JRUBY_HOME/bin/.jruby.module_opts"
|
407
|
+
|
408
|
+
# Cascading .java_opts files for localized JVM flags
|
409
|
+
readonly installed_jruby_java_opts_file="$JRUBY_HOME/bin/.jruby.java_opts"
|
410
|
+
if [ -z "${HOME-}" ]; then
|
411
|
+
readonly home_jruby_java_opts_file=""
|
412
|
+
else
|
413
|
+
readonly home_jruby_java_opts_file="$HOME/.jruby.java_opts"
|
414
|
+
fi
|
415
|
+
readonly pwd_jruby_java_opts_file="$PWD/.jruby.java_opts"
|
416
|
+
|
417
|
+
# Options from .dev_mode.java_opts for "--dev" mode, to reduce JRuby startup time
|
418
|
+
readonly dev_mode_opts_file="$JRUBY_HOME/bin/.dev_mode.java_opts"
|
419
|
+
|
420
|
+
# ----- Initialize environment log --------------------------------------------
|
421
|
+
|
422
|
+
add_log
|
423
|
+
add_log "JRuby executable:"
|
424
|
+
add_log " $script_src"
|
425
|
+
add_log "JRuby command line options:"
|
426
|
+
add_log " $*"
|
427
|
+
add_log "Current directory:"
|
428
|
+
add_log " $PWD"
|
429
|
+
|
430
|
+
add_log
|
431
|
+
add_log "Environment:"
|
432
|
+
add_log " JRUBY_HOME: $JRUBY_HOME"
|
433
|
+
add_log " JRUBY_OPTS: $JRUBY_OPTS"
|
434
|
+
add_log " JAVA_OPTS: ${JAVA_OPTS-}"
|
435
|
+
|
436
|
+
# ----- Discover JVM and prep environment to run it ---------------------------
|
437
|
+
|
438
|
+
# Determine where the java command is and ensure we have a good JAVA_HOME
|
439
|
+
if [ -z "${JAVACMD-}" ]; then
|
440
|
+
if [ -z "${JAVA_HOME-}" ]; then
|
441
|
+
readonly java_home_command="/usr/libexec/java_home"
|
442
|
+
if [ -r "$java_home_command" ] \
|
443
|
+
&& [ -x "$java_home_command" ] \
|
444
|
+
&& [ ! -d "$java_home_command" ]
|
445
|
+
then
|
446
|
+
# use java_home command when none is set (on MacOS)
|
447
|
+
JAVA_HOME="$("$java_home_command")" &&
|
448
|
+
JAVACMD="$JAVA_HOME"/bin/java
|
449
|
+
else
|
450
|
+
# Linux and others have a chain of symlinks
|
451
|
+
JAVACMD="$(command -v java)" &&
|
452
|
+
resolve "$JAVACMD" &&
|
453
|
+
JAVACMD="$REPLY"
|
454
|
+
fi
|
455
|
+
elif $cygwin; then
|
456
|
+
JAVACMD="$(cygpath -u "$JAVA_HOME")/bin/java"
|
457
|
+
else
|
458
|
+
resolve "$JAVA_HOME/bin/java" &&
|
459
|
+
JAVACMD="$REPLY"
|
460
|
+
fi
|
461
|
+
else
|
462
|
+
JAVACMD="$(command -v "$JAVACMD")" &&
|
463
|
+
resolve "$JAVACMD" &&
|
464
|
+
JAVACMD="$REPLY"
|
465
|
+
fi || {
|
466
|
+
# Something went wrong when looking for java
|
467
|
+
echo >&2 "${0##*/}: Error: Java executable not found!"
|
468
|
+
exit 2
|
469
|
+
}
|
470
|
+
|
471
|
+
# export separately from command execution
|
472
|
+
dir_name "$JAVACMD"
|
473
|
+
dir_name "$REPLY"
|
474
|
+
JAVA_HOME="$REPLY"
|
475
|
+
|
476
|
+
# Detect modularized Java
|
477
|
+
java_is_modular() {
|
478
|
+
# check that modules file is present
|
479
|
+
if [ -f "$JAVA_HOME"/lib/modules ]; then
|
480
|
+
return 0
|
481
|
+
fi
|
482
|
+
|
483
|
+
# check if a MODULES line appears in release
|
484
|
+
if [ -f "$JAVA_HOME"/release ] && grep -q ^MODULES "$JAVA_HOME"/release; then
|
485
|
+
return 0
|
486
|
+
fi
|
487
|
+
|
488
|
+
return 1
|
489
|
+
}
|
490
|
+
|
491
|
+
if java_is_modular; then
|
492
|
+
use_modules=true
|
493
|
+
else
|
494
|
+
use_modules=false
|
495
|
+
fi
|
496
|
+
readonly use_modules
|
497
|
+
|
498
|
+
add_log " JAVACMD: $JAVACMD"
|
499
|
+
add_log " JAVA_HOME: $JAVA_HOME"
|
500
|
+
|
501
|
+
if $use_modules; then
|
502
|
+
add_log
|
503
|
+
add_log "Detected Java modules at $JAVA_HOME"
|
504
|
+
fi
|
505
|
+
|
506
|
+
# ----- Detect Java version and determine available features ------------------
|
507
|
+
# shellcheck source=/dev/null
|
508
|
+
java_version=$(. "$JAVA_HOME/release" && echo "${JAVA_VERSION-}")
|
509
|
+
add_log "Detected Java version: $java_version"
|
510
|
+
|
511
|
+
# Split version out for integer comparisons
|
512
|
+
java_major=${java_version%%.*}
|
513
|
+
|
514
|
+
# AppCDS support
|
515
|
+
if [ "$java_major" -ge 13 ] && exists "$JAVA_HOME"/lib/server/*.jsa; then
|
516
|
+
java_has_appcds=true
|
517
|
+
else
|
518
|
+
java_has_appcds=false
|
519
|
+
fi
|
520
|
+
readonly java_has_appcds
|
521
|
+
|
522
|
+
# Default to using AppCDS if available
|
523
|
+
use_jsa_file="$java_has_appcds"
|
524
|
+
|
525
|
+
# AppCDS autogeneration
|
526
|
+
if [ "$java_major" -ge 19 ]; then
|
527
|
+
java_has_appcds_autogenerate=true
|
528
|
+
else
|
529
|
+
java_has_appcds_autogenerate=false
|
530
|
+
fi
|
531
|
+
readonly java_has_appcds_autogenerate
|
532
|
+
|
533
|
+
# Native access
|
534
|
+
if [ "$java_major" -ge 22 ]; then
|
535
|
+
enable_native_access=true
|
536
|
+
else
|
537
|
+
enable_native_access=false
|
538
|
+
fi
|
539
|
+
readonly enable_native_access
|
540
|
+
|
541
|
+
# Unsafe memory access
|
542
|
+
if [ "$java_major" -ge 23 ]; then
|
543
|
+
enable_unsafe_memory=true
|
544
|
+
else
|
545
|
+
enable_unsafe_memory=false
|
546
|
+
fi
|
547
|
+
readonly enable_unsafe_memory
|
548
|
+
|
549
|
+
# ----- Process .java_opts files ----------------------------------------------
|
550
|
+
|
551
|
+
# We include options on the java command line in the following order:
|
552
|
+
#
|
553
|
+
# * JRuby installed bin/.jruby.java_opts (empty by default)
|
554
|
+
# * user directory .jruby.java_opts
|
555
|
+
# * current directory .jruby.java_opts
|
556
|
+
# * dev mode options from bin/.dev_mode.java_opts, if --dev is specified
|
557
|
+
# * module options from bin/.jruby.module_opts if modules are detected
|
558
|
+
# * JAVA_OPTS environment variable
|
559
|
+
# * command line flags
|
560
|
+
|
561
|
+
# Add local and global .jruby.java_opts
|
562
|
+
process_java_opts "$installed_jruby_java_opts_file"
|
563
|
+
process_java_opts "$home_jruby_java_opts_file"
|
564
|
+
process_java_opts "$pwd_jruby_java_opts_file"
|
565
|
+
|
566
|
+
# Capture some Java options to be passed separately
|
567
|
+
JAVA_OPTS_TEMP=""
|
568
|
+
for opt in ${JAVA_OPTS-}; do
|
569
|
+
case $opt in
|
570
|
+
-Xmx*) JAVA_MEM="$opt" ;;
|
571
|
+
-Xss*) JAVA_STACK="$opt" ;;
|
572
|
+
*) JAVA_OPTS_TEMP="$JAVA_OPTS_TEMP $opt" ;;
|
573
|
+
esac
|
574
|
+
done
|
575
|
+
|
576
|
+
JAVA_OPTS="$JAVA_OPTS_TEMP"
|
577
|
+
|
578
|
+
# ----- Set up the JRuby class/module path ------------------------------------
|
579
|
+
|
580
|
+
CP_DELIMITER=":"
|
581
|
+
|
582
|
+
# Find main jruby jar and add it to the classpath
|
583
|
+
jruby_jar=
|
584
|
+
for j in "$JRUBY_HOME"/lib/jruby.jar "$JRUBY_HOME"/lib/jruby-complete.jar; do
|
585
|
+
if [ ! -e "$j" ]; then
|
586
|
+
continue
|
587
|
+
fi
|
588
|
+
if [ "${JRUBY_CP-}" ]; then
|
589
|
+
JRUBY_CP="$JRUBY_CP$CP_DELIMITER$j"
|
590
|
+
else
|
591
|
+
JRUBY_CP="$j"
|
592
|
+
fi
|
593
|
+
if [ -n "$jruby_jar" ]; then
|
594
|
+
echo "WARNING: more than one JRuby JAR found in lib directory" 1>&2
|
595
|
+
fi
|
596
|
+
jruby_jar="$j"
|
597
|
+
done
|
598
|
+
readonly jruby_jar
|
599
|
+
|
600
|
+
if $cygwin; then
|
601
|
+
JRUBY_CP="$(cygpath -p -w "$JRUBY_CP")"
|
602
|
+
fi
|
603
|
+
|
604
|
+
# ----- Add additional jars from lib to classpath -----------------------------
|
605
|
+
|
606
|
+
if [ "${JRUBY_PARENT_CLASSPATH-}" ]; then
|
607
|
+
# Use same classpath propagated from parent jruby
|
608
|
+
CP="$JRUBY_PARENT_CLASSPATH"
|
609
|
+
else
|
610
|
+
# add other jars in lib to CP for command-line execution
|
611
|
+
for j in "$JRUBY_HOME"/lib/*.jar; do
|
612
|
+
case "${j#"$JRUBY_HOME/lib/"}" in
|
613
|
+
jruby.jar|jruby-complete.jar) continue
|
614
|
+
esac
|
615
|
+
if [ -z "${CP-}" ]; then
|
616
|
+
CP="$j"
|
617
|
+
else
|
618
|
+
CP="$CP$CP_DELIMITER$j"
|
619
|
+
fi
|
620
|
+
done
|
621
|
+
|
622
|
+
if [ "${CP-}" ] && $cygwin; then
|
623
|
+
CP="$(cygpath -p -w "$CP")"
|
624
|
+
fi
|
625
|
+
fi
|
626
|
+
|
627
|
+
if $cygwin; then
|
628
|
+
# switch delimiter only after building Unix style classpaths
|
629
|
+
CP_DELIMITER=";"
|
630
|
+
fi
|
631
|
+
|
632
|
+
readonly CP_DELIMITER
|
633
|
+
|
634
|
+
# ----- Continue processing JRuby options into JVM options --------------------
|
635
|
+
|
636
|
+
# Split out any -J argument for passing to the JVM.
|
637
|
+
# Scanning for args is aborted by '--'.
|
638
|
+
# shellcheck disable=2086
|
639
|
+
set -- $JRUBY_OPTS "$@"
|
640
|
+
# increment pointer, permute arguments
|
641
|
+
while [ $# -gt 0 ]
|
642
|
+
do
|
643
|
+
case $1 in
|
644
|
+
# Stuff after '-J' in this argument goes to JVM
|
645
|
+
-J-Xmx*) JAVA_MEM="${1#-J}" ;;
|
646
|
+
-J-Xss*) JAVA_STACK="${1#-J}" ;;
|
647
|
+
-J)
|
648
|
+
"$JAVACMD" -help
|
649
|
+
echo "(Prepend -J in front of these options when using 'jruby' command)" 1>&2
|
650
|
+
exit
|
651
|
+
;;
|
652
|
+
-J-X)
|
653
|
+
"$JAVACMD" -X
|
654
|
+
echo "(Prepend -J in front of these options when using 'jruby' command)" 1>&2
|
655
|
+
exit
|
656
|
+
;;
|
657
|
+
-J-classpath|-J-cp)
|
658
|
+
if [ -z "${CP-}" ]; then
|
659
|
+
CP="$2"
|
660
|
+
else
|
661
|
+
CP="$CP$CP_DELIMITER$2"
|
662
|
+
fi
|
663
|
+
CLASSPATH=""
|
664
|
+
shift
|
665
|
+
;;
|
666
|
+
-J-ea*)
|
667
|
+
VERIFY_JRUBY=true
|
668
|
+
append java_args "${1#-J}"
|
669
|
+
;;
|
670
|
+
-J-Djava.security.egd=*) JAVA_SECURITY_EGD=${1#-J-Djava.security.egd=} ;;
|
671
|
+
# This must be the last check for -J
|
672
|
+
-J*) append java_args "${1#-J}" ;;
|
673
|
+
# Pass -X... and -X? search options through
|
674
|
+
-X*...|-X*\?) append ruby_args "$1" ;;
|
675
|
+
# Match -Xa.b.c=d to translate to -Da.b.c=d as a java option
|
676
|
+
-X*.*) append java_args -Djruby."${1#-X}" ;;
|
677
|
+
# Match switches that take an argument
|
678
|
+
-[CeIS])
|
679
|
+
append ruby_args "$1" "$2"
|
680
|
+
shift
|
681
|
+
;;
|
682
|
+
# Run with JMX management enabled
|
683
|
+
--manage)
|
684
|
+
append java_args -Dcom.sun.management.jmxremote
|
685
|
+
append java_args -Djruby.management.enabled=true
|
686
|
+
;;
|
687
|
+
# Don't launch a GUI window, no matter what
|
688
|
+
--headless) append java_args -Djava.awt.headless=true ;;
|
689
|
+
# Run under JDB
|
690
|
+
--jdb)
|
691
|
+
jdb=true
|
692
|
+
if [ -z "$JAVA_HOME" ]; then
|
693
|
+
JAVACMD='jdb'
|
694
|
+
else
|
695
|
+
if $cygwin; then
|
696
|
+
JAVACMD="$(cygpath -u "$JAVA_HOME")/bin/jdb"
|
697
|
+
else
|
698
|
+
JAVACMD="$JAVA_HOME/bin/jdb"
|
699
|
+
fi
|
700
|
+
fi
|
701
|
+
JDB_SOURCEPATH="${JRUBY_HOME}/core/src/main/java:${JRUBY_HOME}/lib/ruby/stdlib:."
|
702
|
+
append jdb_args -sourcepath "$JDB_SOURCEPATH"
|
703
|
+
append ruby_args -X+C
|
704
|
+
;;
|
705
|
+
--client|--server|--noclient)
|
706
|
+
echo "Warning: the $1 flag is deprecated and has no effect most JVMs" 1>&2
|
707
|
+
;;
|
708
|
+
--dev)
|
709
|
+
process_java_opts "$dev_mode_opts_file"
|
710
|
+
# For OpenJ9 use environment variable to enable quickstart and shareclasses
|
711
|
+
export OPENJ9_JAVA_OPTIONS="-Xquickstart -Xshareclasses"
|
712
|
+
;;
|
713
|
+
--sample) append java_args -Xprof ;;
|
714
|
+
--record)
|
715
|
+
append java_args -XX:+FlightRecorder -XX:StartFlightRecording=dumponexit=true
|
716
|
+
;;
|
717
|
+
--no-bootclasspath) NO_BOOTCLASSPATH=true ;;
|
718
|
+
--ng*)
|
719
|
+
echo "Error: Nailgun is no longer supported" 1>&2
|
720
|
+
exit 1
|
721
|
+
;;
|
722
|
+
--environment) print_environment_log=true ;;
|
723
|
+
# warn but ignore
|
724
|
+
--1.8|--1.9|--2.0) echo "warning: $1 ignored" 1>&2 ;;
|
725
|
+
--checkpoint=*)
|
726
|
+
java_class=org.jruby.main.CheckpointMain
|
727
|
+
append java_args -XX:CRaCCheckpointTo="${1#--checkpoint=}" ;;
|
728
|
+
# capture a checkpoint to specified location
|
729
|
+
--checkpoint)
|
730
|
+
java_class=org.jruby.main.CheckpointMain
|
731
|
+
append java_args -XX:CRaCCheckpointTo=.jruby.checkpoint ;;
|
732
|
+
# restore from checkpoint
|
733
|
+
--restore=*) append java_args -XX:CRaCRestoreFrom="${1#--restore=}" ;;
|
734
|
+
--restore) append java_args -XX:CRaCRestoreFrom=.jruby.checkpoint ;;
|
735
|
+
--cache)
|
736
|
+
if ! $java_has_appcds; then
|
737
|
+
echo "Error: Java $java_major doesn't support automatic AppCDS" >&2
|
738
|
+
exit 2
|
739
|
+
fi
|
740
|
+
regenerate_jsa_file=true # Force regeneration of archive
|
741
|
+
;;
|
742
|
+
--nocache) use_jsa_file=false ;;
|
743
|
+
--rmcache) remove_jsa_files=true ;;
|
744
|
+
--logcache) log_cds=true ;;
|
745
|
+
# Abort processing on the double dash
|
746
|
+
--) break ;;
|
747
|
+
# Other opts go to ruby
|
748
|
+
-*) append ruby_args "$1" ;;
|
749
|
+
# Abort processing on first non-opt arg
|
750
|
+
*) break ;;
|
751
|
+
esac
|
752
|
+
shift
|
753
|
+
done
|
754
|
+
|
755
|
+
# Force JDK to use specified java.security.egd rand source
|
756
|
+
if [ -n "${JAVA_SECURITY_EGD-}" ]; then
|
757
|
+
append java_args "-Djava.security.egd=$JAVA_SECURITY_EGD"
|
758
|
+
fi
|
759
|
+
|
760
|
+
# The rest of the arguments are for ruby
|
761
|
+
append ruby_args "$@"
|
762
|
+
|
763
|
+
JAVA_OPTS="$JAVA_OPTS ${JAVA_MEM-} ${JAVA_STACK-}"
|
764
|
+
|
765
|
+
JFFI_OPTS="-Djffi.boot.library.path=$JRUBY_HOME/lib/jni"
|
766
|
+
|
767
|
+
CLASSPATH="${CP-}${CP_DELIMITER}${CLASSPATH-}"
|
768
|
+
|
769
|
+
# ----- Module and Class Data Sharing flags for Java 9+ -----------------------
|
770
|
+
|
771
|
+
if $use_modules; then
|
772
|
+
# Switch to non-boot path since we can't use bootclasspath on 9+
|
773
|
+
NO_BOOTCLASSPATH=true
|
774
|
+
|
775
|
+
# Add base opens we need for Ruby compatibility
|
776
|
+
process_java_opts "$jruby_module_opts_file"
|
777
|
+
fi
|
778
|
+
|
779
|
+
# Default JVM Class Data Sharing Archive (jsa) file for JVMs that support it
|
780
|
+
readonly jruby_jsa_file="$JRUBY_HOME/lib/jruby-java$java_version.jsa"
|
781
|
+
|
782
|
+
# Find JSAs for all Java versions
|
783
|
+
assign jruby_jsa_files "$JRUBY_HOME"/lib/jruby-java*.jsa
|
784
|
+
readonly jruby_jsa_files
|
785
|
+
|
786
|
+
# Allow overriding default JSA file location
|
787
|
+
if [ -n "${JRUBY_JSA-}" ]; then
|
788
|
+
jruby_jsa_file="$JRUBY_JSA"
|
789
|
+
fi
|
790
|
+
|
791
|
+
# Ensure the AppCDS parent directory is actually writable
|
792
|
+
if dir_name "$jruby_jsa_file" && ! [ -w "$REPLY" ]; then
|
793
|
+
if $use_jsa_file || $regenerate_jsa_file || $remove_jsa_files; then
|
794
|
+
echo "Warning: AppCDS archive directory is not writable, disabling AppCDS operations" >&2
|
795
|
+
fi
|
796
|
+
regenerate_jsa_file=false
|
797
|
+
remove_jsa_files=false
|
798
|
+
use_jsa_file=false
|
799
|
+
fi
|
800
|
+
|
801
|
+
# Initialize AppCDS
|
802
|
+
if $use_jsa_file; then
|
803
|
+
# Default to no-op script when explicitly generating
|
804
|
+
if $regenerate_jsa_file && a_isempty "$ruby_args"; then
|
805
|
+
append ruby_args -e 1
|
806
|
+
fi
|
807
|
+
|
808
|
+
# Archive should be regenerated manually if requested or it's outdated relative to JRuby
|
809
|
+
if ! $regenerate_jsa_file && is_newer "$jruby_jar" "$jruby_jsa_file"; then
|
810
|
+
regenerate_jsa_file=true
|
811
|
+
fi
|
812
|
+
|
813
|
+
# Defer generation to Java if flag is available
|
814
|
+
if $java_has_appcds_autogenerate; then
|
815
|
+
append java_args -XX:+AutoCreateSharedArchive
|
816
|
+
|
817
|
+
add_log
|
818
|
+
add_log "Automatically generating and using CDS archive at:"
|
819
|
+
add_log " $jruby_jsa_file"
|
820
|
+
fi
|
821
|
+
|
822
|
+
# Determine if we should read or explicitly write the archive
|
823
|
+
if $regenerate_jsa_file && ! $java_has_appcds_autogenerate; then
|
824
|
+
# Explicitly create archive if outdated
|
825
|
+
append java_args -XX:ArchiveClassesAtExit="$jruby_jsa_file"
|
826
|
+
|
827
|
+
add_log
|
828
|
+
add_log "Regenerating CDS archive at:"
|
829
|
+
add_log " $jruby_jsa_file"
|
830
|
+
else
|
831
|
+
# Read archive if not explicitly regenerating
|
832
|
+
append java_args -XX:SharedArchiveFile="$jruby_jsa_file"
|
833
|
+
|
834
|
+
if ! $java_has_appcds_autogenerate; then
|
835
|
+
add_log
|
836
|
+
add_log "Using CDS archive at:"
|
837
|
+
add_log " $jruby_jsa_file"
|
838
|
+
fi
|
839
|
+
fi
|
840
|
+
|
841
|
+
if $log_cds; then
|
842
|
+
add_log "Logging CDS output to:"
|
843
|
+
add_log " $jruby_jsa_file.log"
|
844
|
+
append java_args -Xlog:cds=info:file="$jruby_jsa_file".log
|
845
|
+
append java_args -Xlog:cds+dynamic=info:file="$jruby_jsa_file".log
|
846
|
+
else
|
847
|
+
append java_args -Xlog:cds=off -Xlog:cds+dynamic=off
|
848
|
+
fi
|
849
|
+
fi
|
850
|
+
|
851
|
+
# Enable access to native libraries
|
852
|
+
if $enable_native_access; then
|
853
|
+
append java_args --enable-native-access=org.jruby.dist
|
854
|
+
fi
|
855
|
+
|
856
|
+
# Enable access to Unsafe memory functions
|
857
|
+
if $enable_unsafe_memory; then
|
858
|
+
append java_args --sun-misc-unsafe-memory-access=allow
|
859
|
+
fi
|
860
|
+
|
861
|
+
# Enable access to Unsafe memory functions
|
862
|
+
|
863
|
+
# ----- Tweak console environment for cygwin ----------------------------------
|
864
|
+
|
865
|
+
if $cygwin; then
|
866
|
+
use_exec=false
|
867
|
+
JRUBY_HOME="$(cygpath --mixed "$JRUBY_HOME")"
|
868
|
+
JRUBY_SHELL="$(cygpath --mixed "$JRUBY_SHELL")"
|
869
|
+
|
870
|
+
eval set -- "$ruby_args"
|
871
|
+
|
872
|
+
case $1 in
|
873
|
+
/*)
|
874
|
+
if [ -f "$1" ] || [ -d "$1" ]; then
|
875
|
+
# replace first element of ruby_args with cygwin form
|
876
|
+
win_arg="$(cygpath -w "$1")"
|
877
|
+
shift
|
878
|
+
set -- "$win_arg" "$@"
|
879
|
+
assign ruby_args "$@"
|
880
|
+
fi
|
881
|
+
;;
|
882
|
+
esac
|
883
|
+
|
884
|
+
# fix JLine to use UnixTerminal
|
885
|
+
if stty -icanon min 1 -echo > /dev/null 2>&1; then
|
886
|
+
JAVA_OPTS="$JAVA_OPTS -Djline.terminal=jline.UnixTerminal"
|
887
|
+
fi
|
888
|
+
|
889
|
+
fi
|
890
|
+
|
891
|
+
# ----- Final prepration of the Java command line -----------------------------
|
892
|
+
|
893
|
+
# Don't quote JAVA_OPTS; we want it to expand
|
894
|
+
# shellcheck disable=2086
|
895
|
+
prepend java_args $JAVA_OPTS "$JFFI_OPTS"
|
896
|
+
|
897
|
+
# Include all options from files at the beginning of the Java command line
|
898
|
+
preextend java_args java_opts_from_files
|
899
|
+
|
900
|
+
if $jdb; then
|
901
|
+
preextend java_args jdb_args
|
902
|
+
fi
|
903
|
+
|
904
|
+
prepend java_args "$JAVACMD"
|
905
|
+
|
906
|
+
if $NO_BOOTCLASSPATH || $VERIFY_JRUBY; then
|
907
|
+
if $use_modules; then
|
908
|
+
# Use module path instead of classpath for the jruby libs
|
909
|
+
append java_args --module-path "$JRUBY_CP" -classpath "$CLASSPATH"
|
910
|
+
else
|
911
|
+
append java_args -classpath "$JRUBY_CP$CP_DELIMITER$CLASSPATH"
|
912
|
+
fi
|
913
|
+
else
|
914
|
+
append java_args -Xbootclasspath/a:"$JRUBY_CP"
|
915
|
+
append java_args -classpath "$CLASSPATH"
|
916
|
+
append java_args -Djruby.home="$JRUBY_HOME"
|
917
|
+
fi
|
918
|
+
|
919
|
+
append java_args -Djruby.home="$JRUBY_HOME" \
|
920
|
+
-Djruby.lib="$JRUBY_HOME/lib" \
|
921
|
+
-Djruby.script=jruby \
|
922
|
+
-Djruby.shell="$JRUBY_SHELL" \
|
923
|
+
"$java_class"
|
924
|
+
extend java_args ruby_args
|
925
|
+
|
926
|
+
eval set -- "$java_args"
|
927
|
+
|
928
|
+
add_log
|
929
|
+
add_log "Java command line:"
|
930
|
+
add_log " $*"
|
931
|
+
|
932
|
+
if $print_environment_log; then
|
933
|
+
echo "$environment_log"
|
934
|
+
exit 0
|
935
|
+
fi
|
936
|
+
|
937
|
+
# ----- Perform final mutations after logging ---------------------------------
|
938
|
+
# Delete All AppCDS files and exit if requested
|
939
|
+
if $remove_jsa_files; then
|
940
|
+
eval rm -f -- "$jruby_jsa_files"
|
941
|
+
exit
|
942
|
+
fi
|
943
|
+
|
944
|
+
if $regenerate_jsa_file && [ -e "$jruby_jsa_file" ]; then
|
945
|
+
# Delete selected AppCDS file if requested or if it's outdated
|
946
|
+
rm -f -- "$jruby_jsa_file"
|
947
|
+
fi
|
948
|
+
|
949
|
+
# ----- Run JRuby! ------------------------------------------------------------
|
950
|
+
|
951
|
+
if $use_exec; then
|
952
|
+
exec "$@"
|
953
|
+
else
|
954
|
+
"$@"
|
955
|
+
|
956
|
+
# Record the exit status immediately, or it will be overridden.
|
957
|
+
JRUBY_STATUS=$?
|
958
|
+
|
959
|
+
if $cygwin; then
|
960
|
+
stty icanon echo > /dev/null 2>&1
|
961
|
+
fi
|
962
|
+
|
963
|
+
exit $JRUBY_STATUS
|
964
|
+
fi
|
data/lib/jruby-launcher.rb
CHANGED
data/spec/launcher_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'tmpdir'
|
|
2
2
|
require File.expand_path('../spec_helper.rb', __FILE__)
|
3
3
|
load File.expand_path('../../lib/jruby-launcher.rb', __FILE__)
|
4
4
|
|
5
|
-
describe "JRuby native launcher" do
|
5
|
+
describe "JRuby native launcher", if: /Windows/.match?(ENV_JAVA['os.name']) do
|
6
6
|
it "should run org.jruby.Main" do
|
7
7
|
jruby_launcher_args("").last.should == "org/jruby/Main"
|
8
8
|
end
|
data/unixlauncher.c
CHANGED
data/version.h
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jruby-launcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.pre2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Nick Sieger
|
8
8
|
- Vladimir Sizikov
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03
|
11
|
+
date: 2025-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Builds and installs a native launcher for JRuby on your system
|
14
14
|
email:
|
@@ -26,6 +26,7 @@ files:
|
|
26
26
|
- argnames.h
|
27
27
|
- argparser.cpp
|
28
28
|
- argparser.h
|
29
|
+
- exe/jruby.sh
|
29
30
|
- extconf.rb
|
30
31
|
- inc/Makefile-conf.mk
|
31
32
|
- inc/Makefile-impl.mk
|
@@ -35,7 +36,6 @@ files:
|
|
35
36
|
- jvmlauncher.cpp
|
36
37
|
- jvmlauncher.h
|
37
38
|
- lib/jruby-launcher.rb
|
38
|
-
- lib/rubygems/defaults/jruby_native.rb
|
39
39
|
- nbexecloader.h
|
40
40
|
- ng.c
|
41
41
|
- platformlauncher.cpp
|