Skip to content

Commit b42ce32

Browse files
committed
Skip building on TruffleRuby
1 parent aad5a3b commit b42ce32

File tree

4 files changed

+23
-6
lines changed

4 files changed

+23
-6
lines changed

Rakefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@ namespace :version do
1717
end
1818
end
1919

20-
require 'rake/extensiontask'
21-
Rake::ExtensionTask.new("fiddle")
22-
Rake::ExtensionTask.new("-test-/memory_view")
20+
if RUBY_ENGINE == 'ruby'
21+
require 'rake/extensiontask'
22+
Rake::ExtensionTask.new("fiddle")
23+
Rake::ExtensionTask.new("-test-/memory_view")
24+
else
25+
task :compile
26+
end
2327

2428
task :default => [:compile, :test]

ext/fiddle/extconf.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
# frozen_string_literal: true
2+
3+
if RUBY_ENGINE != 'ruby'
4+
File.write('Makefile', dummy_makefile("").join)
5+
return
6+
end
7+
28
require 'mkmf'
39

410
# :stopdoc:

lib/fiddle.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# frozen_string_literal: true
22

3-
require 'fiddle.so'
3+
if RUBY_ENGINE == "ruby"
4+
require 'fiddle.so'
5+
else
6+
$LOAD_PATH.delete(__dir__)
7+
require 'fiddle' # load from stdlib
8+
return
9+
end
10+
411
require 'fiddle/closure'
512
require 'fiddle/function'
613
require 'fiddle/version'

test/run.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
$VERBOSE = true
44

55
source_dir = "#{__dir__}/.."
6-
$LOAD_PATH.unshift("#{source_dir}/test")
7-
$LOAD_PATH.unshift("#{source_dir}/lib")
6+
$LOAD_PATH.unshift(File.expand_path("#{source_dir}/test"))
7+
$LOAD_PATH.unshift(File.expand_path("#{source_dir}/lib"))
88

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

0 commit comments

Comments
 (0)