[Target] Configure the bundle ID in the config object only.

This commit is contained in:
Eloy Durán
2014-12-04 17:03:20 +01:00
committed by Watson
parent b4a46b1513
commit 3099f848e4
2 changed files with 10 additions and 13 deletions

View File

@@ -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

View File

@@ -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