From b100859e2a7959caabc4884d516d31e9bfc95610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Fri, 11 Oct 2013 19:09:20 +0200 Subject: [PATCH] [xcassets] No longer copy icons ourselves on iOS. --- lib/motion/project/builder.rb | 31 +++++++---------------- lib/motion/project/template/ios/config.rb | 5 ++-- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/lib/motion/project/builder.rb b/lib/motion/project/builder.rb index f58a4001..a043dbb6 100644 --- a/lib/motion/project/builder.rb +++ b/lib/motion/project/builder.rb @@ -344,11 +344,15 @@ EOS # Compile Asset Catalog bundles. app_icons = [] - xcassets = config.xcassets_bundles + xcassets = config.xcassets_bundles.map { |f| File.expand_path(f) } unless xcassets.empty? - if config.deploy_platform == 'MacOSX' && config.app_icons_asset_bundle - app_icon_name = File.basename(config.icon, '.icns') - actool_for_mac_options = "--output-partial-info-plist /dev/null --app-icon #{app_icon_name}" + if app_icons_asset_bundle = config.app_icons_asset_bundle + app_icons = config.deploy_platform == 'iPhoneOS' ? config.icons : [config.icon] + app_icons_name = File.basename(app_icons_asset_bundle, '.appiconset') + # TODO We can potentially use the plist output to identify the icon + # names for the config, instead of parsing the JSON. This also + # guards against the Contents.json format changing. + app_icons_options = "--output-partial-info-plist /dev/null --app-icon \"#{app_icons_name}\"" end app_resources_dir = File.expand_path(config.app_resources_dir(platform)) FileUtils.mkdir_p(app_resources_dir) @@ -356,25 +360,8 @@ EOS "--notices --warnings --platform #{config.deploy_platform.downcase} " \ "--minimum-deployment-target #{config.deployment_target} " \ "#{Array(config.device_family).map { |d| "--target-device #{d}" }.join(' ')} " \ - "#{actool_for_mac_options} " \ + "#{app_icons_options} " \ "--compress-pngs --compile \"#{app_resources_dir}\" \"#{xcassets.join('" "')}\"" - - # TODO this should really move to the iOS and OS X specific builders, - # but they do not have the notion of overriding single steps of the - # build process yet. - case config.deploy_platform - # iOS App icons still need to be handled as always, so we need to copy - # those into the app bundle. - when 'iPhoneOS' - if app_icons_from_asset_bundle = config.app_icons_from_asset_bundle - app_icons_from_asset_bundle.each do |image_src, image_dest_filename| - copy_resource(image_src, File.join(bundle_path, image_dest_filename)) - end - app_icons = config.icons - end - when 'MacOSX' - app_icons = [config.icon] if config.app_icons_asset_bundle - end end # Compile CoreData Model resources and SpriteKit atlas files. diff --git a/lib/motion/project/template/ios/config.rb b/lib/motion/project/template/ios/config.rb index 5864aabf..3e7ab630 100644 --- a/lib/motion/project/template/ios/config.rb +++ b/lib/motion/project/template/ios/config.rb @@ -57,7 +57,7 @@ module Motion; module Project; end def icons - @icons ||= app_icons_from_asset_bundle.map(&:last) + @icons ||= app_icons_from_asset_bundle end def app_icons_from_asset_bundle @@ -80,8 +80,7 @@ module Motion; module Project; if image_src = image['filename'] image_src = File.join(app_icon_set, image_src) if File.exist?(image_src) - image_filename = "#{app_icon_filename}#{image['size']}@#{image['scale']}.png" - @app_icons_from_asset_bundle << [image_src, image_filename] + @app_icons_from_asset_bundle << "#{app_icon_filename}#{image['size']}@#{image['scale']}.png" end end end