Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Emit JRuby cross-compile warnings only when actually doing cross-comp…

…iles.
  • Loading branch information...
commit a1a9979e147a68c118051532ae3732edf4760d96 1 parent 83d8702
@jfirebaugh authored
Showing with 15 additions and 13 deletions.
  1. +6 −4 lib/rake/extensiontask.rb
  2. +9 −9 lib/rake/javaextensiontask.rb
View
10 lib/rake/extensiontask.rb
@@ -38,10 +38,6 @@ def cross_compiling(&block)
def binary(platform = nil)
if platform == "java"
- warn_once <<-EOF
-Compiling a native C extension on JRuby. This is discouraged and a
-Java extension should be preferred.
- EOF
"#{name}.#{RbConfig::MAKEFILE_CONFIG['DLEXT']}"
else
super
@@ -106,6 +102,12 @@ def define_compile_tasks(for_platform = nil, ruby_ver = RUBY_VERSION)
# binary in temporary folder depends on makefile and source files
# tmp/extension_name/extension_name.{so,bundle}
file "#{tmp_path}/#{binary(platf)}" => ["#{tmp_path}/Makefile"] + source_files do
+ jruby_compile_msg = <<-EOF
+Compiling a native C extension on JRuby. This is discouraged and a
+Java extension should be preferred.
+ EOF
+ warn_once(jruby_compile_msg) if defined?(JRUBY_VERSION)
+
chdir tmp_path do
sh make
end
View
18 lib/rake/javaextensiontask.rb
@@ -67,15 +67,6 @@ def define_compile_tasks(for_platform = nil, ruby_ver = RUBY_VERSION)
install "#{tmp_path}/#{binary(platf)}", "#{lib_path}/#{binary(platf)}"
end
- not_jruby_compile_msg = <<-EOF
-WARNING: You're cross-compiling a binary extension for JRuby, but are using
-another interpreter. If your Java classpath or extension dir settings are not
-correctly detected, then either check the appropriate environment variables or
-execute the Rake compilation task using the JRuby interpreter.
-(e.g. `jruby -S rake compile:java`)
- EOF
- warn_once(not_jruby_compile_msg) unless defined?(JRUBY_VERSION)
-
file "#{tmp_path}/#{binary(platf)}" => "#{tmp_path}/.build" do
class_files = FileList["#{tmp_path}/**/*.class"].
@@ -92,6 +83,15 @@ def define_compile_tasks(for_platform = nil, ruby_ver = RUBY_VERSION)
end
file "#{tmp_path}/.build" => [tmp_path] + source_files do
+ not_jruby_compile_msg = <<-EOF
+WARNING: You're cross-compiling a binary extension for JRuby, but are using
+another interpreter. If your Java classpath or extension dir settings are not
+correctly detected, then either check the appropriate environment variables or
+execute the Rake compilation task using the JRuby interpreter.
+(e.g. `jruby -S rake compile:java`)
+ EOF
+ warn_once(not_jruby_compile_msg) unless defined?(JRUBY_VERSION)
+
classpath_arg = java_classpath_arg(@classpath)
debug_arg = @debug ? '-g' : ''
Please sign in to comment.
Something went wrong with that request. Please try again.