bin/nixenvironment in nixenvironment-0.0.56 vs bin/nixenvironment in nixenvironment-0.0.57

- old
+ new

@@ -46,13 +46,15 @@ global_option ('--bundle_id VALUE') { |value| $bundle_id = value } global_option ('--resigned_bundle_id VALUE') { |value| $resigned_bundle_id = value } global_option ('--resigned_watchkit_app_bundle_id VALUE') { |value| $resigned_watchkit_app_bundle_id = value } global_option ('--resigned_watchkit_extension_bundle_id VALUE') { |value| $resigned_watchkit_extension_bundle_id = value } +global_option ('--resigned_widget_bundle_id VALUE') { |value| $resigned_widget_bundle_id = value } global_option ('--resigned_bundle_name VALUE') { |value| $resigned_bundle_name = value } global_option ('--resigned_entitlements_path VALUE') { |value| $resigned_entitlements_path = value } global_option ('--resigned_watchkit_extension_entitlements_path VALUE') { |value| $resigned_watchkit_extension_entitlements_path = value } +global_option ('--resigned_widget_entitlements_path VALUE') { |value| $resigned_widget_entitlements_path = value } command :update do |c| c.syntax = 'nixenvironment update' c.description = 'Install or update ninbas and other environment stuff' c.option '--ninbas NAME', String, 'Select ninbas branch, tag or revision to clone' @@ -279,13 +281,15 @@ update_config_settings('ENV_VAR_PREFIX', $env_var_prefix) update_config_settings('BUNDLE_ID', $bundle_id) update_config_settings('RESIGNED_BUNDLE_ID', $resigned_bundle_id) update_config_settings('RESIGNED_WATCHKIT_APP_BUNDLE_ID', $resigned_watchkit_app_bundle_id) update_config_settings('RESIGNED_WATCHKIT_EXTENSION_BUNDLE_ID', $resigned_watchkit_extension_bundle_id) + update_config_settings('RESIGNED_WIDGET_BUNDLE_ID', $resigned_widget_bundle_id) update_config_settings('RESIGNED_BUNDLE_NAME', $resigned_bundle_name) update_config_settings('RESIGNED_ENTITLEMENTS_PATH', $resigned_entitlements_path) update_config_settings('RESIGNED_WATCHKIT_EXTENSION_ENTITLEMENTS_PATH', $resigned_watchkit_extension_entitlements_path) + update_config_settings('RESIGNED_WIDGET_ENTITLEMENTS_PATH', $resigned_widget_entitlements_path) end def update_config_settings(key, value) if value @config_settings[key] = value @@ -353,10 +357,11 @@ -sdk \"#{sdk}\"\ -showBuildSettings ] @unescaped_watchkit_extension_product_settings_path = unescaped_product_settings_path(' WatchKit Extension', config) @unescaped_watchkit_app_product_settings_path = unescaped_product_settings_path(' WatchKit App', config) + @unescaped_widget_product_settings_path = unescaped_product_settings_path(' Widget', config) else abort('Build error! Either PROJECT_TO_BUILD or WORKSPACE_TO_BUILD must be specified!') end # $? - last cmd exit code @@ -456,16 +461,19 @@ def save_build_env_vars executable_name = @config_settings['EXECUTABLE_NAME'] watchkit_app_executable = executable_name + ' WatchKit App.app' watchkit_extension_executable = executable_name + ' WatchKit Extension.appex' + widget_executable = executable_name + ' Widget.appex' app_product = File.join(@config_settings['BUILT_PRODUCTS_DIR'], executable_name) + '.app' watchkit_extension_relative_product = @config_settings['RESIGNED_WATCHKIT_EXTENSION_BUNDLE_ID'].nil? ? nil : File.join('PlugIns', watchkit_extension_executable).shellescape watchkit_app_relative_product = @config_settings['RESIGNED_WATCHKIT_APP_BUNDLE_ID'].nil? ? nil : File.join(watchkit_extension_relative_product, watchkit_app_executable).shellescape + widget_relative_product = @config_settings['RESIGNED_WIDGET_BUNDLE_ID'].nil? ? nil : File.join('PlugIns', widget_executable).shellescape resigned_watchkit_extension_entitlements_path = @config_settings['RESIGNED_WATCHKIT_EXTENSION_ENTITLEMENTS_PATH'].nil? ? nil : @config_settings['RESIGNED_WATCHKIT_EXTENSION_ENTITLEMENTS_PATH'].shellescape + resigned_widget_entitlements_path = @config_settings['RESIGNED_WIDGET_ENTITLEMENTS_PATH'].nil? ? nil : @config_settings['RESIGNED_WIDGET_ENTITLEMENTS_PATH'].shellescape system(" echo \"#!/bin/sh\ ### AUTOGENERATED BY Nixenvironment; DO NOT EDIT ### PROJECT=#{@config_settings['PROJECT']} @@ -473,22 +481,25 @@ OBJECTS_NORMAL_DIR=#{@config_settings['OBJECT_FILE_DIR_normal']} EXECUTABLE_NAME=#{@config_settings['EXECUTABLE_NAME']} APP_PRODUCT=#{app_product} WATCHKIT_APP_RELATIVE_PRODUCT=#{watchkit_app_relative_product} WATCHKIT_EXTENSION_RELATIVE_PRODUCT=#{watchkit_extension_relative_product} +WIDGET_RELATIVE_PRODUCT=#{widget_relative_product} APP_DSYM=#{app_product}.dSYM APP_INFOPLIST_FILE=#{@config_settings['PRODUCT_SETTINGS_PATH']} EMBEDDED_PROFILE=#{app_product}/#{@config_settings['EMBEDDED_PROFILE_NAME']} TARGET_NAME=#{@config_settings['TARGET_NAME']} CONFIGURATION=#{@config_settings['CONFIGURATION']} SDK_NAME=#{@config_settings['SDK_NAME']} RESIGNED_BUNDLE_ID=#{@config_settings['RESIGNED_BUNDLE_ID']} RESIGNED_WATCHKIT_APP_BUNDLE_ID=#{@config_settings['RESIGNED_WATCHKIT_APP_BUNDLE_ID']} RESIGNED_WATCHKIT_EXTENSION_BUNDLE_ID=#{@config_settings['RESIGNED_WATCHKIT_EXTENSION_BUNDLE_ID']} +RESIGNED_WIDGET_BUNDLE_ID=#{@config_settings['RESIGNED_WIDGET_BUNDLE_ID']} RESIGNED_BUNDLE_NAME=#{@config_settings['RESIGNED_BUNDLE_NAME']} RESIGNED_ENTITLEMENTS_PATH=#{@config_settings['RESIGNED_ENTITLEMENTS_PATH']} -RESIGNED_WATCHKIT_EXTENSION_ENTITLEMENTS_PATH=#{resigned_watchkit_extension_entitlements_path}\" > _last_build_vars.sh +RESIGNED_WATCHKIT_EXTENSION_ENTITLEMENTS_PATH=#{resigned_watchkit_extension_entitlements_path} +RESIGNED_WIDGET_ENTITLEMENTS_PATH=#{resigned_widget_entitlements_path}\" > _last_build_vars.sh ") end def prebuild(config) save_revision = File.join(BUILD_SCRIPTS_PATH, 'SaveRevision.sh') @@ -697,10 +708,19 @@ @watchkit_extension_info_plist_backup_name = @unescaped_watchkit_extension_product_settings_path + '.backup' FileUtils.cp(@unescaped_watchkit_extension_product_settings_path, @watchkit_extension_info_plist_backup_name) p('WatchKit Extension Info.plist was backuped.') end + + unless @unescaped_widget_product_settings_path.nil? + p('Backuping Widget Info.plist ...') + + @widget_info_plist_backup_name = @unescaped_widget_product_settings_path + '.backup' + FileUtils.cp(@unescaped_widget_product_settings_path, @widget_info_plist_backup_name) + + p('Widget Info.plist was backuped.') + end end def update_info_plist(config) p('Updating Info.plist ...') @@ -745,10 +765,22 @@ abort('Update WatchKit Extension Info.plist error!') end p('WatchKit Extension Info.plist was updated.') end + + unless @unescaped_widget_product_settings_path.nil? + p('Updating Widget Info.plist ...') + + update_success = system("/usr/libexec/PlistBuddy -c 'Set :CFBundleVersion \"#{monotonic_revision}\"' \"#{@unescaped_widget_product_settings_path}\"") + unless update_success + restore_info_plist + abort('Update Widget Info.plist error!') + end + + p('Widget Info.plist was updated.') + end end def restore_info_plist p('Restoring Info.plist ...') @@ -771,9 +803,18 @@ File.delete(@unescaped_watchkit_extension_product_settings_path) File.rename(@watchkit_extension_info_plist_backup_name, @unescaped_watchkit_extension_product_settings_path) p('WatchKit Extension Info.plist was restored.') + end + + unless @unescaped_widget_product_settings_path.nil? + p('Restoring Widget Info.plist ...') + + File.delete(@unescaped_widget_product_settings_path) + File.rename(@widget_info_plist_backup_name, @unescaped_widget_product_settings_path) + + p('Widget Info.plist was restored.') end end def deploy(deliver_deploy) deploy = File.join(BUILD_SCRIPTS_PATH, 'DeployIPA.sh')