Don't shell out for :clean target

This commit is contained in:
Moritz Bunkus 2012-04-09 16:32:46 +02:00
parent 6d6daf2902
commit f4721c599c
2 changed files with 21 additions and 11 deletions

View File

@ -467,17 +467,26 @@ end
# Cleaning tasks
desc "Remove all compiled files"
task :clean do
tools = $tools.collect { |name| "src/tools/#{name}" }.join " "
run <<-SHELL, :allow_failure => true
rm -f *.o */*.o */*/*.o */lib*.a */*/lib*.a */*/*.gch po/*.mo
*/*.exe */*/*.exe */*/*.dll */*/*.dll.a doc/guide/*/*.hhk
src/info/ui/*.h src/info/*.moc.cpp src/common/*/*.o
src/mmg/*/*.o #{$applications.join(" ")} #{tools}
lib/libebml/src/*.o lib/libmatroska/src/*.o
lib/libebml/src/lib*.a lib/libmatroska/src/lib*.a
lib/pugixml/src/*.o lib/pugixml/src/lib*.a
SHELL
run "rm -rf #{$dependency_dir}", :allow_failure => true
puts " CLEAN"
patterns = %w{
src/**/*.o lib/**/*.o src/**/lib*.a lib/**/lib*.a src/**/*.gch
src/**/*.exe src/**/*.dll src/**/*.dll.a
src/**/*.moc.cpp src/info/ui/*.h src/mmg-qt/forms/*.h
po/*.mo doc/guide/**/*.hhk
}
patterns += $applications + $tools.collect { |name| "src/tools/#{name}" }
verbose = ENV['V'].to_bool
patterns.collect { |pattern| FileList[pattern].to_a }.flatten.select { |file_name| File.exists? file_name }.each do |file_name|
puts " rm #{file_name}" if verbose
File.unlink file_name
end
if Dir.exists? $dependency_dir
puts " rm -rf #{$dependency_dir}" if verbose
FileUtils.rm_rf $dependency_dir
end
end
namespace :clean do

View File

@ -1,5 +1,6 @@
$use_tempfile_for_run = defined?(RUBY_PLATFORM) && /mingw/i.match(RUBY_PLATFORM)
require "tempfile"
require "fileutils"
if defined? Mutex
$message_mutex = Mutex.new