Skip to content

Commit

Permalink
Skip building on TruffleRuby
Browse files Browse the repository at this point in the history
  • Loading branch information
andrykonchin committed Sep 17, 2024
1 parent aad5a3b commit 1d2a34b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
11 changes: 8 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ namespace :version do
end
end

require 'rake/extensiontask'
Rake::ExtensionTask.new("fiddle")
Rake::ExtensionTask.new("-test-/memory_view")

if RUBY_ENGINE == 'ruby'
require 'rake/extensiontask'
Rake::ExtensionTask.new("fiddle")
Rake::ExtensionTask.new("-test-/memory_view")
else
task :compile
end

task :default => [:compile, :test]
6 changes: 6 additions & 0 deletions ext/fiddle/extconf.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# frozen_string_literal: true

if RUBY_ENGINE != 'ruby'
File.write('Makefile', dummy_makefile("").join)
return
end

require 'mkmf'

# :stopdoc:
Expand Down
8 changes: 7 additions & 1 deletion lib/fiddle.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# frozen_string_literal: true

require 'fiddle.so'
if RUBY_ENGINE == "ruby"
require 'fiddle.so'
else
$LOAD_PATH.delete(__dir__)
require 'fiddle' # load from stdlib
end

require 'fiddle/closure'
require 'fiddle/function'
require 'fiddle/version'
Expand Down
4 changes: 2 additions & 2 deletions test/run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
$VERBOSE = true

source_dir = "#{__dir__}/.."
$LOAD_PATH.unshift("#{source_dir}/test")
$LOAD_PATH.unshift("#{source_dir}/lib")
$LOAD_PATH.unshift(File.expand_path("#{source_dir}/test"))
$LOAD_PATH.unshift(File.expand_path("#{source_dir}/lib"))

build_dir = Dir.pwd
if File.exist?("#{build_dir}/fiddle.so")
Expand Down

0 comments on commit 1d2a34b

Please sign in to comment.