Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Warn only once.

Reduce to only one the display of warnings about usage
of ExtensionTask or JavaExtensionTask in mixed environments.
  • Loading branch information...
commit f729a4bcd7ecbb4b45cc77b60625779ffedfabd4 1 parent e84b76c
@luislavena luislavena authored
View
7 lib/rake/baseextensiontask.rb
@@ -69,5 +69,12 @@ def binary(platform = nil)
def source_files
@source_files ||= FileList["#{@ext_dir}/#{@source_pattern}"]
end
+
+ def warn_once(message)
+ @@already_warned ||= false
+ return if @@already_warned
+ @@already_warned = true
+ warn message
+ end
end
end
View
2  lib/rake/extensiontask.rb
@@ -34,7 +34,7 @@ def cross_compiling(&block)
def define
if RUBY_PLATFORM == 'java' || (defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ironruby')
- warn <<-EOF
+ warn_once <<-EOF
WARNING: You're attempting to (cross-)compile C extensions from a platform
(#{RUBY_ENGINE}) that does not support native extensions or mkmf.rb.
Rerun `rake` under MRI Ruby 1.8.x/1.9.x to cross/native compile.
View
2  lib/rake/javaextensiontask.rb
@@ -65,7 +65,7 @@ def define_compile_tasks(for_platform = nil, ruby_ver = RUBY_VERSION)
execute the Rake compilation task using the JRuby interpreter.
(e.g. `jruby -S rake compile:java`)
EOF
- warn(not_jruby_compile_msg) unless defined?(JRUBY_VERSION)
+ warn_once(not_jruby_compile_msg) unless defined?(JRUBY_VERSION)
file "#{tmp_path}/#{binary(platf)}" => "#{tmp_path}/.build" do
sh "jar cf #{tmp_path}/#{binary(platf)} -C #{tmp_path} ."

0 comments on commit f729a4b

Please sign in to comment.
Something went wrong with that request. Please try again.