Build
Cocoapods
The easiest way to build the project is to use cocoapods.
SDK frameworks should be added to private cocoapods repo. Details available on the cocoapods website.
Podfile example
install! 'cocoapods', :deterministic_uuids => false
minimum_deployment_target = '11.0'
platform :ios, minimum_deployment_target
source <YOUR_PRIVATE_REPOSITORY>
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/brion/OGVKit-Specs.git'
use_frameworks!
inhibit_all_warnings!
project IMClient,
def import_common_pods
pod 'Firebase', :subspecs => ['Core', 'RemoteConfig']
end
def messaging_kit_pod (name, subspecs)
pod name, '~> 8400.1.1', :subspecs => subspecs
end
def import_app_pods
pod 'StaticDataTableViewController', '~> 2.0'
end
app_target_name = 'IMClient'
target app_target_name do
messaging_kit_pod('TPDMessagingKit', ['Core', 'Conversation', 'Calls', 'Passcode'])
end
# Uncomment if you need Share Extension
#
# share_ext_target_name = 'ShareExt'
#
# target share_ext_target_name do
# messaging_kit_pod('TPDMessagingKit_AppExtension', ['Core', 'Conversation', 'Passcode'])
# end
pods_for_patching_in_share_ext = ['TPDMessagingKit_AppExtension', 'TPDUIKit_AppExtension']
pods_for_patching_in_app = ["Pods-#{app_target_name}}"]
def patch_xconfig (config_path, excess_pods, excess_definitions = [])
excess_pods.each do |pod|
%x[sed -i '' -E 's/(-isystem[[:space:]]+)?"\\$\\{PODS_ROOT\\}\\/Headers\\/Public\\/'"#{pod}"'"//g' "#{config_path}"]
%x[sed -i '' -E 's/"\\$\\{PODS_CONFIGURATION_BUILD_DIR\\}\\/'"#{pod}"'"//g' "#{config_path}"]
%x[sed -i '' -E 's/-iquote[[:space:]]"\\$\\{PODS_CONFIGURATION_BUILD_DIR\\}\\/'"#{pod}"'\\/'"#{pod}"'\\.framework\\/Headers"//g' "#{config_path}"]
%x[sed -i '' -E 's/-framework[[:space:]]"'"#{pod}"'"//g' "#{config_path}"]
end
excess_definitions.each do |d|
%x[sed -i '' -E 's/'"#{d}"'/ /g' "#{config_path}"]
end
end
def patch_target (target, excess_pods, excess_definitions = [])
target.xcconfigs.each do |name,_|
patch_xconfig("#{target.client_root}/#{target.xcconfig_relative_path(name)}", excess_pods, excess_definitions)
end
end
def patch_colors_path (uikit_root_path)
uikit_root_path.gsub!("/", "\\/")
%x[sed -i '' -E 's/TPD_UIKIT_ROOT_PATH[[:blank:]]*=[[:blank:]]*.*/TPD_UIKIT_ROOT_PATH = #{uikit_root_path}/' CommonBuildConfig.xcconfig]
end
post_install do |installer|
excess_pods_for_share_ext = ['TPDMessagingKit', 'TPDUIKit']
excess_pods_for_app = ['TPDMessagingKit_AppExtension', 'TPDUIKit_AppExtension']
installer.aggregate_targets.each do |target|
target.pod_targets.each do |pt|
if pt.name == 'TPDUIKit'
patch_colors_path("#{pt.pod_target_srcroot}")
end
end
end
installer.aggregate_targets.each do |target|
if target.target_definition.name == share_ext_target_name
patch_target(target, excess_pods_for_share_ext)
end
if target.target_definition.name == app_target_name
patch_target(target, excess_pods_for_app, ['TPDMESSAGINGKIT_TARGET_IS_EXTENSION', 'TPDUIKIT_TARGET_IS_EXTENSION'])
end
target.pod_targets.each do |pt|
if pods_for_patching_in_share_ext.include? pt.name
debugName = "#{pt.xcconfig_path}".sub(".xcconfig", ".debug.xcconfig")
releaseName = "#{pt.xcconfig_path}".sub(".xcconfig", ".release.xcconfig")
patch_xconfig(debugName, excess_pods_for_share_ext)
patch_xconfig(releaseName, excess_pods_for_share_ext)
end
if pods_for_patching_in_app.include? pt.name
patch_xconfig("#{pt.xcconfig_path}", excess_pods_for_app)
end
if 'FMDB' == pt.name
debugName = "#{pt.xcconfig_path}".sub(".xcconfig", ".debug.xcconfig")
releaseName = "#{pt.xcconfig_path}".sub(".xcconfig", ".release.xcconfig")
%x[sed -i '' -E 's/-l"sqlite3"//g' "#{debugName}"]
%x[sed -i '' -E 's/-l"sqlite3"//g' "#{releaseName}"]
end
end
end
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if !config.name.end_with?('-AppStore') && config.name != 'Release' && config.name != 'Debug'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = ['$(inherited)', 'TPL_LOGS_ENABLED=1', 'MT_LOGS_ENABLED=1', 'TL_LOGS_ENABLED=1',
'TPDMESSAGINGKIT_LOGS_ENABLED=1']
end
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings['LD_RUNPATH_SEARCH_PATHS'] = ['$(inherited)', '$(FRAMEWORK_SEARCH_PATHS)', '$(CONFIGURATION_BUILD_DIR)']
if 'FMDB' == target.name
config.build_settings['HEADER_SEARCH_PATHS'] = ['$(inherited)', '${PODS_ROOT}/SQLCipher']
end
# workaround for xCode 12 (target iOS = 8 is not supported anymore)
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = minimum_deployment_target
end
end
installer.pods_project.build_configurations.each do |config|
config.build_settings.delete('CODE_SIGNING_ALLOWED')
config.build_settings.delete('CODE_SIGNING_REQUIRED')
end
end
plugin 'cocoapods-acknowledgements',
:settings_bundle => true,
:exclude => ['DynamicWebRTC', 'TPLKit', 'MTProtoKit', 'TLAPIKit', 'TPDMessagingKit', 'TPDMessagingKit_AppExtension',
'TPDFoundation', 'TPDUIKit', 'TPDUIKit_AppExtension', 'TelepadoPhotoLibrary', 'RSFoundationUtils', 'RSTimeAgo',
'RSPagedItemsController'],
:settings_post_process => Proc.new { |settings_plist_path, umbrella_target|
require 'colored2'
has_unaccepted_lines = false
file_path = "Pods/#{umbrella_target.cocoapods_target_label}-metadata.plist"
File.open(file_path) do |f|
f.each_line do |line|
if line =~ /(tpado|Telepado|RishatShamsutdinov)/
puts "Unaccepted line: #{line.strip}".red
has_unaccepted_lines = true
end
end
end
if has_unaccepted_lines
puts "Seems like you didn't exclude private Telepado pods from acknowledgements.".red
raise "#{file_path} contains unaccepted lines."
end
}Last updated
