mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-06-11 08:14:16 +08:00
[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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user