summaryrefslogtreecommitdiff
path: root/lib/rake/extensiontask.rb
diff options
context:
space:
mode:
authorLuis Lavena <luislavena@gmail.com>2011-04-22 19:24:24 -0300
committerLuis Lavena <luislavena@gmail.com>2011-04-22 19:24:24 -0300
commit51a1c3f4b43df199f7b85ba3feb5b17943cb2dd4 (patch)
tree4744a63d6093d9735f0c8adc60ec66b258b84e3c /lib/rake/extensiontask.rb
parent5cfac576aa0e1630717e7887a594feff6409197f (diff)
downloadrake-compiler-51a1c3f4b43df199f7b85ba3feb5b17943cb2dd4.tar.gz
Warn if compiled files exists in extension's source directory. Closes GH-35
Diffstat (limited to 'lib/rake/extensiontask.rb')
-rw-r--r--lib/rake/extensiontask.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/rake/extensiontask.rb b/lib/rake/extensiontask.rb
index e33cc3c..7cbe61b 100644
--- a/lib/rake/extensiontask.rb
+++ b/lib/rake/extensiontask.rb
@@ -19,6 +19,7 @@ module Rake
super
@config_script = 'extconf.rb'
@source_pattern = "*.c"
+ @compiled_pattern = "*.{o,obj,so,bundle,dSYM}"
@cross_compile = false
@cross_config_options = []
@cross_compiling = nil
@@ -58,6 +59,10 @@ Rerun `rake` under MRI Ruby 1.8.x/1.9.x to cross/native compile.
super
+ unless compiled_files.empty?
+ warn "WARNING: rake-compiler found compiled files in '#{@ext_dir}' directory. Please remove them."
+ end
+
# only gems with 'ruby' platforms are allowed to define native tasks
define_native_tasks if !@no_native && (@gem_spec && @gem_spec.platform == 'ruby')
@@ -364,8 +369,8 @@ Rerun `rake` under MRI Ruby 1.8.x/1.9.x to cross/native compile.
windows? ? 'NUL' : '/dev/null'
end
- def source_files
- @source_files ||= FileList["#{@ext_dir}/#{@source_pattern}"]
+ def compiled_files
+ FileList["#{@ext_dir}/#{@compiled_pattern}"]
end
def compiles_cross_platform