This commit is contained in:
Ali 2020-12-25 19:02:28 +04:00
parent dbf5a5691f
commit 1b8bb22e5b
7 changed files with 5 additions and 1029 deletions

364
Makefile
View File

@ -1,49 +1,9 @@
.PHONY : check_env build build_arm64 build_debug_arm64 package package_arm64 app app_arm64 app_debug_arm64 build_buckdebug build_verbose kill_xcode clean project project_buckdebug temp .PHONY : kill_xcode clean bazel_app_debug_arm64 bazel_app_debug_sim_arm64 bazel_app_arm64 bazel_app_armv7 bazel_app bazel_project bazel_project_noextensions
include Utils.makefile
APP_VERSION="7.3" APP_VERSION="7.3"
CORE_COUNT=$(shell sysctl -n hw.logicalcpu) CORE_COUNT=$(shell sysctl -n hw.logicalcpu)
CORE_COUNT_MINUS_ONE=$(shell expr ${CORE_COUNT} \- 1) CORE_COUNT_MINUS_ONE=$(shell expr ${CORE_COUNT} \- 1)
BUCK_OPTIONS=\
--config custom.appVersion="${APP_VERSION}" \
--config custom.developmentCodeSignIdentity="${DEVELOPMENT_CODE_SIGN_IDENTITY}" \
--config custom.distributionCodeSignIdentity="${DISTRIBUTION_CODE_SIGN_IDENTITY}" \
--config custom.developmentTeam="${DEVELOPMENT_TEAM}" \
--config custom.baseApplicationBundleId="${BUNDLE_ID}" \
--config custom.apiId="${API_ID}" \
--config custom.apiHash="${API_HASH}" \
--config custom.appCenterId="${APP_CENTER_ID}" \
--config custom.isInternalBuild="${IS_INTERNAL_BUILD}" \
--config custom.isAppStoreBuild="${IS_APPSTORE_BUILD}" \
--config custom.appStoreId="${APPSTORE_ID}" \
--config custom.appSpecificUrlScheme="${APP_SPECIFIC_URL_SCHEME}" \
--config custom.buildNumber="${BUILD_NUMBER}" \
--config custom.entitlementsApp="${ENTITLEMENTS_APP}" \
--config custom.developmentProvisioningProfileApp="${DEVELOPMENT_PROVISIONING_PROFILE_APP}" \
--config custom.distributionProvisioningProfileApp="${DISTRIBUTION_PROVISIONING_PROFILE_APP}" \
--config custom.entitlementsExtensionShare="${ENTITLEMENTS_EXTENSION_SHARE}" \
--config custom.developmentProvisioningProfileExtensionShare="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_SHARE}" \
--config custom.distributionProvisioningProfileExtensionShare="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_SHARE}" \
--config custom.entitlementsExtensionWidget="${ENTITLEMENTS_EXTENSION_WIDGET}" \
--config custom.developmentProvisioningProfileExtensionWidget="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_WIDGET}" \
--config custom.distributionProvisioningProfileExtensionWidget="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_WIDGET}" \
--config custom.entitlementsExtensionNotificationService="${ENTITLEMENTS_EXTENSION_NOTIFICATIONSERVICE}" \
--config custom.developmentProvisioningProfileExtensionNotificationService="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE}" \
--config custom.distributionProvisioningProfileExtensionNotificationService="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE}" \
--config custom.entitlementsExtensionNotificationContent="${ENTITLEMENTS_EXTENSION_NOTIFICATIONCONTENT}" \
--config custom.developmentProvisioningProfileExtensionNotificationContent="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT}" \
--config custom.distributionProvisioningProfileExtensionNotificationContent="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT}" \
--config custom.entitlementsExtensionIntents="${ENTITLEMENTS_EXTENSION_INTENTS}" \
--config custom.developmentProvisioningProfileExtensionIntents="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_INTENTS}" \
--config custom.distributionProvisioningProfileExtensionIntents="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_INTENTS}" \
--config custom.developmentProvisioningProfileWatchApp="${DEVELOPMENT_PROVISIONING_PROFILE_WATCH_APP}" \
--config custom.distributionProvisioningProfileWatchApp="${DISTRIBUTION_PROVISIONING_PROFILE_WATCH_APP}" \
--config custom.developmentProvisioningProfileWatchExtension="${DEVELOPMENT_PROVISIONING_PROFILE_WATCH_EXTENSION}" \
--config custom.distributionProvisioningProfileWatchExtension="${DISTRIBUTION_PROVISIONING_PROFILE_WATCH_EXTENSION}"
BAZEL=$(shell which bazel) BAZEL=$(shell which bazel)
ifneq ($(BAZEL_HTTP_CACHE_URL),) ifneq ($(BAZEL_HTTP_CACHE_URL),)
@ -76,325 +36,11 @@ BAZEL_OPT_FLAGS=\
--objc_enable_binary_stripping \ --objc_enable_binary_stripping \
--apple_bitcode=watchos=embedded \ --apple_bitcode=watchos=embedded \
kill_xcode:
killall Xcode || true
build_arm64: check_env clean:
$(BUCK) build \ "${BAZEL}" clean
//Telegram:AppPackage#iphoneos-arm64 \
//Telegram:Telegram#dwarf-and-dsym,iphoneos-arm64 \
//submodules/MtProtoKit:MtProtoKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/MtProtoKit:MtProtoKit#shared,iphoneos-arm64 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared,iphoneos-arm64 \
//submodules/Postbox:Postbox#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/Postbox:Postbox#shared,iphoneos-arm64 \
//submodules/TelegramApi:TelegramApi#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramApi:TelegramApi#shared,iphoneos-arm64 \
//submodules/SyncCore:SyncCore#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/SyncCore:SyncCore#shared,iphoneos-arm64 \
//submodules/TelegramCore:TelegramCore#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramCore:TelegramCore#shared,iphoneos-arm64 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#shared,iphoneos-arm64 \
//submodules/Display:Display#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/Display:Display#shared,iphoneos-arm64 \
//submodules/TelegramUI:TelegramUI#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramUI:TelegramUI#shared,iphoneos-arm64 \
//Telegram:WatchAppExtension#dwarf-and-dsym,watchos-arm64_32,watchos-armv7k \
//Telegram:ShareExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:WidgetExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:NotificationContentExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:NotificationServiceExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:IntentsExtension#dwarf-and-dsym,iphoneos-arm64 \
${BUCK_OPTIONS} ${BUCK_RELEASE_OPTIONS} ${BUCK_THREADS_OPTIONS} ${BUCK_CACHE_OPTIONS}
build_debug_arm64: check_env
$(BUCK) build \
//Telegram:AppPackage#iphoneos-arm64 \
//Telegram:Telegram#dwarf-and-dsym,iphoneos-arm64 \
//submodules/MtProtoKit:MtProtoKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/MtProtoKit:MtProtoKit#shared,iphoneos-arm64 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared,iphoneos-arm64 \
//submodules/Postbox:Postbox#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/Postbox:Postbox#shared,iphoneos-arm64 \
//submodules/TelegramApi:TelegramApi#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramApi:TelegramApi#shared,iphoneos-arm64 \
//submodules/SyncCore:SyncCore#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/SyncCore:SyncCore#shared,iphoneos-arm64 \
//submodules/TelegramCore:TelegramCore#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramCore:TelegramCore#shared,iphoneos-arm64 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#shared,iphoneos-arm64 \
//submodules/Display:Display#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/Display:Display#shared,iphoneos-arm64 \
//submodules/TelegramUI:TelegramUI#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramUI:TelegramUI#shared,iphoneos-arm64 \
//Telegram:WatchAppExtension#dwarf-and-dsym,watchos-arm64_32,watchos-armv7k \
//Telegram:ShareExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:WidgetExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:NotificationContentExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:NotificationServiceExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:IntentsExtension#dwarf-and-dsym,iphoneos-arm64 \
${BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS} ${BUCK_THREADS_OPTIONS} ${BUCK_CACHE_OPTIONS}
build_wallet_debug_arm64: check_env
$(BUCK) build \
//Wallet:AppPackage#iphoneos-arm64 \
//Wallet:Wallet#dwarf-and-dsym,iphoneos-arm64 \
//submodules/MtProtoKit:MtProtoKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/MtProtoKit:MtProtoKit#shared,iphoneos-arm64 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared,iphoneos-arm64 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#shared,iphoneos-arm64 \
//submodules/Display:Display#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/Display:Display#shared,iphoneos-arm64 \
${WALLET_BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS} ${BUCK_THREADS_OPTIONS} ${BUCK_CACHE_OPTIONS}
build_debug_armv7: check_env
$(BUCK) build \
//Telegram:AppPackage#iphoneos-armv7 \
//Telegram:Telegram#dwarf-and-dsym,iphoneos-armv7 \
//submodules/MtProtoKit:MtProtoKit#dwarf-and-dsym,shared,iphoneos-armv7 \
//submodules/MtProtoKit:MtProtoKit#shared,iphoneos-armv7 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#dwarf-and-dsym,shared,iphoneos-armv7 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared,iphoneos-armv7 \
//submodules/Postbox:Postbox#dwarf-and-dsym,shared,iphoneos-armv7 \
//submodules/Postbox:Postbox#shared,iphoneos-armv7 \
//submodules/TelegramApi:TelegramApi#dwarf-and-dsym,shared,iphoneos-armv7 \
//submodules/TelegramApi:TelegramApi#shared,iphoneos-armv7 \
//submodules/SyncCore:SyncCore#dwarf-and-dsym,shared,iphoneos-armv7 \
//submodules/SyncCore:SyncCore#shared,iphoneos-armv7 \
//submodules/TelegramCore:TelegramCore#dwarf-and-dsym,shared,iphoneos-armv7 \
//submodules/TelegramCore:TelegramCore#shared,iphoneos-armv7 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#dwarf-and-dsym,shared,iphoneos-armv7 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#shared,iphoneos-armv7 \
//submodules/Display:Display#dwarf-and-dsym,shared,iphoneos-armv7 \
//submodules/Display:Display#shared,iphoneos-armv7 \
//submodules/TelegramUI:TelegramUI#dwarf-and-dsym,shared,iphoneos-armv7 \
//submodules/TelegramUI:TelegramUI#shared,iphoneos-armv7 \
//Telegram:WatchAppExtension#dwarf-and-dsym,watchos-armv7_32,watchos-armv7k \
//Telegram:ShareExtension#dwarf-and-dsym,iphoneos-armv7 \
//Telegram:WidgetExtension#dwarf-and-dsym,iphoneos-armv7 \
//Telegram:NotificationContentExtension#dwarf-and-dsym,iphoneos-armv7 \
//Telegram:NotificationServiceExtension#dwarf-and-dsym,iphoneos-armv7 \
//Telegram:IntentsExtension#dwarf-and-dsym,iphoneos-armv7 \
${BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS} ${BUCK_THREADS_OPTIONS} ${BUCK_CACHE_OPTIONS}
build: check_env
$(BUCK) build \
//Telegram:AppPackage#iphoneos-arm64,iphoneos-armv7 \
//Telegram:Telegram#dwarf-and-dsym,iphoneos-arm64,iphoneos-armv7 \
//submodules/MtProtoKit:MtProtoKit#dwarf-and-dsym,shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/MtProtoKit:MtProtoKit#shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#dwarf-and-dsym,shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/Postbox:Postbox#dwarf-and-dsym,shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/Postbox:Postbox#shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/TelegramApi:TelegramApi#dwarf-and-dsym,shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/TelegramApi:TelegramApi#shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/SyncCore:SyncCore#dwarf-and-dsym,shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/SyncCore:SyncCore#shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/TelegramCore:TelegramCore#dwarf-and-dsym,shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/TelegramCore:TelegramCore#shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#dwarf-and-dsym,shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/Display:Display#dwarf-and-dsym,shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/Display:Display#shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/TelegramUI:TelegramUI#dwarf-and-dsym,shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/TelegramUI:TelegramUI#shared,iphoneos-arm64,iphoneos-armv7 \
//Telegram:WatchAppExtension#dwarf-and-dsym,watchos-arm64_32,watchos-armv7k \
//Telegram:ShareExtension#dwarf-and-dsym,iphoneos-arm64,iphoneos-armv7 \
//Telegram:WidgetExtension#dwarf-and-dsym,iphoneos-arm64,iphoneos-armv7 \
//Telegram:NotificationContentExtension#dwarf-and-dsym,iphoneos-arm64,iphoneos-armv7 \
//Telegram:NotificationServiceExtension#dwarf-and-dsym,iphoneos-arm64,iphoneos-armv7 \
//Telegram:IntentsExtension#dwarf-and-dsym,iphoneos-arm64,iphoneos-armv7 \
${BUCK_OPTIONS} ${BUCK_RELEASE_OPTIONS} ${BUCK_THREADS_OPTIONS} ${BUCK_CACHE_OPTIONS}
package_arm64:
PACKAGE_DEVELOPMENT_TEAM="${DEVELOPMENT_TEAM}" \
PACKAGE_CODE_SIGN_IDENTITY="${DISTRIBUTION_CODE_SIGN_IDENTITY}" \
PACKAGE_PROVISIONING_PROFILE_APP="${DISTRIBUTION_PROVISIONING_PROFILE_APP}" \
PACKAGE_ENTITLEMENTS_APP="Telegram/${ENTITLEMENTS_APP}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Share="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_SHARE}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Share="Telegram/${ENTITLEMENTS_EXTENSION_SHARE}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Widget="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_WIDGET}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Widget="Telegram/${ENTITLEMENTS_EXTENSION_WIDGET}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationService="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE}" \
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationService="Telegram/${ENTITLEMENTS_EXTENSION_NOTIFICATIONSERVICE}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationContent="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT}" \
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationContent="Telegram/${ENTITLEMENTS_EXTENSION_NOTIFICATIONCONTENT}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Intents="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_INTENTS}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Intents="Telegram/${ENTITLEMENTS_EXTENSION_INTENTS}" \
PACKAGE_PROVISIONING_PROFILE_WATCH_APP="${DISTRIBUTION_PROVISIONING_PROFILE_WATCH_APP}" \
PACKAGE_PROVISIONING_PROFILE_WATCH_EXTENSION="${DISTRIBUTION_PROVISIONING_PROFILE_WATCH_EXTENSION}" \
PACKAGE_BUNDLE_ID="${BUNDLE_ID}" \
sh package_app.sh iphoneos-arm64 $(BUCK) "telegram" $(BUCK_OPTIONS) ${BUCK_RELEASE_OPTIONS}
package_armv7:
PACKAGE_DEVELOPMENT_TEAM="${DEVELOPMENT_TEAM}" \
PACKAGE_CODE_SIGN_IDENTITY="${DISTRIBUTION_CODE_SIGN_IDENTITY}" \
PACKAGE_PROVISIONING_PROFILE_APP="${DISTRIBUTION_PROVISIONING_PROFILE_APP}" \
PACKAGE_ENTITLEMENTS_APP="Telegram/${ENTITLEMENTS_APP}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Share="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_SHARE}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Share="Telegram/${ENTITLEMENTS_EXTENSION_SHARE}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Widget="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_WIDGET}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Widget="Telegram/${ENTITLEMENTS_EXTENSION_WIDGET}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationService="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE}" \
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationService="Telegram/${ENTITLEMENTS_EXTENSION_NOTIFICATIONSERVICE}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationContent="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT}" \
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationContent="Telegram/${ENTITLEMENTS_EXTENSION_NOTIFICATIONCONTENT}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Intents="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_INTENTS}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Intents="Telegram/${ENTITLEMENTS_EXTENSION_INTENTS}" \
PACKAGE_PROVISIONING_PROFILE_WATCH_APP="${DISTRIBUTION_PROVISIONING_PROFILE_WATCH_APP}" \
PACKAGE_PROVISIONING_PROFILE_WATCH_EXTENSION="${DISTRIBUTION_PROVISIONING_PROFILE_WATCH_EXTENSION}" \
PACKAGE_BUNDLE_ID="${BUNDLE_ID}" \
sh package_app.sh iphoneos-armv7 $(BUCK) "telegram" $(BUCK_OPTIONS) ${BUCK_RELEASE_OPTIONS}
package_debug_arm64:
PACKAGE_DEVELOPMENT_TEAM="${DEVELOPMENT_TEAM}" \
PACKAGE_CODE_SIGN_IDENTITY="${DEVELOPMENT_CODE_SIGN_IDENTITY}" \
PACKAGE_PROVISIONING_PROFILE_APP="${DEVELOPMENT_PROVISIONING_PROFILE_APP}" \
PACKAGE_ENTITLEMENTS_APP="Telegram/${ENTITLEMENTS_APP}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Share="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_SHARE}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Share="Telegram/${ENTITLEMENTS_EXTENSION_SHARE}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Widget="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_WIDGET}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Widget="Telegram/${ENTITLEMENTS_EXTENSION_WIDGET}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationService="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE}" \
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationService="Telegram/${ENTITLEMENTS_EXTENSION_NOTIFICATIONSERVICE}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationContent="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT}" \
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationContent="Telegram/${ENTITLEMENTS_EXTENSION_NOTIFICATIONCONTENT}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Intents="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_INTENTS}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Intents="Telegram/${ENTITLEMENTS_EXTENSION_INTENTS}" \
PACKAGE_PROVISIONING_PROFILE_WATCH_APP="${DEVELOPMENT_PROVISIONING_PROFILE_WATCH_APP}" \
PACKAGE_PROVISIONING_PROFILE_WATCH_EXTENSION="${DEVELOPMENT_PROVISIONING_PROFILE_WATCH_EXTENSION}" \
PACKAGE_BUNDLE_ID="${BUNDLE_ID}" \
ENABLE_GET_TASK_ALLOW=0 \
CODESIGNING_PROFILES_VARIANT="development" \
sh package_app.sh iphoneos-arm64 $(BUCK) "telegram" $(BUCK_OPTIONS) ${BUCK_RELEASE_OPTIONS}
package_debug_armv7:
PACKAGE_DEVELOPMENT_TEAM="${DEVELOPMENT_TEAM}" \
PACKAGE_CODE_SIGN_IDENTITY="${DEVELOPMENT_CODE_SIGN_IDENTITY}" \
PACKAGE_PROVISIONING_PROFILE_APP="${DEVELOPMENT_PROVISIONING_PROFILE_APP}" \
PACKAGE_ENTITLEMENTS_APP="Telegram/${ENTITLEMENTS_APP}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Share="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_SHARE}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Share="Telegram/${ENTITLEMENTS_EXTENSION_SHARE}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Widget="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_WIDGET}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Widget="Telegram/${ENTITLEMENTS_EXTENSION_WIDGET}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationService="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE}" \
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationService="Telegram/${ENTITLEMENTS_EXTENSION_NOTIFICATIONSERVICE}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationContent="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT}" \
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationContent="Telegram/${ENTITLEMENTS_EXTENSION_NOTIFICATIONCONTENT}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Intents="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_INTENTS}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Intents="Telegram/${ENTITLEMENTS_EXTENSION_INTENTS}" \
PACKAGE_PROVISIONING_PROFILE_WATCH_APP="${DEVELOPMENT_PROVISIONING_PROFILE_WATCH_APP}" \
PACKAGE_PROVISIONING_PROFILE_WATCH_EXTENSION="${DEVELOPMENT_PROVISIONING_PROFILE_WATCH_EXTENSION}" \
PACKAGE_BUNDLE_ID="${BUNDLE_ID}" \
ENABLE_GET_TASK_ALLOW=0 \
CODESIGNING_PROFILES_VARIANT="development" \
sh package_app.sh iphoneos-armv7 $(BUCK) "telegram" $(BUCK_OPTIONS) ${BUCK_RELEASE_OPTIONS}
package:
PACKAGE_DEVELOPMENT_TEAM="${DEVELOPMENT_TEAM}" \
PACKAGE_CODE_SIGN_IDENTITY="${DISTRIBUTION_CODE_SIGN_IDENTITY}" \
PACKAGE_PROVISIONING_PROFILE_APP="${DISTRIBUTION_PROVISIONING_PROFILE_APP}" \
PACKAGE_ENTITLEMENTS_APP="Telegram/${ENTITLEMENTS_APP}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Share="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_SHARE}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Share="Telegram/${ENTITLEMENTS_EXTENSION_SHARE}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Widget="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_WIDGET}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Widget="Telegram/${ENTITLEMENTS_EXTENSION_WIDGET}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationService="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE}" \
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationService="Telegram/${ENTITLEMENTS_EXTENSION_NOTIFICATIONSERVICE}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationContent="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT}" \
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationContent="Telegram/${ENTITLEMENTS_EXTENSION_NOTIFICATIONCONTENT}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Intents="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_INTENTS}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Intents="Telegram/${ENTITLEMENTS_EXTENSION_INTENTS}" \
PACKAGE_PROVISIONING_PROFILE_WATCH_APP="${DISTRIBUTION_PROVISIONING_PROFILE_WATCH_APP}" \
PACKAGE_PROVISIONING_PROFILE_WATCH_EXTENSION="${DISTRIBUTION_PROVISIONING_PROFILE_WATCH_EXTENSION}" \
PACKAGE_BUNDLE_ID="${BUNDLE_ID}" \
sh package_app.sh iphoneos-arm64,iphoneos-armv7 $(BUCK) "telegram" $(BUCK_OPTIONS) ${BUCK_RELEASE_OPTIONS}
app: build package
app_arm64: build_arm64 package_arm64
app_debug_arm64: build_debug_arm64 package_debug_arm64
wallet_debug_arm64: build_wallet_debug_arm64
app_debug_armv7: build_debug_armv7 package_debug_armv7
build_buckdebug: check_env
BUCK_DEBUG_MODE=1 $(BUCK) build \
//Telegram:AppPackage#iphoneos-arm64 \
//Telegram:Telegram#dwarf-and-dsym,iphoneos-arm64 \
//submodules/MtProtoKit:MtProtoKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/MtProtoKit:MtProtoKit#shared,iphoneos-arm64 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared,iphoneos-arm64 \
//submodules/Postbox:Postbox#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/Postbox:Postbox#shared,iphoneos-arm64 \
//submodules/TelegramApi:TelegramApi#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramApi:TelegramApi#shared,iphoneos-arm64 \
//submodules/SyncCore:SyncCore#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/SyncCore:SyncCore#shared,iphoneos-arm64 \
//submodules/TelegramCore:TelegramCore#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramCore:TelegramCore#shared,iphoneos-arm64 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#shared,iphoneos-arm64 \
//submodules/Display:Display#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/Display:Display#shared,iphoneos-arm64 \
//submodules/TelegramUI:TelegramUI#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramUI:TelegramUI#shared,iphoneos-arm64 \
//Telegram:WatchAppExtension#dwarf-and-dsym,watchos-arm64_32,watchos-armv7k \
//Telegram:ShareExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:WidgetExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:NotificationContentExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:NotificationServiceExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:IntentsExtension#dwarf-and-dsym,iphoneos-arm64 \
--verbose 7 ${BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS}
build_verbose: check_env
$(BUCK) build \
//Telegram:AppPackage#iphoneos-arm64 \
//Telegram:Telegram#dwarf-and-dsym,iphoneos-arm64 \
//submodules/MtProtoKit:MtProtoKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/MtProtoKit:MtProtoKit#shared,iphoneos-arm64 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared,iphoneos-arm64 \
//submodules/Postbox:Postbox#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/Postbox:Postbox#shared,iphoneos-arm64 \
//submodules/TelegramApi:TelegramApi#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramApi:TelegramApi#shared,iphoneos-arm64 \
//submodules/SyncCore:SyncCore#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/SyncCore:SyncCore#shared,iphoneos-arm64 \
//submodules/TelegramCore:TelegramCore#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramCore:TelegramCore#shared,iphoneos-arm64 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#shared,iphoneos-arm64 \
//submodules/Display:Display#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/Display:Display#shared,iphoneos-arm64 \
//submodules/TelegramUI:TelegramUI#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramUI:TelegramUI#shared,iphoneos-arm64 \
//Telegram:WatchAppExtension#dwarf-and-dsym,watchos-arm64_32,watchos-armv7k \
//Telegram:ShareExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:WidgetExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:NotificationContentExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:NotificationServiceExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:IntentsExtension#dwarf-and-dsym,iphoneos-arm64 \
--verbose 7 ${BUCK_OPTIONS} ${BUCK_THREADS_OPTIONS} ${BUCK_DEBUG_OPTIONS} ${BUCK_CACHE_OPTIONS}
deps: check_env
$(BUCK) query "deps(//Telegram:AppPackage)" --dot \
${BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS}
clean: kill_xcode
sh clean.sh
project: check_env kill_xcode
$(BUCK) project //Telegram:workspace --config custom.mode=project ${BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS}
open Telegram/Telegram_Buck.xcworkspace
bazel_app_debug_arm64: bazel_app_debug_arm64:
APP_VERSION="${APP_VERSION}" \ APP_VERSION="${APP_VERSION}" \

