Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow JRuby to run Rake #1170

Merged
merged 1 commit into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
24 changes: 13 additions & 11 deletions tasks/test.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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