Skip to content

Commit 5748952

Browse files
prashantvithanipitr-ch
authored andcommitted
Add latest JRuby version with JDK-11
1 parent 34f487b commit 5748952

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

.travis.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ matrix:
99
include:
1010
- name: MRI 2.5.1 Latest
1111
rvm: 2.5.1
12-
- name: JRuby 9.2.0.0 Latest
13-
rvm: jruby-9.2.0.0
12+
- name: JRuby 9.2.4.1 Latest on Java 11
13+
rvm: jruby-9.2.4.1
14+
jdk: oraclejdk11
15+
- name: JRuby 9.2.4.1 Latest on Java 8
16+
rvm: jruby-9.2.4.1
1417
jdk: oraclejdk8
1518
- name: TruffleRuby Latest
1619
rvm: system

Rakefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,29 @@ JRUBY_JAR_PATH = '/usr/local/opt/rbenv/versions/jruby-9.1.17.0/lib/jruby.jar'
2323
class ConcurrentRubyJavaExtensionTask < Rake::JavaExtensionTask
2424
def java_classpath_arg(*args)
2525
jruby_cpath = nil
26+
2627
if RUBY_PLATFORM =~ /java/
2728
begin
2829
cpath = Java::java.lang.System.getProperty('java.class.path').split(File::PATH_SEPARATOR)
2930
cpath += Java::java.lang.System.getProperty('sun.boot.class.path').split(File::PATH_SEPARATOR)
3031
jruby_cpath = cpath.compact.join(File::PATH_SEPARATOR)
3132
rescue => e
3233
end
34+
35+
unless jruby_cpath
36+
libdir = RbConfig::CONFIG['libdir']
37+
if libdir.start_with? "classpath:"
38+
raise 'Cannot build with jruby-complete'
39+
end
40+
jruby_cpath = File.join(libdir, "jruby.jar")
41+
end
3342
end
43+
3444
unless jruby_cpath
3545
jruby_cpath = JRUBY_JAR_PATH
3646
raise "#{jruby_cpath} does not exist" unless File.exist? jruby_cpath
3747
end
48+
3849
jruby_cpath += File::PATH_SEPARATOR + args.join(File::PATH_SEPARATOR) unless args.empty?
3950
jruby_cpath ? "-cp \"#{jruby_cpath}\"" : ""
4051
end

spec/concurrent/synchronization_spec.rb

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,20 @@ def ns_initialize
181181

182182
specify 'final field always visible' do
183183
store = BClass.new 'asd'
184-
t1 = in_thread { 1000000000.times { |i| store = BClass.new i.to_s } }
185-
t2 = in_thread { 10.times { expect(store.final).not_to be_nil; Thread.pass } }
186-
t2.join
187-
t1.kill
184+
done = CountDownLatch.new
185+
in_thread do
186+
1000000000.times do |i|
187+
store = BClass.new i.to_s
188+
break if done.count == 0
189+
end
190+
end
191+
in_thread do
192+
10.times do
193+
expect(store.final).not_to be_nil
194+
Thread.pass
195+
end
196+
done.count_down
197+
end
188198
end
189199

190200
let(:store) { BClass.new }

0 commit comments

Comments
 (0)