View File

@ -1,37 +0,0 @@
export BUCK_DEBUG_OPTIONS=\
--config custom.other_cflags="-O0 -D DEBUG" \
--config custom.other_cxxflags="-O0 -D DEBUG" \
--config custom.optimization="-Onone" \
--config custom.config_swift_compiler_flags="-DDEBUG"
export BUCK_RELEASE_OPTIONS=\
--config custom.other_cflags="-Os" \
--config custom.other_cxxflags="-Os" \
--config custom.optimization="-Osize" \
--config custom.config_swift_compiler_flags="-whole-module-optimization"
export BUCK_THREADS_OPTIONS=--config build.threads=$(shell sysctl -n hw.logicalcpu)
ifneq ($(BUCK_HTTP_CACHE),)
ifeq ($(BUCK_CACHE_MODE),)
BUCK_CACHE_MODE=readwrite
endif
export BUCK_CACHE_OPTIONS=\
--config cache.mode=http \
--config cache.http_url="$(BUCK_HTTP_CACHE)" \
--config cache.http_mode="$(BUCK_CACHE_MODE)"
endif
ifneq ($(BUCK_DIR_CACHE),)
export BUCK_CACHE_OPTIONS=\
--config cache.mode=dir \
--config cache.dir="$(BUCK_DIR_CACHE)" \
--config cache.dir_mode="readwrite"
endif
check_env:
sh check_env.sh
kill_xcode:
killall Xcode || true

