Skip to content

Commit

Permalink
Add simple_compile task to Rakefile, make default
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Coles <alex@alexbcoles.com>
  • Loading branch information
myabc committed Apr 7, 2012
1 parent 41a7378 commit 8451006
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions Rakefile
@@ -1,7 +1,6 @@
require 'rubygems'
require 'rake'
require 'date'
require 'rake/javaextensiontask'

#############################################################################
#
Expand Down Expand Up @@ -150,8 +149,25 @@ task :validate do
end
end

begin
require 'rake/javaextensiontask'

Rake::JavaExtensionTask.new('test_jruby_library', eval(File.read(gemspec_file))) do |ext|
ext.lib_dir = "lib/jrubytesting"
ext.ext_dir = 'ext/java'
Rake::JavaExtensionTask.new('test_jruby_library', eval(File.read(gemspec_file))) do |ext|
ext.lib_dir = "lib/jrubytesting"
ext.ext_dir = 'ext/java'
end
rescue LoadError
end

task :simple_compile do
# Pick the right class path, depending if we're using an rvm installed JRuby
jruby_cpath = ENV['MY_RUBY_HOME'] || ENV['JRUBY_HOME']
raise 'MY_RUBY_HOME or JRUBY_HOME are not set' unless jruby_cpath

puts 'Doing a simple compilation'
sh %(javac -source 1.6 -target 1.6 -cp #{jruby_cpath}/lib/jruby.jar ext/java/**/*.java)
mkdir_p 'lib/jrubytesting'
sh %(jar cf lib/jrubytesting/test_jruby_library.jar -C ext/java jrubytesting/TestJrubyLibraryService.class)
puts
end
task :default => :simple_compile

0 comments on commit 8451006

Please sign in to comment.