[rake] Raise error if cleaning does not succeed.

Fixes https://hipbyte.freshdesk.com/helpdesk/tickets/1359.
This commit is contained in:
Eloy Durán
2013-11-18 11:44:07 +01:00
parent de38ba1086
commit 99df3e011b
3 changed files with 15 additions and 4 deletions

1
NEWS
View File

@@ -18,6 +18,7 @@
released.
* Fixed a bug in dispatcher where #super cannot look up the shortcut method.
(ie #foo=)
* Raise error if cleaning a build artefact fails.
* [iOS] Fixed a bug where `rake device' would no longer print the application
logs from the device.
* [OSX] Fixed a bug on OSX platform where compiler flags for iOS are passed

View File

@@ -40,14 +40,19 @@ system("/usr/bin/ruby \"#{motion_bin_path}\" update --check")
desc "Clear local build objects"
task :clean do
App.info 'Delete', App.config.build_dir
rm_rf(App.config.build_dir)
App.config.vendor_projects.each { |vendor| vendor.clean }
Dir.glob(App.config.resources_dirs.flatten.map{ |x| x + '/**/*.{nib,storyboardc,momd}' }).each do |p|
paths = [App.config.build_dir]
paths.concat(Dir.glob(App.config.resources_dirs.flatten.map{ |x| x + '/**/*.{nib,storyboardc,momd}' }))
paths.each do |p|
next if File.extname(p) == ".nib" && !File.exist?(p.sub(/\.nib$/, ".xib"))
App.info 'Delete', p
rm_rf p
if File.exist?(p)
# It can happen that because of file permissions a dir/file is not
# actually removed, which can lead to confusing issues.
App.fail "Failed to remove `#{p}'. Please remove this path manually."
end
end
App.config.vendor_projects.each { |vendor| vendor.clean }
end
namespace :clean do

View File

@@ -52,6 +52,11 @@ module Motion; module Project;
if File.exist?(build_dir)
App.info 'Delete', build_dir
FileUtils.rm_rf build_dir
if File.exist?(build_dir)
# It can happen that because of file permissions a dir/file is not
# actually removed, which can lead to confusing issues.
App.fail "Failed to remove `#{build_dir}'. Please remove this path manually."
end
end
end
end