mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-06-12 17:19:01 +08:00
[WatchKit] Generate an Info.plist for the watch app.
This commit is contained in:
@@ -446,12 +446,7 @@ EOS
|
||||
end
|
||||
|
||||
# Create bundle/Info.plist.
|
||||
bundle_info_plist = File.join(bundle_path, 'Info.plist')
|
||||
if !File.exist?(bundle_info_plist) or File.mtime(config.project_file) > File.mtime(bundle_info_plist)
|
||||
App.info 'Create', bundle_info_plist
|
||||
File.open(bundle_info_plist, 'w') { |io| io.write(config.info_plist_data(platform)) }
|
||||
sh "/usr/bin/plutil -convert binary1 \"#{bundle_info_plist}\""
|
||||
end
|
||||
generate_info_plist(config, platform)
|
||||
|
||||
# Copy resources, handle subdirectories.
|
||||
app_resources_dir = config.app_resources_dir(platform)
|
||||
@@ -571,6 +566,15 @@ EOS
|
||||
sh "'#{File.join(config.bindir, 'instruments')}' '#{instruments_app}' '#{plist_path}'"
|
||||
end
|
||||
|
||||
def generate_info_plist(config, platform)
|
||||
bundle_info_plist = File.join(config.app_bundle(platform), 'Info.plist')
|
||||
if !File.exist?(bundle_info_plist) or File.mtime(config.project_file) > File.mtime(bundle_info_plist)
|
||||
App.info 'Create', bundle_info_plist
|
||||
File.open(bundle_info_plist, 'w') { |io| io.write(config.info_plist_data(platform)) }
|
||||
sh "/usr/bin/plutil -convert binary1 \"#{bundle_info_plist}\""
|
||||
end
|
||||
end
|
||||
|
||||
class << self
|
||||
def common_build_dir
|
||||
dir = File.expand_path("~/Library/RubyMotion/build")
|
||||
|
||||
@@ -36,6 +36,9 @@ module Motion; module Project
|
||||
|
||||
# Compile storyboard
|
||||
sh "/usr/bin/ibtool --errors --warnings --notices --module #{config.escaped_storyboard_module_name} --minimum-deployment-target #{config.sdk_version} --output-partial-info-plist /tmp/Interface-SBPartialInfo.plist --auto-activate-custom-fonts --output-format human-readable-text --compilation-directory '#{config.app_bundle(platform)}' watch_app/Interface.storyboard"
|
||||
|
||||
# Create bundle/Info.plist.
|
||||
generate_info_plist(config, platform)
|
||||
end
|
||||
|
||||
def build_watch_extension(config, platform, opts)
|
||||
|
||||
@@ -115,6 +115,29 @@ EOS
|
||||
@name ||= @extension_config.name.sub(" WatchKit Extension", '') + " Watch App"
|
||||
end
|
||||
|
||||
# @return [String] The bundle identifier of the watch application based on
|
||||
# the bundle identifier of the watch extension.
|
||||
#
|
||||
def identifier
|
||||
@identifier ||= @extension_config.identifier + '.watchapp'
|
||||
end
|
||||
|
||||
# @todo There are more differences with Xcode's Info.plist.
|
||||
#
|
||||
# @param [String] platform
|
||||
# The platform identifier that's being build for, such as
|
||||
# `iPhoneSimulator` or `iPhoneOS`.
|
||||
#
|
||||
# @return [Hash] A hash that contains all the various `Info.plist` data
|
||||
# merged into one hash.
|
||||
#
|
||||
def merged_info_plist(platform)
|
||||
plist = super
|
||||
plist['UIDeviceFamily'] << '4' # Probably means Apple Watch device?
|
||||
plist['WKWatchKitApp'] = true
|
||||
plist
|
||||
end
|
||||
|
||||
# @param [String] platform
|
||||
# The platform identifier that's being build for, such as
|
||||
# `iPhoneSimulator` or `iPhoneOS`.
|
||||
|
||||
Reference in New Issue
Block a user