Permalink
Browse files

wrap in a LoadError

  • Loading branch information...
1 parent 81bc2d3 commit 60389433719d0282d80ff7bb40282630c0ddd3f0 @copiousfreetime committed Feb 9, 2013
Showing with 22 additions and 18 deletions.
  1. +22 −18 tasks/extension.rake
View
40 tasks/extension.rake
@@ -4,31 +4,35 @@
# spec.add_development_dependency( 'rake-compiler', '~> 0.8.1' )
#
# in your top level rakefile
-require 'rake/extensiontask'
-require 'rake/javaextensiontask'
+begin
+ require 'rake/extensiontask'
+ require 'rake/javaextensiontask'
-if RUBY_PLATFORM == "java" then
+ if RUBY_PLATFORM == "java" then
- Rake::JavaExtensionTask.new( This.name) do |ext|
- ext.ext_dir = File.join( 'ext', This.name, "java" )
- ext.lib_dir = File.join( 'lib', This.name )
- ext.gem_spec = This.java_gemspec
- end
+ Rake::JavaExtensionTask.new( This.name) do |ext|
+ ext.ext_dir = File.join( 'ext', This.name, "java" )
+ ext.lib_dir = File.join( 'lib', This.name )
+ ext.gem_spec = This.java_gemspec
+ end
+
+ else
-else
+ Rake::ExtensionTask.new( This.name ) do |ext|
+ ext.ext_dir = File.join( 'ext', This.name, "c" )
+ ext.lib_dir = File.join( 'lib', This.name )
+ ext.gem_spec = This.ruby_gemspec
- Rake::ExtensionTask.new( This.name ) do |ext|
- ext.ext_dir = File.join( 'ext', This.name, "c" )
- ext.lib_dir = File.join( 'lib', This.name )
- ext.gem_spec = This.ruby_gemspec
-
- ext.cross_compile = true # enable cross compilation (requires cross compile toolchain)
- ext.cross_platform = 'i386-mswin32' # forces the Windows platform instead of the default one
- # configure options only for cross compile
+ ext.cross_compile = true # enable cross compilation (requires cross compile toolchain)
+ ext.cross_platform = 'i386-mswin32' # forces the Windows platform instead of the default one
+ # configure options only for cross compile
+ end
end
+ task :test_requirements => :compile
+rescue LoadError
+ This.task_warning( 'extension' )
end
CLOBBER << FileList["lib/**/*.{jar,so,bundle}"]
CLOBBER << FileList["lib/#{This.name}/1.{8,9}/"]
-task :test_requirements => :compile

0 comments on commit 6038943

Please sign in to comment.