[iOS] Fail build if one of the resources is a dir called `Resources'.

Fixes http://hipbyte.myjetbrains.com/youtrack/issue/RM-450.
This commit is contained in:
Eloy Durán
2014-03-21 17:07:53 +01:00
committed by Watson
parent 3caf55b141
commit 5f5fbca0c8

View File

@@ -40,21 +40,36 @@ desc "Build everything"
task :build => ['build:simulator', 'build:device']
namespace :build do
desc "Build the simulator version"
task :simulator do
def pre_build_actions(platform)
# TODO: Ensure Info.plist gets regenerated on each build so it has ints for
# Instruments and strings for normal builds.
rm_f File.join(App.config.app_bundle('iPhoneSimulator'), 'Info.plist')
rm_f File.join(App.config.app_bundle(platform), 'Info.plist')
# TODO this should go into a iOS specific Builder class which performs this
# check before building.
App.config.resources_dirs.each do |dir|
Dir.entries(dir).grep(/Resources/i).each do |basename|
path = File.join(dir, basename)
if File.directory?(path)
suggestion = basename == 'Resources' ? 'Assets' : 'assets'
App.fail "An iOS application cannot be installed if it contains a " \
"directory called `resources'. Please rename the " \
"directory at path `#{path}' to, for instance, " \
"`#{File.join(dir, suggestion)}'."
end
end
end
end
desc "Build the simulator version"
task :simulator do
pre_build_actions('iPhoneSimulator')
App.build('iPhoneSimulator')
end
desc "Build the device version"
task :device do
# TODO: Ensure Info.plist gets regenerated on each build so it has ints for
# Instruments and strings for normal builds.
rm_f File.join(App.config.app_bundle('iPhoneOS'), 'Info.plist')
pre_build_actions('iPhoneOS')
App.build('iPhoneOS')
App.codesign('iPhoneOS')
end