diff options
-rw-r--r-- | ext/digest/bubblebabble/lib/bubblebabble.rb | 9 | ||||
-rw-r--r-- | ext/digest/digest.gemspec | 36 | ||||
-rw-r--r-- | ext/digest/lib/digest.rb | 8 | ||||
-rw-r--r-- | ext/digest/md5/lib/md5.rb | 9 | ||||
-rw-r--r-- | ext/digest/rmd160/lib/rmd160.rb | 9 | ||||
-rw-r--r-- | ext/digest/sha1/lib/sha1.rb | 9 | ||||
-rw-r--r-- | ext/digest/sha2/lib/sha2.rb | 7 | ||||
-rw-r--r-- | tool/lib/core_assertions.rb | 1 |
8 files changed, 76 insertions, 12 deletions
diff --git a/ext/digest/bubblebabble/lib/bubblebabble.rb b/ext/digest/bubblebabble/lib/bubblebabble.rb new file mode 100644 index 0000000000..8ad06c7740 --- /dev/null +++ b/ext/digest/bubblebabble/lib/bubblebabble.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: false + +require 'digest' + +if RUBY_ENGINE == 'jruby' + JRuby::Util.load_ext("org.jruby.ext.digest.BubbleBabble") +else + require 'digest/bubblebabble.so' +end diff --git a/ext/digest/digest.gemspec b/ext/digest/digest.gemspec index 381df92761..a6c6f159bb 100644 --- a/ext/digest/digest.gemspec +++ b/ext/digest/digest.gemspec @@ -10,7 +10,11 @@ Gem::Specification.new do |spec| spec.summary = %q{Provides a framework for message digest libraries.} spec.description = %q{Provides a framework for message digest libraries.} spec.homepage = "https://github.com/ruby/digest" - spec.licenses = ["Ruby", "BSD-2-Clause"] + if Gem::Platform === spec.platform and spec.platform =~ 'java' or RUBY_ENGINE == 'jruby' + spec.licenses = ["Ruby", "BSD-2-Clause", "EPL-2.0", "GPL-2.0", "LGPL-2.1"] + else + spec.licenses = ["Ruby", "BSD-2-Clause"] + end spec.files = [ "LICENSE.txt", "README.md", @@ -46,13 +50,27 @@ Gem::Specification.new do |spec| spec.bindir = "exe" spec.executables = [] spec.require_paths = ["lib"] - spec.extensions = %w[ - ext/digest/extconf.rb - ext/digest/bubblebabble/extconf.rb - ext/digest/md5/extconf.rb - ext/digest/rmd160/extconf.rb - ext/digest/sha1/extconf.rb - ext/digest/sha2/extconf.rb - ] + + if Gem::Platform === spec.platform and spec.platform =~ 'java' or RUBY_ENGINE == 'jruby' + spec.platform = 'java' + spec.files.concat [ + "lib/digest.jar", + "lib/digest/md5.rb", + "lib/digest/sha1.rb", + "lib/digest/sha2.rb", + "lib/digest/rmd160.rb", + "lib/digest/bubblebabble.rb" + ] + else + spec.extensions = %w[ + ext/digest/extconf.rb + ext/digest/bubblebabble/extconf.rb + ext/digest/md5/extconf.rb + ext/digest/rmd160/extconf.rb + ext/digest/sha1/extconf.rb + ext/digest/sha2/extconf.rb + ] + end + spec.metadata["msys2_mingw_dependencies"] = "openssl" end diff --git a/ext/digest/lib/digest.rb b/ext/digest/lib/digest.rb index ba0637af32..912198811b 100644 --- a/ext/digest/lib/digest.rb +++ b/ext/digest/lib/digest.rb @@ -1,5 +1,9 @@ # frozen_string_literal: false -require 'digest.so' +if RUBY_ENGINE == 'jruby' + JRuby::Util.load_ext("org.jruby.ext.digest.DigestLibrary") +else + require 'digest.so' +end module Digest # A mutex for Digest(). @@ -8,7 +12,7 @@ module Digest def self.const_missing(name) # :nodoc: case name when :SHA256, :SHA384, :SHA512 - lib = 'digest/sha2.so' + lib = 'digest/sha2' else lib = File.join('digest', name.to_s.downcase) end diff --git a/ext/digest/md5/lib/md5.rb b/ext/digest/md5/lib/md5.rb new file mode 100644 index 0000000000..3748f9d187 --- /dev/null +++ b/ext/digest/md5/lib/md5.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: false + +require 'digest' + +if RUBY_ENGINE == 'jruby' + JRuby::Util.load_ext("org.jruby.ext.digest.MD5") +else + require 'digest/md5.so' +end diff --git a/ext/digest/rmd160/lib/rmd160.rb b/ext/digest/rmd160/lib/rmd160.rb new file mode 100644 index 0000000000..eabb92a496 --- /dev/null +++ b/ext/digest/rmd160/lib/rmd160.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: false + +require 'digest' + +if RUBY_ENGINE == 'jruby' + JRuby::Util.load_ext("org.jruby.ext.digest.RMD160") +else + require 'digest/rmd160.so' +end diff --git a/ext/digest/sha1/lib/sha1.rb b/ext/digest/sha1/lib/sha1.rb new file mode 100644 index 0000000000..864997b1f6 --- /dev/null +++ b/ext/digest/sha1/lib/sha1.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: false + +require 'digest' + +if RUBY_ENGINE == 'jruby' + JRuby::Util.load_ext("org.jruby.ext.digest.SHA1") +else + require 'digest/sha1.so' +end diff --git a/ext/digest/sha2/lib/sha2.rb b/ext/digest/sha2/lib/sha2.rb index 61a0734850..22e099768c 100644 --- a/ext/digest/sha2/lib/sha2.rb +++ b/ext/digest/sha2/lib/sha2.rb @@ -11,7 +11,12 @@ # $Id$ require 'digest' -require 'digest/sha2.so' + +if RUBY_ENGINE == 'jruby' + JRuby::Util.load_ext("org.jruby.ext.digest.SHA2") +else + require 'digest/sha2.so' +end module Digest # diff --git a/tool/lib/core_assertions.rb b/tool/lib/core_assertions.rb index 6769ee7a91..47d711f4fa 100644 --- a/tool/lib/core_assertions.rb +++ b/tool/lib/core_assertions.rb @@ -270,6 +270,7 @@ BEGIN { eom args = args.dup args.insert((Hash === args.first ? 1 : 0), "-w", "--disable=gems", *$:.map {|l| "-I#{l}"}) + args << "--debug" if RUBY_ENGINE == 'jruby' # warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag stdout, stderr, status = EnvUtil.invoke_ruby(args, src, capture_stdout, true, **opt) ensure if res_c |