View File

@ -21,22 +21,16 @@ if [ -z "$BUILD_NUMBER" ]; then
exit 1 exit 1
fi fi
export ENTITLEMENTS_APP="Telegram-iOS/Telegram-iOS-AppStoreLLC.entitlements"
export DEVELOPMENT_PROVISIONING_PROFILE_APP="match Development ph.telegra.Telegraph" export DEVELOPMENT_PROVISIONING_PROFILE_APP="match Development ph.telegra.Telegraph"
export DISTRIBUTION_PROVISIONING_PROFILE_APP="match AppStore ph.telegra.Telegraph" export DISTRIBUTION_PROVISIONING_PROFILE_APP="match AppStore ph.telegra.Telegraph"
export ENTITLEMENTS_EXTENSION_SHARE="Share/Share-AppStoreLLC.entitlements"
export DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_SHARE="match Development ph.telegra.Telegraph.Share" export DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_SHARE="match Development ph.telegra.Telegraph.Share"
export DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_SHARE="match AppStore ph.telegra.Telegraph.Share" export DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_SHARE="match AppStore ph.telegra.Telegraph.Share"
export ENTITLEMENTS_EXTENSION_WIDGET="Widget/Widget-AppStoreLLC.entitlements"
export DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_WIDGET="match Development ph.telegra.Telegraph.Widget" export DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_WIDGET="match Development ph.telegra.Telegraph.Widget"
export DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_WIDGET="match AppStore ph.telegra.Telegraph.Widget" export DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_WIDGET="match AppStore ph.telegra.Telegraph.Widget"
export ENTITLEMENTS_EXTENSION_NOTIFICATIONSERVICE="NotificationService/NotificationService-AppStoreLLC.entitlements"
export DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE="match Development ph.telegra.Telegraph.NotificationService" export DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE="match Development ph.telegra.Telegraph.NotificationService"
export DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE="match AppStore ph.telegra.Telegraph.NotificationService" export DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE="match AppStore ph.telegra.Telegraph.NotificationService"
export ENTITLEMENTS_EXTENSION_NOTIFICATIONCONTENT="NotificationContent/NotificationContent-AppStoreLLC.entitlements"
export DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT="match Development ph.telegra.Telegraph.NotificationContent" export DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT="match Development ph.telegra.Telegraph.NotificationContent"
export DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT="match AppStore ph.telegra.Telegraph.NotificationContent" export DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT="match AppStore ph.telegra.Telegraph.NotificationContent"
export ENTITLEMENTS_EXTENSION_INTENTS="SiriIntents/SiriIntents-AppStoreLLC.entitlements"
export DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_INTENTS="match Development ph.telegra.Telegraph.SiriIntents" export DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_INTENTS="match Development ph.telegra.Telegraph.SiriIntents"
export DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_INTENTS="match AppStore ph.telegra.Telegraph.SiriIntents" export DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_INTENTS="match AppStore ph.telegra.Telegraph.SiriIntents"
export DEVELOPMENT_PROVISIONING_PROFILE_WATCH_APP="match Development ph.telegra.Telegraph.watchkitapp" export DEVELOPMENT_PROVISIONING_PROFILE_WATCH_APP="match Development ph.telegra.Telegraph.watchkitapp"
@ -47,6 +41,5 @@ export DISTRIBUTION_PROVISIONING_PROFILE_WATCH_EXTENSION="match AppStore ph.tele
BUILDBOX_DIR="buildbox" BUILDBOX_DIR="buildbox"
export CODESIGNING_PROFILES_VARIANT="appstore" export CODESIGNING_PROFILES_VARIANT="appstore"
export PACKAGE_METHOD="appstore"
$@ $@

