jruby-launcher 1.1.14-java → 1.1.15-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/jruby-launcher.rb +1 -1
- data/pkg/jruby-launcher-1.1.14-java/extconf.rb +12 -0
- data/pkg/jruby-launcher-1.1.14-java/lib/jruby-launcher.rb +3 -0
- data/pkg/jruby-launcher-1.1.14-java/lib/rubygems/defaults/jruby_native.rb +4 -0
- data/pkg/jruby-launcher-1.1.14-java/spec/launcher_spec.rb +281 -0
- data/pkg/jruby-launcher-1.1.14-java/spec/spec_helper.rb +76 -0
- data/spec/launcher_spec.rb +10 -3
- data/unixlauncher.cpp +10 -4
- data/utilsfuncs.cpp +13 -0
- data/utilsfuncs.h +1 -0
- data/version.h +1 -1
- metadata +11 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0b6988d6ac03341b36b3f204165bee190f7f7ae0a73ad223527b7631bd4e5b80
|
4
|
+
data.tar.gz: 0c797f2e012c00217e9defc6081c69c636443ca836436d25fc21d95326c398c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26b78fd8b5b97ac99c2d3822805ff6acaebdc39e9a015a0c99cbc4b8de563b6ebe34d09376d9a7a5c0759362e7dd97bdeffe5303aa91085c21a706e77a441964
|
7
|
+
data.tar.gz: 6f39b0b7f613069696db0acfd3494b029c14e7d847e7093fa8527cab76ff40ba3c61325bfb5b119e189103b2457eab2a50bd27feb52d3dae19079dbf41560371
|
data/lib/jruby-launcher.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
mf = File.read('Makefile')
|
2
|
+
mf = mf.gsub(/^BINDIR\s*=.*$/, "BINDIR = #{RbConfig::CONFIG['bindir']}")
|
3
|
+
mf = mf.gsub(/^PREFIX\s*=.*$/, "PREFIX = #{File.dirname(RbConfig::CONFIG['libdir'])}")
|
4
|
+
mf = mf.gsub(/^JRUBY_VERSION\s*=.*$/, "JRUBY_VERSION = #{JRUBY_VERSION}")
|
5
|
+
|
6
|
+
# Launcher will use .module_opts file if present, otherwise hardcoded add-opens for this module.
|
7
|
+
# Module options are only supported on JRuby 9.2.1 or higher.
|
8
|
+
if JRUBY_VERSION =~ /(^1)|(^9\.[01])|(^9\.2\.0\.0)/
|
9
|
+
mf = mf.gsub(/^JRUBY_MODULE\s*=.*1$/, "JRUBY_MODULE =")
|
10
|
+
end
|
11
|
+
puts mf
|
12
|
+
File.open('Makefile', 'wb') {|f| f << mf}
|
@@ -0,0 +1,281 @@
|
|
1
|
+
require 'tmpdir'
|
2
|
+
require File.expand_path('../spec_helper.rb', __FILE__)
|
3
|
+
load File.expand_path('../../lib/jruby-launcher.rb', __FILE__)
|
4
|
+
|
5
|
+
describe "JRuby native launcher" do
|
6
|
+
it "should run org.jruby.Main" do
|
7
|
+
jruby_launcher_args("").last.should == "org/jruby/Main"
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should pass unrecognized arguments to JRuby" do
|
11
|
+
jruby_launcher_args("-J-Dsome.option -v --help")[-3..-1].should == ["org/jruby/Main", "-v", "--help"]
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should print help message" do
|
15
|
+
args = jruby_launcher_args("-Xhelp 2>&1")
|
16
|
+
args.select {|l| l =~ /JRuby Launcher usage/}.should_not be_empty
|
17
|
+
args.should include("-X")
|
18
|
+
args = jruby_launcher_args("-X 2>&1")
|
19
|
+
args.detect {|l| l =~ /JRuby Launcher usage/}.should_not be_empty
|
20
|
+
args.should include("-X")
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should use $JAVACMD when JAVACMD is specified" do
|
24
|
+
with_environment "JAVACMD" => File.join("jato") do
|
25
|
+
if windows?
|
26
|
+
jruby_launcher_args("-v 2>&1").join.should =~ %r{jato}
|
27
|
+
else
|
28
|
+
jruby_launcher_args("-v").first.should == File.join("jato")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should use $JAVA_HOME/bin/java when JAVA_HOME is specified" do
|
34
|
+
with_environment "JAVA_HOME" => File.join("some", "java", "home") do
|
35
|
+
if windows?
|
36
|
+
jruby_launcher_args("-v 2>&1").join.should =~ %r{some/java/home}
|
37
|
+
else
|
38
|
+
jruby_launcher_args("-v").first.should == File.join("some", "java", "home", "bin", "java")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should use -Xjdkhome argument above JAVA_HOME" do
|
44
|
+
with_environment "JAVA_HOME" => File.join("env", "java", "home") do
|
45
|
+
if windows?
|
46
|
+
jruby_launcher_args("-Xjdkhome some/java/home 2>&1").join.should =~ %r{some/java/home}
|
47
|
+
else
|
48
|
+
jruby_launcher_args("-Xjdkhome some/java/home").first.should == File.join("some", "java", "home", "bin", "java")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should drop the backslashes at the end of JAVA_HOME" do
|
54
|
+
with_environment "JAVA_HOME" => File.join("some", "java", "home\\\\") do
|
55
|
+
if windows?
|
56
|
+
jruby_launcher_args("").join.should =~ %r{some/java/home}
|
57
|
+
else
|
58
|
+
jruby_launcher_args("").first.should == File.join("some", "java", "home", "bin", "java")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should complain about a missing log argument" do
|
64
|
+
jruby_launcher("-Xtrace 2>&1").should =~ /Argument is missing for "-Xtrace"/
|
65
|
+
jruby_launcher("-Xtrace -- 2>&1").should =~ /Argument is missing for "-Xtrace"/
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should complain about a missing jdkhome argument" do
|
69
|
+
jruby_launcher("-Xjdkhome 2>&1").should =~ /Argument is missing/
|
70
|
+
jruby_launcher("-Xjdkhome -- 2>&1").should =~ /Argument is missing/
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should complain about a missing classpath append argument" do
|
74
|
+
jruby_launcher("-Xcp:a 2>&1").should =~ /Argument is missing/
|
75
|
+
jruby_launcher("-Xcp:a -- 2>&1").should =~ /Argument is missing/
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should run nailgun server with --ng-server option" do
|
79
|
+
jruby_launcher_args("--ng-server").last.should == "com/martiansoftware/nailgun/NGServer"
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should run nailgun client with --ng option" do
|
83
|
+
jruby_launcher_args('--ng -e "puts 1"').should == ["org.jruby.util.NailMain", "-e", "puts 1"]
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should handle -J JVM options" do
|
87
|
+
jruby_launcher_args("-J-Darg1=value1 -J-Darg2=value2").should include("-Darg1=value1", "-Darg2=value2")
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should pass -Xprop.erty=value as -J-Djruby.prop.erty=value" do
|
91
|
+
jruby_launcher_args("-Xprop.erty=value").should include("-Djruby.prop.erty=value")
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should pass -Xproperties as --properties" do
|
95
|
+
jruby_launcher_args("-Xproperties").should include("--properties")
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should allow max heap to be overridden" do
|
99
|
+
jruby_launcher_args("-J-Xmx256m").should include("-Xmx256m")
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should default to 2048k max stack" do
|
103
|
+
jruby_launcher_args("").should include("-Xss2048k")
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should allow max stack to be overridden" do
|
107
|
+
jruby_launcher_args("-J-Xss512k").should include("-Xss512k")
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should add the contents of the CLASSPATH environment variable" do
|
111
|
+
with_environment "CLASSPATH" => "some.jar" do
|
112
|
+
classpath_arg(jruby_launcher_args("")).should =~ /some.jar/
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should add the classpath elements in proper order" do
|
117
|
+
s = File::PATH_SEPARATOR
|
118
|
+
with_environment "CLASSPATH" => "some-env.jar" do
|
119
|
+
args = jruby_launcher_args("-Xcp:a some-other.jar -Xcp:p some.jar")
|
120
|
+
classpath_arg(args).should =~ /some.jar.*#{s}some-env.jar#{s}some-other.jar/
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should use the --server compiler" do
|
125
|
+
jruby_launcher_args("--server").should include("-server")
|
126
|
+
end
|
127
|
+
|
128
|
+
it "should use the --client compiler" do
|
129
|
+
jruby_launcher_args("--client").should include("-client")
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should set the JMX settings when --manage is present" do
|
133
|
+
jruby_launcher_args("--manage").should include("-Dcom.sun.management.jmxremote", "-Djruby.management.enabled=true")
|
134
|
+
end
|
135
|
+
|
136
|
+
it "should set the headless flag when --headless is present" do
|
137
|
+
jruby_launcher_args("--headless").should include("-Djava.awt.headless=true")
|
138
|
+
end
|
139
|
+
|
140
|
+
it "should pass -Xprof when --sample is present" do
|
141
|
+
jruby_launcher_args("--sample").should include("-Xprof")
|
142
|
+
end
|
143
|
+
|
144
|
+
it "should stop argument processing when a -- is seen" do
|
145
|
+
jruby_launcher_args("-- -Xhelp -Xtrace --headless").should include("-Xhelp", "-Xtrace", "--headless")
|
146
|
+
end
|
147
|
+
|
148
|
+
# JRUBY-4151
|
149
|
+
it "should properly handle single quotes" do
|
150
|
+
jruby_launcher_args("-e 'ABC DEF'").should include("ABC DEF")
|
151
|
+
end
|
152
|
+
|
153
|
+
# JRUBY-4581
|
154
|
+
it "should prepend JRUBY_OPTS to the start of the argument list to process" do
|
155
|
+
with_environment "JRUBY_OPTS" => "--server -J-Dsome.key=val -rubygems" do
|
156
|
+
jruby_launcher_args("-e 'ABC DEF'").should include("-server", "-Dsome.key=val", "-rubygems", "-e", "ABC DEF")
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
# JRUBY-4611
|
161
|
+
it "stops argument processing on first non-option argument" do
|
162
|
+
jruby_launcher_args("foo.rb --sample")[-2..-1].should == ["foo.rb", "--sample"]
|
163
|
+
end
|
164
|
+
|
165
|
+
# JRUBY-4608
|
166
|
+
if RbConfig::CONFIG['target_os'] =~ /darwin/i
|
167
|
+
it "includes file.encoding=UTF-8 on Mac if JAVA_ENCODING is not set" do
|
168
|
+
jruby_launcher_args("-e true").should include("-Dfile.encoding=UTF-8")
|
169
|
+
with_environment "JAVA_ENCODING" => "MacRoman" do
|
170
|
+
jruby_launcher_args("-e true").should_not include("-Dfile.encoding=UTF-8")
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
it "does not crash on empty args" do
|
176
|
+
jruby_launcher_args("-e ''").should include("-e")
|
177
|
+
jruby_launcher("-Xtrace '' 2>&1").should =~ /-Xtrace/
|
178
|
+
jruby_launcher("-Xjdkhome '' 2>&1").should =~ /-Xjdkhome/
|
179
|
+
end
|
180
|
+
|
181
|
+
# JRUBY-4706
|
182
|
+
it "should put JRuby on regular classpath when -Xnobootclasspath is used" do
|
183
|
+
args = jruby_launcher_args("-e true")
|
184
|
+
args.grep(/Xbootclasspath/).should_not be_empty
|
185
|
+
args = jruby_launcher_args("-Xnobootclasspath -e true")
|
186
|
+
args.grep(/Xbootclasspath/).should be_empty
|
187
|
+
end
|
188
|
+
|
189
|
+
it "should put JRuby on regular classpath when VERIFY_JRUBY is set" do
|
190
|
+
with_environment "VERIFY_JRUBY" => "true" do
|
191
|
+
args = jruby_launcher_args("-e true")
|
192
|
+
args.grep(/Xbootclasspath/).should be_empty
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
# JRUBY-4709
|
197
|
+
it "should include a bare : or ; at the end of the classpath, to include PWD in the path" do
|
198
|
+
classpath_arg(jruby_launcher_args("-Xnobootclasspath -e true")).should =~
|
199
|
+
if windows?
|
200
|
+
/;$/
|
201
|
+
else
|
202
|
+
/:$/
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
# JRUBY-6016
|
207
|
+
it "should honor JAVA_MEM" do
|
208
|
+
with_environment "JAVA_MEM" => "-Xmx768m" do
|
209
|
+
jruby_launcher_args("").should include("-Xmx768m")
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
it "should honor JAVA_STACK" do
|
214
|
+
with_environment "JAVA_STACK" => "-Xss3072k" do
|
215
|
+
jruby_launcher_args("").should include("-Xss3072k")
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
it "should honor JRUBY_HOME" do
|
220
|
+
with_environment "JRUBY_HOME" => "/tmp" do
|
221
|
+
jruby_launcher_args("").should include("-Djruby.home=/tmp")
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
context "JRUBY_HOME set and JRUBY_HOME/lib/jruby.jar exists" do
|
226
|
+
let(:jruby_home) do
|
227
|
+
require 'tempfile'
|
228
|
+
t = Tempfile.new("jruby_home")
|
229
|
+
t.path.tap { t.close! }
|
230
|
+
end
|
231
|
+
|
232
|
+
before do
|
233
|
+
FileUtils.mkdir_p(File.join(jruby_home, "lib"))
|
234
|
+
FileUtils.touch(File.join(jruby_home, "lib", "jruby.jar"))
|
235
|
+
end
|
236
|
+
after { FileUtils.rm_rf jruby_home }
|
237
|
+
|
238
|
+
it "should add jruby.jar to the bootclasspath" do
|
239
|
+
with_environment "JRUBY_HOME" => jruby_home do
|
240
|
+
jruby_launcher_args("").should include("-Xbootclasspath/a:#{jruby_home}/lib/jruby.jar")
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
it "should place user-supplied options after default options" do
|
246
|
+
args = jruby_launcher_args("-J-Djruby.home=/tmp")
|
247
|
+
home_args = args.select {|x| x =~ /^-Djruby\.home/ }
|
248
|
+
home_args.length.should == 2
|
249
|
+
home_args.last.should == "-Djruby.home=/tmp"
|
250
|
+
end
|
251
|
+
|
252
|
+
it "should print the version" do
|
253
|
+
jruby_launcher("-Xversion 2>&1").should =~ /Launcher Version #{JRubyLauncher::VERSION}/
|
254
|
+
end
|
255
|
+
|
256
|
+
it "should not crash on format-strings" do
|
257
|
+
jruby_launcher_args("-e %s%s%s%s%s 2>&1").should include('-e', '%s%s%s%s%s')
|
258
|
+
end
|
259
|
+
|
260
|
+
it "should use --module-path on java9+ jruby 9.2.1+" do
|
261
|
+
# versions prior to 9.2.1 do not set a predictable module name
|
262
|
+
skip unless (JRUBY_VERSION.split('.') <=> ['9', '2', '1']) >= 0
|
263
|
+
|
264
|
+
Dir.mktmpdir do |java_home|
|
265
|
+
FileUtils.mkdir_p(File.join(java_home, 'lib/modules'))
|
266
|
+
with_environment 'JAVA_HOME' => java_home do
|
267
|
+
jruby_launcher_args('').grep(/^--module-path=.*jruby.jar/).should_not be_empty
|
268
|
+
end
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
it "should not treat CLASSPATH entries as modules on java9+" do
|
273
|
+
Dir.mktmpdir do |java_home|
|
274
|
+
Dir.mkdir(File.join(java_home, 'jmods'))
|
275
|
+
with_environment 'JAVA_HOME' => java_home, 'CLASSPATH' => '/some/lib.jar' do
|
276
|
+
jruby_launcher_args('').grep(/^--module-path=.*\/some\/lib.jar/).should be_empty
|
277
|
+
classpath_arg(jruby_launcher_args('')).should =~ /\/some\/lib.jar/
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'rbconfig'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
module JRubyLauncherHelper
|
6
|
+
JRUBY_EXE = ''
|
7
|
+
WINDOWS = RbConfig::CONFIG['target_os'] =~ /mswin/
|
8
|
+
|
9
|
+
def self.check_executable_built
|
10
|
+
exe = File.expand_path("../../jruby", __FILE__) + RbConfig::CONFIG['EXEEXT']
|
11
|
+
unless File.executable?(exe)
|
12
|
+
raise "Error: launcher executable not built; type `make' before continuing."
|
13
|
+
end
|
14
|
+
top = File.dirname(exe)
|
15
|
+
name = File.basename(exe)
|
16
|
+
home = File.join(top, "build/home")
|
17
|
+
FileUtils.mkdir_p(File.join(home, "bin"))
|
18
|
+
FileUtils.cp(exe, File.join(home, "bin"))
|
19
|
+
if JRubyLauncherHelper::WINDOWS
|
20
|
+
FileUtils.cp(exe.sub(/exe/, 'dll'), File.join(home, "bin"))
|
21
|
+
end
|
22
|
+
FileUtils.mkdir_p(File.join(home, "lib"))
|
23
|
+
FileUtils.touch(File.join(home, "lib/jruby.jar"))
|
24
|
+
JRUBY_EXE.concat File.join(home, "bin", name)
|
25
|
+
end
|
26
|
+
|
27
|
+
def jruby_launcher(args)
|
28
|
+
`#{JRUBY_EXE} #{args}`
|
29
|
+
end
|
30
|
+
|
31
|
+
def jruby_launcher_args(args)
|
32
|
+
jruby_launcher("-Xcommand #{args}").split("\n")
|
33
|
+
end
|
34
|
+
|
35
|
+
def last_exit_code
|
36
|
+
$?.exitstatus
|
37
|
+
end
|
38
|
+
|
39
|
+
def windows?
|
40
|
+
WINDOWS
|
41
|
+
end
|
42
|
+
|
43
|
+
def classpath_arg(args)
|
44
|
+
index = args.index("-cp")
|
45
|
+
index.should > 0
|
46
|
+
args[index + 1]
|
47
|
+
end
|
48
|
+
|
49
|
+
def with_environment(pairs = {})
|
50
|
+
prev_env = {}
|
51
|
+
pairs.each_pair do |k,v|
|
52
|
+
prev_env[k] = ENV[k] if ENV.has_key?(k)
|
53
|
+
ENV[k] = v
|
54
|
+
end
|
55
|
+
begin
|
56
|
+
yield
|
57
|
+
ensure
|
58
|
+
pairs.keys.each {|k| ENV.delete(k)}
|
59
|
+
ENV.update(prev_env)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
RSpec.configure do |config|
|
65
|
+
config.before(:all) do
|
66
|
+
JRubyLauncherHelper.check_executable_built
|
67
|
+
# clear environment for better control
|
68
|
+
ENV.delete("JAVA_HOME")
|
69
|
+
ENV.delete("JRUBY_HOME")
|
70
|
+
ENV.delete("JAVA_OPTS")
|
71
|
+
ENV.delete("JRUBY_OPTS")
|
72
|
+
ENV.delete("CLASSPATH")
|
73
|
+
ENV.delete("JAVA_ENCODING")
|
74
|
+
end
|
75
|
+
config.include(JRubyLauncherHelper)
|
76
|
+
end
|
data/spec/launcher_spec.rb
CHANGED
@@ -21,11 +21,12 @@ describe "JRuby native launcher" do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should use $JAVACMD when JAVACMD is specified" do
|
24
|
-
|
24
|
+
javacmd_path = File.join("path", "to", "jato")
|
25
|
+
with_environment "JAVACMD" => javacmd_path do
|
25
26
|
if windows?
|
26
|
-
jruby_launcher_args("-v 2>&1").join.should =~
|
27
|
+
jruby_launcher_args("-v 2>&1").join.should =~ /#{javacmd_path}/
|
27
28
|
else
|
28
|
-
jruby_launcher_args("-v").first.should ==
|
29
|
+
jruby_launcher_args("-v").first.should == javacmd_path
|
29
30
|
end
|
30
31
|
end
|
31
32
|
end
|
@@ -180,6 +181,9 @@ describe "JRuby native launcher" do
|
|
180
181
|
|
181
182
|
# JRUBY-4706
|
182
183
|
it "should put JRuby on regular classpath when -Xnobootclasspath is used" do
|
184
|
+
# Java 9+ do not like bootclasspath so we do not use it
|
185
|
+
skip if ENV_JAVA['java.specification.version'].to_i >= 9
|
186
|
+
|
183
187
|
args = jruby_launcher_args("-e true")
|
184
188
|
args.grep(/Xbootclasspath/).should_not be_empty
|
185
189
|
args = jruby_launcher_args("-Xnobootclasspath -e true")
|
@@ -236,6 +240,9 @@ describe "JRuby native launcher" do
|
|
236
240
|
after { FileUtils.rm_rf jruby_home }
|
237
241
|
|
238
242
|
it "should add jruby.jar to the bootclasspath" do
|
243
|
+
# Java 9+ do not like bootclasspath so we do not use it
|
244
|
+
skip if ENV_JAVA['java.specification.version'].to_i >= 9
|
245
|
+
|
239
246
|
with_environment "JRUBY_HOME" => jruby_home do
|
240
247
|
jruby_launcher_args("").should include("-Xbootclasspath/a:#{jruby_home}/lib/jruby.jar")
|
241
248
|
end
|
data/unixlauncher.cpp
CHANGED
@@ -46,6 +46,9 @@ int UnixLauncher::run(int argc, char* argv[], char* envp[]) {
|
|
46
46
|
|
47
47
|
if (getenv("JAVACMD") != NULL) {
|
48
48
|
java = getenv("JAVACMD");
|
49
|
+
if (java.find_last_of('/') == -1) {
|
50
|
+
java = findOnPath(java.c_str());
|
51
|
+
}
|
49
52
|
} else {
|
50
53
|
if (!jdkhome.empty()) {
|
51
54
|
java = jdkhome + "/bin/java";
|
@@ -56,10 +59,6 @@ int UnixLauncher::run(int argc, char* argv[], char* envp[]) {
|
|
56
59
|
java = java_home + "/bin/java";
|
57
60
|
} else {
|
58
61
|
java = findOnPath("java");
|
59
|
-
if (!java.empty()) {
|
60
|
-
int home_index = java.find_last_of('/', java.find_last_of('/') - 1);
|
61
|
-
jdkhome = java.substr(0, home_index);
|
62
|
-
}
|
63
62
|
}
|
64
63
|
}
|
65
64
|
|
@@ -68,6 +67,13 @@ int UnixLauncher::run(int argc, char* argv[], char* envp[]) {
|
|
68
67
|
return 255;
|
69
68
|
}
|
70
69
|
|
70
|
+
// still no jdk home, use java command to resolve it
|
71
|
+
if (jdkhome.empty()) {
|
72
|
+
java = resolveSymlinks(java);
|
73
|
+
int home_index = java.find_last_of('/', java.find_last_of('/') - 1);
|
74
|
+
jdkhome = java.substr(0, home_index);
|
75
|
+
}
|
76
|
+
|
71
77
|
prepareOptions();
|
72
78
|
|
73
79
|
list<string> commandLine;
|
data/utilsfuncs.cpp
CHANGED
@@ -54,6 +54,7 @@
|
|
54
54
|
#include <unistd.h>
|
55
55
|
#include "utilsfuncs.h"
|
56
56
|
#include "argnames.h"
|
57
|
+
#include <limits.h>
|
57
58
|
|
58
59
|
#ifndef WIN32
|
59
60
|
#include <sys/stat.h>
|
@@ -146,6 +147,18 @@ string findOnPath(const char* name) {
|
|
146
147
|
return "";
|
147
148
|
}
|
148
149
|
|
150
|
+
string resolveSymlinks(string path) {
|
151
|
+
struct stat st;
|
152
|
+
char tmp[PATH_MAX + 1];
|
153
|
+
|
154
|
+
if (lstat(path.c_str(), &st) && st.st_mode & S_IFLNK) {
|
155
|
+
realpath(path.c_str(), tmp);
|
156
|
+
path = tmp;
|
157
|
+
}
|
158
|
+
|
159
|
+
return path;
|
160
|
+
}
|
161
|
+
|
149
162
|
const char* getSysError(char *str, int strSize) {
|
150
163
|
#ifdef WIN32
|
151
164
|
int err = GetLastError();
|
data/utilsfuncs.h
CHANGED
@@ -57,6 +57,7 @@ bool printToConsole(const char *msg);
|
|
57
57
|
char** convertToArgvArray(std::list<std::string> args);
|
58
58
|
void addToArgList(std::list<std::string> & args, int argc, char ** argv);
|
59
59
|
std::string findOnPath(const char* name);
|
60
|
+
std::string resolveSymlinks(std::string name);
|
60
61
|
bool checkDirectory(const char* path);
|
61
62
|
void printListToConsole(std::list<std::string> l);
|
62
63
|
std::string trimTrailingBackslashes(std::string orig);
|
data/version.h
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jruby-launcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.15
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Nick Sieger
|
8
8
|
- Vladimir Sizikov
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-03-
|
12
|
+
date: 2021-03-31 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Builds and installs a native launcher for JRuby on your system
|
15
15
|
email:
|
@@ -39,6 +39,11 @@ files:
|
|
39
39
|
- lib/rubygems/defaults/jruby_native.rb
|
40
40
|
- nbexecloader.h
|
41
41
|
- ng.c
|
42
|
+
- pkg/jruby-launcher-1.1.14-java/extconf.rb
|
43
|
+
- pkg/jruby-launcher-1.1.14-java/lib/jruby-launcher.rb
|
44
|
+
- pkg/jruby-launcher-1.1.14-java/lib/rubygems/defaults/jruby_native.rb
|
45
|
+
- pkg/jruby-launcher-1.1.14-java/spec/launcher_spec.rb
|
46
|
+
- pkg/jruby-launcher-1.1.14-java/spec/spec_helper.rb
|
42
47
|
- platformlauncher.cpp
|
43
48
|
- platformlauncher.h
|
44
49
|
- rb_w32_cmdvector.h
|
@@ -56,7 +61,7 @@ files:
|
|
56
61
|
homepage: http://jruby.org
|
57
62
|
licenses: []
|
58
63
|
metadata: {}
|
59
|
-
post_install_message:
|
64
|
+
post_install_message:
|
60
65
|
rdoc_options: []
|
61
66
|
require_paths:
|
62
67
|
- lib
|
@@ -71,9 +76,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
76
|
- !ruby/object:Gem::Version
|
72
77
|
version: '0'
|
73
78
|
requirements: []
|
74
|
-
|
75
|
-
|
76
|
-
signing_key:
|
79
|
+
rubygems_version: 3.1.6
|
80
|
+
signing_key:
|
77
81
|
specification_version: 4
|
78
82
|
summary: Native launcher for JRuby
|
79
83
|
test_files: []
|