[ruby/digest] jruby support
https://github.com/ruby/digest/commit/2e9dc14693
This commit is contained in:
parent
ff1f696d30
commit
94882df3a2
9
ext/digest/bubblebabble/lib/bubblebabble.rb
Normal file
9
ext/digest/bubblebabble/lib/bubblebabble.rb
Normal file
@ -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
|
@ -10,7 +10,11 @@ Gem::Specification.new do |spec|
|
|||||||
spec.summary = %q{Provides a framework for message digest libraries.}
|
spec.summary = %q{Provides a framework for message digest libraries.}
|
||||||
spec.description = %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.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 = [
|
spec.files = [
|
||||||
"LICENSE.txt", "README.md",
|
"LICENSE.txt", "README.md",
|
||||||
@ -46,13 +50,27 @@ Gem::Specification.new do |spec|
|
|||||||
spec.bindir = "exe"
|
spec.bindir = "exe"
|
||||||
spec.executables = []
|
spec.executables = []
|
||||||
spec.require_paths = ["lib"]
|
spec.require_paths = ["lib"]
|
||||||
spec.extensions = %w[
|
|
||||||
ext/digest/extconf.rb
|
if Gem::Platform === spec.platform and spec.platform =~ 'java' or RUBY_ENGINE == 'jruby'
|
||||||
ext/digest/bubblebabble/extconf.rb
|
spec.platform = 'java'
|
||||||
ext/digest/md5/extconf.rb
|
spec.files.concat [
|
||||||
ext/digest/rmd160/extconf.rb
|
"lib/digest.jar",
|
||||||
ext/digest/sha1/extconf.rb
|
"lib/digest/md5.rb",
|
||||||
ext/digest/sha2/extconf.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"
|
spec.metadata["msys2_mingw_dependencies"] = "openssl"
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
# frozen_string_literal: false
|
# 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
|
module Digest
|
||||||
# A mutex for Digest().
|
# A mutex for Digest().
|
||||||
@ -8,7 +12,7 @@ module Digest
|
|||||||
def self.const_missing(name) # :nodoc:
|
def self.const_missing(name) # :nodoc:
|
||||||
case name
|
case name
|
||||||
when :SHA256, :SHA384, :SHA512
|
when :SHA256, :SHA384, :SHA512
|
||||||
lib = 'digest/sha2.so'
|
lib = 'digest/sha2'
|
||||||
else
|
else
|
||||||
lib = File.join('digest', name.to_s.downcase)
|
lib = File.join('digest', name.to_s.downcase)
|
||||||
end
|
end
|
||||||
|
9
ext/digest/md5/lib/md5.rb
Normal file
9
ext/digest/md5/lib/md5.rb
Normal file
@ -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
|
9
ext/digest/rmd160/lib/rmd160.rb
Normal file
9
ext/digest/rmd160/lib/rmd160.rb
Normal file
@ -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
|
9
ext/digest/sha1/lib/sha1.rb
Normal file
9
ext/digest/sha1/lib/sha1.rb
Normal file
@ -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
|
@ -11,7 +11,12 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
require 'digest'
|
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
|
module Digest
|
||||||
#
|
#
|
||||||
|
@ -270,6 +270,7 @@ BEGIN {
|
|||||||
eom
|
eom
|
||||||
args = args.dup
|
args = args.dup
|
||||||
args.insert((Hash === args.first ? 1 : 0), "-w", "--disable=gems", *$:.map {|l| "-I#{l}"})
|
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)
|
stdout, stderr, status = EnvUtil.invoke_ruby(args, src, capture_stdout, true, **opt)
|
||||||
ensure
|
ensure
|
||||||
if res_c
|
if res_c
|
||||||
|
Loading…
x
Reference in New Issue
Block a user