diff --git a/Rakefile b/Rakefile index 7d2c84a272d..65c7f386439 100644 --- a/Rakefile +++ b/Rakefile @@ -5,11 +5,13 @@ require "rake/extensiontask" require "rake/testtask" require "rake/clean" require "rdoc/task" -require "ruby_memcheck" Rake.add_rakelib("tasks") -RubyMemcheck.config(binary_name: "yarp") +if RUBY_ENGINE != "jruby" + require "ruby_memcheck" + RubyMemcheck.config(binary_name: "yarp") +end task compile: :make task compile_no_debug: :make_no_debug @@ -61,11 +63,26 @@ task build: [:templates, :check_manifest] # the C extension task "compile:yarp" => ["configure", "templates"] # must be before the ExtensionTask is created -Rake::ExtensionTask.new(:compile) do |ext| - ext.name = "yarp" - ext.ext_dir = "ext/yarp" - ext.lib_dir = "lib" - ext.gem_spec = Gem::Specification.load("yarp.gemspec") + +if RUBY_ENGINE == 'jruby' + require 'rake/javaextensiontask' + + # This compiles java to make sure any templating changes produces valid code. + Rake::JavaExtensionTask.new(:compile) do |ext| + ext.name = "yarp" + ext.ext_dir = "java" + ext.lib_dir = "tmp" + ext.source_version = "1.8" + ext.target_version = "1.8" + ext.gem_spec = Gem::Specification.load("yarp.gemspec") + end +else + Rake::ExtensionTask.new(:compile) do |ext| + ext.name = "yarp" + ext.ext_dir = "ext/yarp" + ext.lib_dir = "lib" + ext.gem_spec = Gem::Specification.load("yarp.gemspec") + end end # So `rake clobber` will delete generated files diff --git a/tasks/test.rake b/tasks/test.rake index 76403a1b3ac..fcabaed581a 100644 --- a/tasks/test.rake +++ b/tasks/test.rake @@ -21,17 +21,19 @@ class LldbTestTask < Rake::TestTask end namespace :test do - RubyMemcheck::TestTask.new(valgrind_internal: :compile, &test_config) - Rake::Task['test:valgrind_internal'].clear_comments # Hide test:valgrind_internal from rake -T + if RUBY_ENGINE != "jruby" + RubyMemcheck::TestTask.new(valgrind_internal: :compile, &test_config) + Rake::Task['test:valgrind_internal'].clear_comments # Hide test:valgrind_internal from rake -T + + desc "Run tests under valgrind" + task :valgrind do + # Recompile with YARP_DEBUG_MODE_BUILD=1 + ENV['YARP_DEBUG_MODE_BUILD'] = '1' + Rake::Task['clobber'].invoke + Rake::Task['test:valgrind_internal'].invoke + end - desc "Run tests under valgrind" - task :valgrind do - # Recompile with YARP_DEBUG_MODE_BUILD=1 - ENV['YARP_DEBUG_MODE_BUILD'] = '1' - Rake::Task['clobber'].invoke - Rake::Task['test:valgrind_internal'].invoke + GdbTestTask.new(gdb: :compile, &test_config) + LldbTestTask.new(lldb: :compile, &test_config) end - - GdbTestTask.new(gdb: :compile, &test_config) - LldbTestTask.new(lldb: :compile, &test_config) end