Skip to content

Commit

Permalink
allow missing devkit
Browse files Browse the repository at this point in the history
As per the comments in the build file, windows does not actually use
any native extension code.

Not sure why the require was added for `devkit`.  In the interest of
compatibility simply guard the require with a rescue for the `LoadError`.

If the Ruby environment was custom built the `devkit` class will not
always be available. In some cases such as more recent builds for
Ruby 3.0.x the devkit can utilize an MSYS2 environment without needing
the `devkit` class.
  • Loading branch information
jmartin-tech authored and ioquatix committed Sep 28, 2021
1 parent 52472a5 commit f68b399
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ext/nio4r/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

# Write a dummy Makefile on Windows because we use the pure Ruby implementation there
if Gem.win_platform?
require "devkit" if RUBY_PLATFORM.include?("mingw")
begin
require "devkit" if RUBY_PLATFORM.include?("mingw")
rescue LoadError => e
end
File.write("Makefile", "all install::\n")
File.write("nio4r_ext.so", "")
exit
Expand Down

0 comments on commit f68b399

Please sign in to comment.