View File

@ -1,6 +0,0 @@
#!/bin/bash
if [ -z "$TELEGRAM_ENV_SET" ]; then
echo "Error: Telegram build environment is not set up. Use sh public.sh make ${command}"
exit 1
fi

View File

@ -1,4 +0,0 @@
rm -rf App/App.xcodeproj App/App.xcworkspace
rm -rf submodules/MtProtoKit/MtProtoKit.xcodeproj
rm -rf submodules/Emoji/Emoji.xcodeproj
rm -rf buck-out

View File

@ -1,94 +0,0 @@
import sys
import os
import re
import shutil
ignore_patterns_when_copying = [
"^\\.git$",
"^.*/\\.git$",
]
def mkdir_p(path):
if not os.path.isdir(path):
os.makedirs(path)
def clean_copy_files(dir, destination_dir):
for root, dirs, files in os.walk(dir, topdown=False):
for name in files:
skip_file = False
for pattern in ignore_patterns_when_copying:
if re.match(pattern, name):
skip_file = True
break
if skip_file:
continue
file_path = os.path.relpath(os.path.join(root, name), dir)
dir_path = os.path.dirname(file_path)
mkdir_p(destination_dir + "/" + dir_path)
shutil.copy(dir + "/" + file_path, destination_dir + "/" + file_path)
for name in dirs:
skip_file = False
for pattern in ignore_patterns_when_copying:
if re.match(pattern, name):
skip_file = True
break
if skip_file:
continue
dir_path = os.path.relpath(os.path.join(root, name), dir)
if os.path.islink(dir + "/" + dir_path):
continue
mkdir_p(destination_dir + "/" + dir_path)
if len(sys.argv) != 2:
print('Usage: extract_wallet_source.py destination')
sys.exit(1)
destination = sys.argv[1]
deps_data = os.popen("""bazel query 'kind("source file", deps(//Wallet:Wallet))'""").read().splitlines()
buildfile_deps_data = os.popen("""bazel query 'buildfiles(deps(//Wallet:Wallet))'""").read().splitlines()
directories = set()
for line in deps_data + buildfile_deps_data:
if len(line) == 0:
continue
if line[:1] == "@":
continue
if line[:2] != "//":
continue
file_path = line[2:].replace(":", "/")
if file_path.startswith("build-input"):
continue
if file_path.startswith("external"):
continue
file_name = os.path.basename(file_path)
file_dir = os.path.dirname(file_path)
mkdir_p(destination + "/" + file_dir)
shutil.copy(file_path, destination + '/' + file_path)
additional_paths = [
".gitignore",
"WORKSPACE",
"build-system/xcode_version",
"build-system/bazel_version",
"build-system/bazel-rules",
"build-system/tulsi",
"build-system/prepare-build.sh",
"build-system/generate-xcode-project.sh",
"build-system/copy-provisioning-profiles-Wallet.sh",
"build-system/prepare-build-variables-Wallet.sh",
".bazelrc",
"wallet_env.sh",
]
for file_path in additional_paths:
if os.path.isdir(file_path):
clean_copy_files(file_path, destination + "/" + file_path)
else:
shutil.copy(file_path, destination + "/" + file_path)
shutil.copy("Wallet.makefile", destination + "/" + "Makefile")
shutil.copy("Wallet/README.md", destination + "/" + "README.md")

