Drop C extension requirement from JRuby

This commit is contained in:
Takashi Kokubun 2018-11-01 14:45:51 +09:00
parent df4243311a
commit 3d24ea4524
4 changed files with 30 additions and 10 deletions

View File

@ -17,7 +17,22 @@ if Gem.win_platform?
end
require 'rake/testtask'
require 'rake/extensiontask'
if /java/ === RUBY_PLATFORM
# require 'rake/javaextensiontask'
# Rake::JavaExtensionTask.new(:hamlit) do |ext|
# ext.ext_dir = 'ext/java'
# ext.lib_dir = 'lib/hamlit'
# end
task :compile do
# dummy for now
end
else
require 'rake/extensiontask'
Rake::ExtensionTask.new(:hamlit) do |ext|
ext.lib_dir = 'lib/hamlit'
end
end
Dir['benchmark/*.rake'].each { |b| import(b) }
@ -88,10 +103,6 @@ namespace :test do
end
end
Rake::ExtensionTask.new(:hamlit) do |ext|
ext.lib_dir = 'lib/hamlit'
end
desc 'bench task for CI'
task bench: :compile do
if ENV['SLIM_BENCH'] == '1'

View File

@ -17,9 +17,14 @@ Gem::Specification.new do |spec|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|sample)/}) }
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.extensions = ['ext/hamlit/extconf.rb']
spec.require_paths = ['lib']
spec.required_ruby_version = '>= 2.1.0'
if /java/ === RUBY_PLATFORM
# spec.platform = 'java'
else
spec.extensions = ['ext/hamlit/extconf.rb']
spec.required_ruby_version = '>= 2.1.0'
end
spec.add_dependency 'temple', '>= 0.8.0'
spec.add_dependency 'thor'

View File

@ -1,7 +1,9 @@
# frozen_string_literal: true
require 'hamlit/hamlit'
require 'hamlit/object_ref'
unless /java/ === RUBY_PLATFORM # exclude JRuby
require 'hamlit/hamlit'
end
require 'hamlit/utils'
require 'hamlit/object_ref'
module Hamlit::AttributeBuilder
BOOLEAN_ATTRIBUTES = %w[disabled readonly multiple checked autobuffer

View File

@ -1,5 +1,7 @@
# frozen_string_literal: true
require 'hamlit/hamlit'
unless /java/ === RUBY_PLATFORM # exclude JRuby
require 'hamlit/hamlit' # depends on C-ext defines Hamlit::Utils first for now
end
module Hamlit
module Utils