You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/dev-ruby/rcov/files/rcov-0.9.7.1-jruby.patch

49 lines
1.8 KiB

From b2eaa10033e12ebc17542f0c16065519454a6a6b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Diego=20Elio=20'Flameeyes'=20Petten=C3=B2?= <flameeyes@gmail.com>
Date: Thu, 14 Jan 2010 20:15:29 +0100
Subject: [PATCH] Use hpricot's classpath argument function to set the classpath.
This solves problems of building the rcovrt.jar file with JRuby from Gentoo
Linux.
---
Rakefile | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/Rakefile b/Rakefile
index 6cb27f0..7157a1c 100644
--- a/Rakefile
+++ b/Rakefile
@@ -41,6 +41,20 @@ end
desc "Run the unit tests with rcovrt."
if RUBY_PLATFORM == 'java'
+ def java_classpath_arg # myriad of ways to discover JRuby classpath
+ begin
+ cpath = Java::java.lang.System.getProperty('java.class.path').split(File::PATH_SEPARATOR)
+ cpath += Java::java.lang.System.getProperty('sun.boot.class.path').split(File::PATH_SEPARATOR)
+ jruby_cpath = cpath.compact.join(File::PATH_SEPARATOR)
+ rescue => e
+ end
+ unless jruby_cpath
+ jruby_cpath = ENV['JRUBY_PARENT_CLASSPATH'] || ENV['JRUBY_HOME'] &&
+ FileList["#{ENV['JRUBY_HOME']}/lib/*.jar"].join(File::PATH_SEPARATOR)
+ end
+ jruby_cpath ? "-cp \"#{jruby_cpath}\"" : ""
+ end
+
Rake::TestTask.new(:test_rcovrt => ["lib/rcovrt.jar"]) do |t|
t.libs << "lib"
t.ruby_opts << "--debug"
@@ -51,7 +65,7 @@ if RUBY_PLATFORM == 'java'
file "lib/rcovrt.jar" => FileList["ext/java/**/*.java"] do |t|
rm_f "lib/rcovrt.jar"
mkdir_p "pkg/classes"
- sh "javac -classpath #{Java::JavaLang::System.getProperty('java.class.path')} -d pkg/classes #{t.prerequisites.join(' ')}"
+ sh "javac #{java_classpath_arg} -d pkg/classes #{t.prerequisites.join(' ')}"
sh "jar cf #{t.name} -C pkg/classes ."
end
else
--
1.6.6