diff --git a/lib/motion/project/target/extension_target.rb b/lib/motion/project/target/extension_target.rb index 52c9ad6d..a12347ac 100644 --- a/lib/motion/project/target/extension_target.rb +++ b/lib/motion/project/target/extension_target.rb @@ -37,19 +37,6 @@ module Motion; module Project if !File.exist?(extension_path) or File.mtime(src_path) > File.mtime(extension_path) App.info 'Copy', src_path FileUtils.cp_r(src_path, dest_path) - - # At build time Extensions do not know the bundle indentifier of its - # parent app, so we have to modify their Info.plist later - extension_dir = File.join(destination_dir, extension_name) - info_plist = File.join(extension_dir, 'Info.plist') - extension_bundle_name = `/usr/libexec/PlistBuddy -c "print CFBundleName" "#{info_plist}"`.strip - extension_bundle_indentifer = `/usr/libexec/PlistBuddy -c "print CFBundleIdentifier" "#{info_plist}"`.strip - if extension_bundle_indentifer.include?(".watchkitextension") - extension_bundle_indentifer = "#{@config.identifier}.watchkitextension" - else - extension_bundle_indentifer = "#{@config.identifier}.#{extension_bundle_name}" - end - `/usr/libexec/PlistBuddy -c "set CFBundleIdentifier #{extension_bundle_indentifer}" "#{info_plist}"` end end diff --git a/lib/motion/project/template/ios-extension-config.rb b/lib/motion/project/template/ios-extension-config.rb index 42c07124..72bf76f6 100644 --- a/lib/motion/project/template/ios-extension-config.rb +++ b/lib/motion/project/template/ios-extension-config.rb @@ -182,6 +182,16 @@ module Motion; module Project; ary.map { |family| device_family_int(family) } end + # @todo Is it correct that a bundle identifier may contain spaces? Because + # the `bundle_name` definitely can contain spaces. + # + # @return [String] The bundle identifier of the application extension based + # on the bundle identifier of the host application. + # + def identifier + ENV['RM_TARGET_HOST_APP_IDENTIFIER'] + '.' + bundle_name + end + def app_bundle(platform) File.join(versionized_build_dir(platform), bundle_name + '.appex') end