View File

@ -1,522 +0,0 @@
#!/bin/sh
set -e
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
echo "Usage: sh package_app.sh path/to/buck platform-flavors type"
exit 1
fi
PLATFORM_FLAVORS="$1"
BUCK="$2"
APP_TYPE="$3"
shift
shift
shift
BUILD_PATH="build"
if [ "$APP_TYPE" == "wallet" ]; then
APP_NAME="TONWallet"
else
APP_NAME="Telegram"
fi
IPA_PATH="$BUILD_PATH/$APP_NAME.ipa"
DSYMS_FOLDER_NAME="DSYMs"
DSYMS_ZIP="$BUILD_PATH/$DSYMS_FOLDER_NAME.zip"
DSYMS_DIR="$BUILD_PATH/$DSYMS_FOLDER_NAME"
TEMP_PATH="$BUILD_PATH/temp"
TEMP_ENTITLEMENTS_PATH="$TEMP_PATH/entitlements"
KEYCHAIN_PATH="$TEMP_PATH/keychain"
if [ -z "$PACKAGE_BUNDLE_ID" ]; then
echo "PACKAGE_BUNDLE_ID not set"
exit 1
fi
BUNDLE_ID_PREFIX=$(echo "$PACKAGE_BUNDLE_ID" | grep -Eo "^.*?\\..*?\\." | head -1)
if [ -z "$BUNDLE_ID_PREFIX" ]; then
echo "Could not extract bundle id prefix from $PACKAGE_BUNDLE_ID"
exit 1
fi
mkdir -p "$BUILD_PATH"
rm -f "$IPA_PATH"
rm -f "$DSYMS_ZIP"
rm -rf "$DSYMS_DIR"
mkdir -p "$DSYMS_DIR"
rm -rf "$TEMP_PATH"
mkdir -p "$TEMP_PATH"
mkdir -p "$TEMP_ENTITLEMENTS_PATH"
if [ "$APP_TYPE" == "wallet" ]; then
cp "buck-out/gen/Wallet/AppPackage#$PLATFORM_FLAVORS.ipa" "$IPA_PATH.original"
else
cp "buck-out/gen/Telegram/AppPackage#$PLATFORM_FLAVORS.ipa" "$IPA_PATH.original"
fi
rm -rf "$IPA_PATH.original.unpacked"
rm -f "$BUILD_PATH/${APP_NAME}_signed.ipa"
mkdir -p "$IPA_PATH.original.unpacked"
echo "Unzipping original ipa..."
unzip "$IPA_PATH.original" -d "$IPA_PATH.original.unpacked/" 1>/dev/null
rm "$IPA_PATH.original"
UNPACKED_PATH="$IPA_PATH.original.unpacked"
if [ "$APP_TYPE" == "wallet" ]; then
APP_PATH="$UNPACKED_PATH/Payload/Wallet.app"
else
APP_PATH="$UNPACKED_PATH/Payload/Telegram.app"
fi
FRAMEWORKS_DIR="$APP_PATH/Frameworks"
rm -rf "$IPA_PATH.original.unpacked/SwiftSupport/iphoneos/"*
rm -rf "$IPA_PATH.original.unpacked/Symbols/"*
rm -rf "$FRAMEWORKS_DIR/"*
if [ -z "$PACKAGE_METHOD" ]; then
echo "PACKAGE_METHOD is not set"
exit 1
fi
if [ "$PACKAGE_METHOD" != "appstore" ] && [ "$PACKAGE_METHOD" != "enterprise" ]; then
echo "PACKAGE_METHOD $PACKAGE_METHOD should be in [appstore, enterprise]"
exit 1
fi
if [ -z "$PACKAGE_CODE_SIGN_IDENTITY" ]; then
echo "PACKAGE_CODE_SIGN_IDENTITY is not set"
exit 1
fi
if [ -z "$DEVELOPMENT_TEAM" ]; then
echo "DEVELOPMENT_TEAM is not set"
exit 1
fi
if [ ! -d "$CODESIGNING_DATA_PATH" ]; then
echo "CODESIGNING_DATA_PATH $CODESIGNING_DATA_PATH does not exist"
exit 1
fi
if [ -z "$CODESIGNING_CERTS_VARIANT" ]; then
echo "CODESIGNING_CERTS_VARIANT is not set"
exit 1
fi
if [ -z "$CODESIGNING_PROFILES_VARIANT" ]; then
echo "CODESIGNING_PROFILES_VARIANT is not set"
exit 1
fi
CERTS_PATH="$CODESIGNING_DATA_PATH/certs/$CODESIGNING_CERTS_VARIANT"
PROFILES_PATH="$CODESIGNING_DATA_PATH/profiles/$CODESIGNING_PROFILES_VARIANT"
if [ ! -d "$CERTS_PATH" ]; then
echo "$CERTS_PATH does not exist"
exit 1
fi
if [ ! -d "$PROFILES_PATH" ]; then
echo "$PROFILES_PATH does not exist"
exit 1
fi
rm -f "$KEYCHAIN_PATH"
if [ "$APP_TYPE" == "wallet" ]; then
APP_ITEMS_WITH_PROVISIONING_PROFILE="APP"
APP_ITEMS_WITH_ENTITLEMENTS="APP"
else
APP_ITEMS_WITH_PROVISIONING_PROFILE="APP EXTENSION_Share EXTENSION_Widget EXTENSION_NotificationService EXTENSION_NotificationContent EXTENSION_Intents WATCH_APP WATCH_EXTENSION"
APP_ITEMS_WITH_ENTITLEMENTS="APP EXTENSION_Share EXTENSION_Widget EXTENSION_NotificationService EXTENSION_NotificationContent EXTENSION_Intents"
fi
COMMON_IDENTITY_HASH=""
REMOVE_ENTITLEMENT_KEYS=(\
"com.apple.developer.icloud-container-development-container-identifiers" \
"com.apple.developer.ubiquity-kvstore-identifier" \
)
COPY_ENTITLEMENT_KEYS=(\
"com.apple.developer.associated-domains" \
"com.apple.developer.icloud-services" \
"com.apple.developer.pushkit.unrestricted-voip" \
)
REPLACE_TO_PRODUCTION_ENTITLEMENT_KEYS=(\
"com.apple.developer.icloud-container-environment" \
)
echo "Generating entitlements..."
for ITEM in $APP_ITEMS_WITH_PROVISIONING_PROFILE; do
PROFILE_VAR=PACKAGE_PROVISIONING_PROFILE_$ITEM
if [ -z "${!PROFILE_VAR}" ]; then
echo "$PROFILE_VAR is not set"
exit 1
fi
for PROFILE in "$PROFILES_PATH/"*; do
PROFILE_DATA=$(security cms -D -i "$PROFILE")
PROFILE_NAME=$(/usr/libexec/PlistBuddy -c "Print :Name" /dev/stdin <<< $(echo $PROFILE_DATA))
if [ "$PROFILE_NAME" == "${!PROFILE_VAR}" ]; then
TEAM_IDENTIFIER=$(/usr/libexec/PlistBuddy -c "Print :Entitlements:com.apple.developer.team-identifier" /dev/stdin <<< $(echo $PROFILE_DATA))
if [ "$TEAM_IDENTIFIER" != "$DEVELOPMENT_TEAM" ]; then
"Entitlements:com.apple.developer.team-identifier in $PROFILE does not match $DEVELOPMENT_TEAM"
fi
IDENTITY_NAME=$(/usr/libexec/PlistBuddy -c "Print :DeveloperCertificates:0 :data" /dev/stdin <<< $(echo $PROFILE_DATA) | openssl x509 -inform DER -subject -nameopt multiline -sha1 -noout | grep commonName | sed -e 's#[ ]*commonName[ ]*=[ ]*##g')
if [ ! -z "$IDENTITY_NAME" ]; then
IDENTITY_HASH=$(/usr/libexec/PlistBuddy -c "Print :DeveloperCertificates:0 :data" /dev/stdin <<< $(echo $PROFILE_DATA) | openssl x509 -inform DER -fingerprint -sha1 -noout | sed -e 's#SHA1 Fingerprint=##' | sed -e 's#:##g')
if [ -z "$COMMON_IDENTITY_HASH" ]; then
COMMON_IDENTITY_HASH="$IDENTITY_HASH"
elif [ "$COMMON_IDENTITY_HASH" != "$IDENTITY_HASH" ]; then
"Signing identity in $PROFILE ($IDENTITY_HASH) does not match $COMMON_IDENTITY_HASH from previously processed profiles"
fi
else
echo "Signing identity name in $PROFILE does not match $PACKAGE_CODE_SIGN_IDENTITY"
exit 1
fi
declare PROFILE_PATH_$ITEM="$PROFILE"
PROFILE_ENTITLEMENTS_PATH="$TEMP_ENTITLEMENTS_PATH/$ITEM.entitlements"
security cms -D -i "$PROFILE" > "$TEMP_PATH/temp.plist" && /usr/libexec/PlistBuddy -x -c 'Print:Entitlements' "$TEMP_PATH/temp.plist" > "$PROFILE_ENTITLEMENTS_PATH"
for KEY in "${REMOVE_ENTITLEMENT_KEYS[@]}"; do
/usr/libexec/PlistBuddy -c "Delete $KEY" "$PROFILE_ENTITLEMENTS_PATH" 2>/dev/null || true
done
for KEY in "${REPLACE_TO_PRODUCTION_ENTITLEMENT_KEYS[@]}"; do
VALUE=$(/usr/libexec/PlistBuddy -c "Print :$KEY" "$PROFILE_ENTITLEMENTS_PATH" 2>/dev/null || echo "")
if [ ! -z "$VALUE" ]; then
PLUTIL_KEY=$(echo "$KEY" | sed 's/\./\\\./g')
/usr/libexec/PlistBuddy -c "Delete $KEY" "$PROFILE_ENTITLEMENTS_PATH" 2>/dev/null
VALUE="<array><string>Production</string></array>"
plutil -insert "$PLUTIL_KEY" -xml "$VALUE" "$PROFILE_ENTITLEMENTS_PATH"
fi
done
if [ "$ENABLE_GET_TASK_ALLOW" == "1" ]; then
KEY="com.apple.security.get-task-allow"
PLUTIL_KEY=$(echo "$KEY" | sed 's/\./\\\./g')
plutil -insert "$PLUTIL_KEY" -xml "<true/>" "$PROFILE_ENTITLEMENTS_PATH"
fi
ENTITLEMENTS_VAR=PACKAGE_ENTITLEMENTS_$ITEM
if [ ! -z "${!ENTITLEMENTS_VAR}" ]; then
if [ ! -f "${!ENTITLEMENTS_VAR}" ]; then
echo "${!ENTITLEMENTS_VAR} does not exist"
exit 1
fi
for KEY in "${COPY_ENTITLEMENT_KEYS[@]}"; do
VALUE=$(/usr/libexec/PlistBuddy -c "Print :$KEY" "$PROFILE_ENTITLEMENTS_PATH" 2>/dev/null || echo "")
if [ ! -z "$VALUE" ]; then
PLUTIL_KEY=$(echo "$KEY" | sed 's/\./\\\./g')
TEST_VALUE=$(plutil -extract "$PLUTIL_KEY" xml1 -o - "${!ENTITLEMENTS_VAR}" 1>/dev/null || echo "error")
if [ "$TEST_VALUE" != "error" ]; then
VALUE=$(plutil -extract "$PLUTIL_KEY" xml1 -o - "${!ENTITLEMENTS_VAR}")
/usr/libexec/PlistBuddy -c "Delete $KEY" "$PROFILE_ENTITLEMENTS_PATH" 2>/dev/null
plutil -insert "$PLUTIL_KEY" -xml "$VALUE" "$PROFILE_ENTITLEMENTS_PATH"
fi
fi
done
fi
declare ENTITLEMENTS_PATH_$ITEM="$PROFILE_ENTITLEMENTS_PATH"
fi
done
done
for ITEM in $APP_ITEMS_WITH_PROVISIONING_PROFILE; do
PROFILE_PATH_VAR=PROFILE_PATH_$ITEM
if [ -z "${!PROFILE_PATH_VAR}" ]; then
echo "Provisioning profile for $ITEM was not found"
exit 1
fi
done
for ITEM in $APP_ITEMS_WITH_ENTITLEMENTS; do
ENTITLEMENTS_VAR=PACKAGE_ENTITLEMENTS_$ITEM
if [ -z "${!ENTITLEMENTS_VAR}" ]; then
echo "$ENTITLEMENTS_VAR is not set"
exit 1
fi
if [ ! -f "${!ENTITLEMENTS_VAR}" ]; then
echo "${!ENTITLEMENTS_VAR} does not exist"
exit 1
fi
done
if [ -z "$COMMON_IDENTITY_HASH" ]; then
echo "Failed to determine signing identity"
exit 1
fi
COPY_PLIST_KEYS=(\
"DTSDKName" \
"DTXcode" \
"DTSDKBuild" \
"CFBundleDevelopmentRegion" \
"BuildMachineOSBuild" \
"DTPlatformName" \
"CFBundleSupportedPlatforms" \
"CFBundleInfoDictionaryVersion" \
"DTCompiler" \
"MinimumOSVersion" \
"UIDeviceFamily" \
"DTPlatformVersion" \
"DTXcodeBuild" \
"DTPlatformBuild" \
)
APP_PLIST="$APP_PATH/Info.plist"
if [ "$APP_TYPE" == "wallet" ]; then
APP_BINARY_TARGET="//Wallet:Wallet"
else
APP_BINARY_TARGET="//Telegram:Telegram"
fi
echo "Repacking frameworks..."
for DEPENDENCY in $(${BUCK} query "kind('apple_library', deps('${APP_BINARY_TARGET}#$PLATFORM_FLAVORS', 1))" "$@"); do
DEPENDENCY_PATH=$(echo "$DEPENDENCY" | sed -e "s#^//##" | sed -e "s#:#/#")
DEPENDENCY_NAME=$(echo "$DEPENDENCY" | sed -e "s/#.*//" | sed -e "s/^.*\://")
DYLIB_PATH="buck-out/gen/$DEPENDENCY_PATH/lib$DEPENDENCY_NAME.dylib"
mkdir -p "$FRAMEWORKS_DIR/${DEPENDENCY_NAME}.framework"
TARGET_DYLIB_PATH="$FRAMEWORKS_DIR/${DEPENDENCY_NAME}.framework/$DEPENDENCY_NAME"
PLIST_FILE="$FRAMEWORKS_DIR/${DEPENDENCY_NAME}.framework/Info.plist"
/usr/libexec/PlistBuddy -c "Add :CFBundleName string \"${DEPENDENCY_NAME}\"" "$PLIST_FILE" 1>/dev/null
/usr/libexec/PlistBuddy -c "Add :CFBundleVersion string \"1\"" "$PLIST_FILE"
/usr/libexec/PlistBuddy -c "Add :CFBundleShortVersionString string \"1.0\"" "$PLIST_FILE"
/usr/libexec/PlistBuddy -c "Add :CFBundlePackageType string \"FMWK\"" "$PLIST_FILE"
/usr/libexec/PlistBuddy -c "Add :CFBundleExecutable string \"${DEPENDENCY_NAME}\"" "$PLIST_FILE"
/usr/libexec/PlistBuddy -c "Add :CFBundleIdentifier string \"${BUNDLE_ID_PREFIX}.${DEPENDENCY_NAME}\"" "$PLIST_FILE"
for KEY in "${COPY_PLIST_KEYS[@]}"; do
VALUE=$(/usr/libexec/PlistBuddy -c "Print :$KEY" "$APP_PLIST" 2>/dev/null || echo "")
if [ ! -z "$VALUE" ]; then
PLUTIL_KEY=$(echo "$KEY" | sed 's/\./\\\./g')
VALUE=$(plutil -extract "$PLUTIL_KEY" xml1 -o - "$APP_PLIST")
plutil -insert "$PLUTIL_KEY" -xml "$VALUE" "$PLIST_FILE"
fi
done
plutil -convert binary1 "$PLIST_FILE"
cp "$DYLIB_PATH" "$TARGET_DYLIB_PATH"
DSYM_PATH="buck-out/gen/$(echo "$DEPENDENCY" | sed -e "s/#/#apple-dsym,/" | sed -e "s#^//##" | sed -e "s#:#/#").dSYM"
cp -r "$DSYM_PATH" "$DSYMS_DIR/"
done
if [ "$APP_TYPE" == "wallet" ]; then
APP_BINARY_DSYM_PATH="buck-out/gen/Wallet/Wallet#dwarf-and-dsym,$PLATFORM_FLAVORS,no-include-frameworks/Wallet.app.dSYM"
else
APP_BINARY_DSYM_PATH="buck-out/gen/Telegram/Telegram#dwarf-and-dsym,$PLATFORM_FLAVORS,no-include-frameworks/Telegram.app.dSYM"
fi
cp -r "$APP_BINARY_DSYM_PATH" "$DSYMS_DIR/"
if [ "$APP_TYPE" == "wallet" ]; then
EXTENSIONS=""
else
EXTENSIONS="Share Widget Intents NotificationContent NotificationService"
fi
for EXTENSION in $EXTENSIONS; do
EXTENSION_DSYM_PATH="buck-out/gen/Telegram/${EXTENSION}Extension#dwarf-and-dsym,$PLATFORM_FLAVORS,no-include-frameworks/${EXTENSION}Extension.appex.dSYM"
cp -r "$EXTENSION_DSYM_PATH" "$DSYMS_DIR/"
done
if [ "$APP_TYPE" != "wallet" ]; then
WATCH_EXTENSION_DSYM_PATH="buck-out/gen/Telegram/WatchAppExtension#dwarf-and-dsym,no-include-frameworks,watchos-arm64_32,watchos-armv7k/WatchAppExtension.appex.dSYM"
cp -r "$WATCH_EXTENSION_DSYM_PATH" "$DSYMS_DIR/"
fi
TEMP_DYLIB_DIR="$TEMP_PATH/SwiftSupport"
rm -rf "$TEMP_DYLIB_DIR"
mkdir -p "$TEMP_DYLIB_DIR"
mkdir -p "$TEMP_DYLIB_DIR/out"
if [ "$APP_TYPE" == "wallet" ]; then
EXECUTABLE_NAME="Wallet"
else
EXECUTABLE_NAME="Telegram"
fi
XCODE_PATH="$(xcode-select -p)"
TOOLCHAIN_PATH="$XCODE_PATH/Toolchains/XcodeDefault.xctoolchain"
if [ -f "$TOOLCHAIN_PATH/usr/lib/swift/iphoneos/libswiftCore.dylib" ]; then
SOURCE_LIBRARIES_PATH="$TOOLCHAIN_PATH/usr/lib/swift/iphoneos"
else
SOURCE_LIBRARIES_PATH="$TOOLCHAIN_PATH/usr/lib/swift-5.0/iphoneos"
fi
echo "Copying swift support files..."
xcrun swift-stdlib-tool \
--copy \
--strip-bitcode \
--platform iphoneos \
--toolchain "$TOOLCHAIN_PATH" \
--source-libraries "$SOURCE_LIBRARIES_PATH" \
--scan-executable "$APP_PATH/$EXECUTABLE_NAME" \
--scan-folder "$APP_PATH/Frameworks" \
--scan-folder "$APP_PATH/PlugIns" \
--destination "$TEMP_DYLIB_DIR"
for dylib in "$TEMP_DYLIB_DIR"/*.dylib; do
FILE_NAME=$(basename "$dylib")
lipo -extract armv7 "$dylib" -output "$dylib.armv7"
lipo -extract arm64 "$dylib" -output "$dylib.arm64"
lipo "$dylib.armv7" "$dylib.arm64" -create -output "$dylib.unstripped"
if [ "$PACKAGE_METHOD" == "enterprise" ]; then
xcrun strip -ST -o "$TEMP_DYLIB_DIR/out/$FILE_NAME" - "$dylib.unstripped" 2>/dev/null
xcrun bitcode_strip -r "$TEMP_DYLIB_DIR/out/$FILE_NAME" -o "$TEMP_DYLIB_DIR/out/$FILE_NAME" 1>/dev/null
else
cp "$dylib.unstripped" "$TEMP_DYLIB_DIR/out/$FILE_NAME"
fi
done
cp "$TEMP_DYLIB_DIR/out/"*.dylib "$IPA_PATH.original.unpacked/SwiftSupport/iphoneos/"
cp "$IPA_PATH.original.unpacked/SwiftSupport/iphoneos/"*.dylib "$FRAMEWORKS_DIR/"
REMOVE_ARCHS="armv7s arm64e"
for framework in "$FRAMEWORKS_DIR"/*; do
if [[ "$framework" == *.framework || "$framework" == *.dylib ]]; then
if [[ "$framework" == *.framework ]]; then
FRAMEWORK_NAME=$(basename "$framework" | sed -e 's/\.framework//')
for ARCH in $REMOVE_ARCHS; do
lipo -remove "$ARCH" "$framework/$FRAMEWORK_NAME" -o "$framework/$FRAMEWORK_NAME" 2>/dev/null || true
done
xcrun bitcode_strip -r "$framework/$FRAMEWORK_NAME" -o "$framework/$FRAMEWORK_NAME" 1>/dev/null
xcrun strip -S -T -x "$framework/$FRAMEWORK_NAME" 1>/dev/null
/usr/bin/codesign ${VERBOSE} ${KEYCHAIN_FLAG} -f -s "$COMMON_IDENTITY_HASH" "$framework" 1>/dev/null
else
/usr/bin/codesign ${VERBOSE} ${KEYCHAIN_FLAG} -f -s "$COMMON_IDENTITY_HASH" "$framework" 1>/dev/null
fi
fi
done
echo "Signing..."
if [ "$APP_TYPE" == "wallet" ]; then
PLUGINS=""
else
PLUGINS="Share Widget Intents NotificationService NotificationContent"
fi
for PLUGIN in $PLUGINS; do
PLUGIN_PATH="$APP_PATH/PlugIns/${PLUGIN}Extension.appex"
if [ ! -d "$PLUGIN_PATH" ]; then
echo "Directory at $PLUGIN_PATH does not exist"
exit 1
fi
PROFILE_PATH_VAR="PROFILE_PATH_EXTENSION_$PLUGIN"
if [ -z "${!PROFILE_PATH_VAR}" ]; then
echo "$PROFILE_PATH_VAR is not defined"
exit 1
fi
if [ ! -f "${!PROFILE_PATH_VAR}" ]; then
echo "${!PROFILE_PATH_VAR} does not exist"
exit 1
fi
ENTITLEMENTS_PATH_VAR="ENTITLEMENTS_PATH_EXTENSION_$PLUGIN"
if [ -z "${!ENTITLEMENTS_PATH_VAR}" ]; then
echo "$ENTITLEMENTS_PATH_VAR is not defined"
exit 1
fi
if [ ! -f "${!ENTITLEMENTS_PATH_VAR}" ]; then
echo "${!ENTITLEMENTS_PATH_VAR} does not exist"
exit 1
fi
cp "${!PROFILE_PATH_VAR}" "$PLUGIN_PATH/embedded.mobileprovision"
/usr/bin/codesign ${VERBOSE} -f -s "$COMMON_IDENTITY_HASH" --entitlements "${!ENTITLEMENTS_PATH_VAR}" "$PLUGIN_PATH"
done
if [ "$APP_TYPE" != "wallet" ]; then
WATCH_APP_PATH="$APP_PATH/Watch/WatchApp.app"
WATCH_EXTENSION_PATH="$WATCH_APP_PATH/PlugIns/WatchAppExtension.appex"
WATCH_EXTENSION_PROFILE_PATH_VAR="PROFILE_PATH_WATCH_EXTENSION"
if [ -z "${!WATCH_EXTENSION_PROFILE_PATH_VAR}" ]; then
echo "$WATCH_EXTENSION_PROFILE_PATH_VAR is not defined"
exit 1
fi
if [ ! -f "${!WATCH_EXTENSION_PROFILE_PATH_VAR}" ]; then
echo "${!WATCH_EXTENSION_PROFILE_PATH_VAR} does not exist"
exit 1
fi
WATCH_EXTENSION_ENTITLEMENTS_PATH_VAR="ENTITLEMENTS_PATH_WATCH_EXTENSION"
if [ -z "${!WATCH_EXTENSION_ENTITLEMENTS_PATH_VAR}" ]; then
echo "$WATCH_EXTENSION_ENTITLEMENTS_PATH_VAR is not defined"
exit 1
fi
if [ ! -f "${!WATCH_EXTENSION_ENTITLEMENTS_PATH_VAR}" ]; then
echo "${!WATCH_EXTENSION_ENTITLEMENTS_PATH_VAR} does not exist"
exit 1
fi
cp "${!WATCH_EXTENSION_PROFILE_PATH_VAR}" "$WATCH_EXTENSION_PATH/embedded.mobileprovision"
/usr/bin/codesign ${VERBOSE} -f -s "$COMMON_IDENTITY_HASH" --entitlements "${!WATCH_EXTENSION_ENTITLEMENTS_PATH_VAR}" "$WATCH_EXTENSION_PATH" 2>/dev/null
WATCH_APP_PROFILE_PATH_VAR="PROFILE_PATH_WATCH_APP"
if [ -z "${!WATCH_APP_PROFILE_PATH_VAR}" ]; then
echo "$WATCH_APP_PROFILE_PATH_VAR is not defined"
exit 1
fi
if [ ! -f "${!WATCH_APP_PROFILE_PATH_VAR}" ]; then
echo "${!WATCH_APP_PROFILE_PATH_VAR} does not exist"
exit 1
fi
WATCH_APP_ENTITLEMENTS_PATH_VAR="ENTITLEMENTS_PATH_WATCH_APP"
if [ -z "${!WATCH_APP_ENTITLEMENTS_PATH_VAR}" ]; then
echo "$WATCH_APP_ENTITLEMENTS_PATH_VAR is not defined"
exit 1
fi
if [ ! -f "${!WATCH_APP_ENTITLEMENTS_PATH_VAR}" ]; then
echo "${!WATCH_APP_ENTITLEMENTS_PATH_VAR} does not exist"
exit 1
fi
cp "${!WATCH_APP_PROFILE_PATH_VAR}" "$WATCH_APP_PATH/embedded.mobileprovision"
/usr/bin/codesign ${VERBOSE} -f -s "$COMMON_IDENTITY_HASH" --entitlements "${!WATCH_APP_ENTITLEMENTS_PATH_VAR}" "$WATCH_APP_PATH" 2>/dev/null
fi
APP_PROFILE_PATH_VAR="PROFILE_PATH_APP"
if [ -z "${!APP_PROFILE_PATH_VAR}" ]; then
echo "$APP_PROFILE_PATH_VAR is not defined"
exit 1
fi
if [ ! -f "${!APP_PROFILE_PATH_VAR}" ]; then
echo "${!APP_PROFILE_PATH_VAR} does not exist"
exit 1
fi
APP_ENTITLEMENTS_PATH_VAR="ENTITLEMENTS_PATH_APP"
if [ -z "${!APP_ENTITLEMENTS_PATH_VAR}" ]; then
echo "$APP_ENTITLEMENTS_PATH_VAR is not defined"
exit 1
fi
if [ ! -f "${!APP_ENTITLEMENTS_PATH_VAR}" ]; then
echo "${!APP_ENTITLEMENTS_PATH_VAR} does not exist"
exit 1
fi
cp "${!APP_PROFILE_PATH_VAR}" "$APP_PATH/embedded.mobileprovision"
/usr/bin/codesign ${VERBOSE} -f -s "$COMMON_IDENTITY_HASH" --entitlements "${!APP_ENTITLEMENTS_PATH_VAR}" "$APP_PATH"
DIR=$(pwd)
cd "$UNPACKED_PATH"
if [ "$PACKAGE_METHOD" == "appstore" ]; then
zip -r "../${APP_NAME}_signed.ipa" Payload SwiftSupport WatchKitSupport2 1>/dev/null
elif [ "$PACKAGE_METHOD" == "enterprise" ]; then
zip -r "../${APP_NAME}_signed.ipa" Payload 1>/dev/null
fi
cd "$DIR"
cd "$BUILD_PATH"
zip -r "$DSYMS_FOLDER_NAME.zip" "$DSYMS_FOLDER_NAME" 1>/dev/null
cd "$DIR"
echo "Done"