rake-compiler / rake-compiler-dock

Easy to use and reliable cross compiler environment for building Windows, Linux, Mac and JRuby binary gems.
MIT License
77 stars 30 forks source link

Default configuration for JRuby results in extra invocation #50

Closed JasonLunn closed 3 years ago

JasonLunn commented 3 years ago

Examples for JRuby usage that appear in the documentation result in an extra execution of the underlying docker command if the :rubyvm is set to :jruby. To reproduce, use the following trivial Rakefile:

require 'rake_compiler_dock'

task :foo do
  RakeCompilerDock.sh "echo $$", rubyvm: :jruby
end

rake foo will result in output similar to the following (your process numbers will vary):

rake-compiler-dock bash -c "echo $$"
315
rake-compiler-dock bash -c "echo $$"
316

The root cause is the default value ("x86-mingw32 x64-mingw32") of the :platform argument (defined in starter.rb). This default doesn't make sense for JRuby.

The workaround is to pass an arbitrary single-world value for :platform as a parameter to the invocation, e.g.:

require 'rake_compiler_dock'

task :foo do
  RakeCompilerDock.sh "echo $$", rubyvm: :jruby, platform: 'anything'
end

The fix will be to change the default value of :platform when the RubyVM is jruby.