Closed kou closed 1 month ago
This is based on GH-147. So we should not merge this before GH-147.
I changed the target branch so this PR shows the relevant diff.
I've added truflleruby-20
and truffleruby-21
because:
ruby/setup-ruby
don't provide them for macos-14
and ubuntu-24.04
:
https://github.com/ruby/fiddle/actions/runs/11137969090/job/30952238981?pr=148#step:3:17
Error: Error: Unavailable version 20.3.0 for truffleruby on macos-14
https://github.com/ruby/fiddle/actions/runs/11137969090/job/30952239103?pr=148#step:3:17
Error: Error: Unavailable version 21.3.0 for truffleruby on macos-14
https://github.com/ruby/fiddle/actions/runs/11137969090/job/30952240601?pr=148#step:3:14
Error: Error: Unavailable version 20.3.0 for truffleruby on ubuntu-24.04
https://github.com/ruby/fiddle/actions/runs/11137969090/job/30952240753?pr=148#step:3:14
Error: Error: Unavailable version 21.3.0 for truffleruby on ubuntu-24.04
truffleruby-20
on macos-12
doesn't work because it doesn't work with recent Bundler:
https://github.com/ruby/fiddle/actions/runs/11137969090/job/30952235259?pr=148#step:3:27
Using latest Bundler for truffleruby-20.3.0 because the default Bundler gem is too old for that Ruby version
Ruby 2.6-2.7 only works with Bundler 2.4
/Users/runner/.rubies/truffleruby-20.3.0/bin/gem install bundler --force -v ~> 2.4.0
truffleruby-21
on macos-12
doesn't work because of internal Bundler error:
https://github.com/ruby/fiddle/actions/runs/11137969090/job/30952235963?pr=148#step:4:10
NameError: method `search_by_dependency' not defined in Bundler::Index
Should we really care about old TruffleRuby releases?
I've added truffleruby-20 and truffleruby-21 because:
The versions at https://www.graalvm.org/release-calendar/#previous-releases are very confusing unfortunately, as they use Java versions, while Truffle/TruffleRuby versions use the year. So truffleruby-20 and truffleruby-21 are ancient, from 2020 and 2021.
The current GraalVM LTS is GraalVM for JDK 21, which corresponds to TruffleRuby 23.1.0. So it might make sense to test that and/or 24.0 as well.
I think we should solve it for all existing TruffleRuby releases if possible and #146 is one way to do that. This PR is unlikely to work on older releases, and might not even work on the latest release, once we avoid depending on internal & changing APIs.
We use #149 instead of this.
Fix GH-145
lib/fiddle/truffleruby.rb is based on https://github.com/oracle/truffleruby/blob/master/lib/truffle/truffle/fiddle_backend.rb .
Here are changes for it:
Fiddle::Types::VARIADIC
Fiddle::Types::CONST_STRING
Fiddle::Types::BOOL
Fiddle::ALIGN_BOOL
Fiddle::SIZEOF_BOOL
Fiddle::SIZEOF_CONST_STRING
Fiddle::Types::*
but alsoSymbol
like:int
Fiddle::Error
as base the error classFiddle::Pointer.malloc {}
Fiddle::Pointer
Fiddle.free(#to_int)
Fiddle::Function(need_gvl:)
but it's just ignoredFiddle::Function#initialize
: Add an argument validationFiddle::Function#initialize
: Keep arguments as instance variables for gettersFiddle::Handle.sym
Fiddle::Handle.[]
Fiddle::Handle.sym_defined?
Fiddle::Handle#sym
Fiddle::Handle#[]
Fiddle::Handle#sym_defined?
Fiddle::Pointer.malloc
Fiddle::Pointer.to_ptr(#to_ptr)
Fiddle::Pointer#free=
Fiddle::Pointer#freed?
Fiddle::Pointer#call_free
Fiddle::Pointer#to_i
Fiddle::Pointer#to_int
Fiddle::Pointer#ptr
Fiddle::Pointer#+@
Fiddle::Pointer#ref
Fiddle::Pointer#-@
Fiddle::Pointer#null?
Fiddle::Pointer#to_s
Fiddle::Pointer#to_str
Fiddle::Pointer#inspect
Fiddle::Pointer#<=>
Fiddle::Pointer#==
Fiddle::Pointer#eql?
Fiddle::Pointer#+
Fiddle::Pointer#-
Fiddle::Pointer#[]=
Fiddle::Pointer#size
Fiddle::Pointer#size=
Fiddle::ClearedReferenceError
Fiddle::Pinned
Fiddle::NULL
Some features are still "not implemented". So there are some "omit"s for TruffleRuby in tests.