Skip to content

Commit

Permalink
Build the extension library only when CRuby (Fix #69)
Browse files Browse the repository at this point in the history
On JRuby no C compiler is available and this call results in a runtime
error.
  • Loading branch information
nobu committed Dec 10, 2024
1 parent c5e8246 commit 33105bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
require "bundler/gem_tasks"
require "rake/testtask"
require "ruby-core/extensiontask"

helper = Bundler::GemHelper.instance
extask = RubyCore::ExtensionTask.new(helper.gemspec)
task :test => :compile
if RUBY_ENGINE == "ruby"
require "ruby-core/extensiontask"
helper = Bundler::GemHelper.instance
extask = RubyCore::ExtensionTask.new(helper.gemspec)
task :test => :compile
end

Rake::TestTask.new(:test) do |t|
t.libs.unshift(*extask.libs)
t.libs.unshift(*extask.libs) if extask
t.libs << "test/lib"
t.ruby_opts << "-rhelper"
t.test_files = FileList["test/**/test_*.rb"]
Expand Down
2 changes: 1 addition & 1 deletion ext/win32/resolv/extconf.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'mkmf'
if have_library('iphlpapi', 'GetNetworkParams')
if RUBY_ENGINE == "ruby" and have_library('iphlpapi', 'GetNetworkParams')
create_makefile('win32/resolv')
else
File.write('Makefile', "all clean install:\n\t@echo Done: $(@)\n")
Expand Down

0 comments on commit 33105bc

Please sign in to comment.