Podfile 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. platform :ios, '12.2'
  2. use_frameworks!
  3. ###
  4. # OWS Pods
  5. ###
  6. source 'https://cdn.cocoapods.org/'
  7. pod 'SwiftProtobuf', ">= 1.14.0"
  8. pod 'SignalCoreKit', git: 'git@github.com:signalapp/SignalCoreKit', testspecs: ["Tests"]
  9. # pod 'SignalCoreKit', path: '../SignalCoreKit', testspecs: ["Tests"]
  10. pod 'LibSignalClient', git: 'https://github.com/signalapp/libsignal-client.git', testspecs: ["Tests"]
  11. # pod 'LibSignalClient', path: '../libsignal-client', testspecs: ["Tests"]
  12. pod 'Curve25519Kit', git: 'ssh://git@github.com/signalapp/Curve25519Kit', testspecs: ["Tests"], branch: 'feature/SignalClient-adoption'
  13. # pod 'Curve25519Kit', path: '../Curve25519Kit', testspecs: ["Tests"]
  14. pod 'blurhash', git: 'https://github.com/signalapp/blurhash', branch: 'signal-master'
  15. # pod 'blurhash', path: '../blurhash'
  16. pod 'SignalRingRTC', path: 'ThirdParty/SignalRingRTC.podspec', inhibit_warnings: true
  17. pod 'SignalArgon2', git: 'https://github.com/signalapp/Argon2.git', submodules: true, testspecs: ["Tests"]
  18. # pod 'SignalArgon2', path: '../Argon2', testspecs: ["Tests"]
  19. # pod 'GRDB.swift/SQLCipher', path: '../GRDB.swift'
  20. pod 'GRDB.swift/SQLCipher'
  21. pod 'SQLCipher', ">= 4.0.1"
  22. ###
  23. # forked third party pods
  24. ###
  25. # Forked for performance optimizations that are not likely to be upstreamed as they are specific
  26. # to our limited use of Mantle
  27. pod 'Mantle', git: 'https://github.com/signalapp/Mantle', branch: 'signal-master'
  28. # pod 'Mantle', path: '../Mantle'
  29. # Forked to incorporate our self-built binary artifact.
  30. pod 'OpenSSL-Universal', git: 'https://github.com/signalapp/GRKOpenSSLFramework'
  31. # pod 'OpenSSL-Universal', path: '../GRKOpenSSLFramework'
  32. pod 'libPhoneNumber-iOS', git: 'https://github.com/signalapp/libPhoneNumber-iOS', branch: 'signal-master'
  33. # pod 'libPhoneNumber-iOS', path: '../libPhoneNumber-iOS'
  34. pod 'YYImage', git: 'https://github.com/signalapp/YYImage', :inhibit_warnings => true
  35. pod 'YYImage/libwebp', git: 'https://github.com/signalapp/YYImage', :inhibit_warnings => true
  36. pod 'libwebp'
  37. # pod 'YYImage', path: '../YYImage'
  38. # pod 'YYImage/libwebp', path:'../YYImage'
  39. ###
  40. # third party pods
  41. ####
  42. pod 'Reachability', :inhibit_warnings => true
  43. def ui_pods
  44. pod 'BonMot', inhibit_warnings: true
  45. pod 'PureLayout', :inhibit_warnings => true
  46. pod 'lottie-ios', :inhibit_warnings => true
  47. pod 'Starscream', git: 'https://github.com/signalapp/Starscream.git', branch: 'signal-release'
  48. # pod 'Starscream', path: '../Starscream'
  49. pod 'LibMobileCoin/CoreHTTP', git: 'https://github.com/signalapp/libmobilecoin-ios-artifacts.git', branch: 'signal/1.2.2'
  50. pod 'MobileCoin/CoreHTTP', git: 'https://github.com/mobilecoinofficial/MobileCoin-Swift.git', :tag => 'v1.2.2'
  51. end
  52. target 'Signal' do
  53. project 'Signal.xcodeproj', 'Debug' => :debug, 'Release' => :release
  54. # Pods only available inside the main Signal app
  55. pod 'SSZipArchive', :inhibit_warnings => true
  56. ui_pods
  57. target 'SignalTests' do
  58. inherit! :search_paths
  59. end
  60. target 'SignalPerformanceTests' do
  61. inherit! :search_paths
  62. end
  63. end
  64. # These extensions inherit all of the common pods
  65. target 'SignalMessaging' do
  66. pod 'MobileCoinMinimal', git: 'https://github.com/signalapp/MobileCoin-Swift.git', branch: 'charlesmchen/mobileCoinMinimal', testspecs: ["Tests"]
  67. # pod 'MobileCoinMinimal', path: '../MobileCoinMinimal', testspecs: ["Tests"]
  68. end
  69. target 'SignalShareExtension' do
  70. ui_pods
  71. end
  72. target 'SignalUI' do
  73. ui_pods
  74. target 'SignalUITests' do
  75. inherit! :search_paths
  76. end
  77. end
  78. target 'SignalServiceKit' do
  79. pod 'CocoaLumberjack'
  80. pod 'SAMKeychain'
  81. target 'SignalServiceKitTests' do
  82. inherit! :search_paths
  83. end
  84. end
  85. target 'SignalNSE' do
  86. end
  87. post_install do |installer|
  88. enable_strip(installer)
  89. enable_extension_support_for_purelayout(installer)
  90. configure_warning_flags(installer)
  91. configure_testable_build(installer)
  92. promote_minimum_supported_version(installer)
  93. disable_bitcode(installer)
  94. disable_armv7(installer)
  95. strip_valid_archs(installer)
  96. update_frameworks_script(installer)
  97. disable_non_development_pod_warnings(installer)
  98. copy_acknowledgements
  99. end
  100. # Works around CocoaPods behavior designed for static libraries.
  101. # See https://github.com/CocoaPods/CocoaPods/issues/10277
  102. def enable_strip(installer)
  103. installer.pods_project.build_configurations.each do |build_configuration|
  104. build_configuration.build_settings['STRIP_INSTALLED_PRODUCT'] = 'YES'
  105. end
  106. end
  107. # PureLayout by default makes use of UIApplication, and must be configured to be built for an extension.
  108. def enable_extension_support_for_purelayout(installer)
  109. installer.pods_project.targets.each do |target|
  110. if target.name.end_with? "PureLayout"
  111. target.build_configurations.each do |build_configuration|
  112. build_configuration.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= '$(inherited)'
  113. build_configuration.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << ' PURELAYOUT_APP_EXTENSIONS=1'
  114. end
  115. end
  116. end
  117. end
  118. # We want some warning to be treated as errors.
  119. #
  120. # NOTE: We have to manually keep this list in sync with what's in our
  121. # Signal.xcodeproj config in Xcode go to:
  122. # Signal Project > Build Settings > Other Warning Flags
  123. def configure_warning_flags(installer)
  124. installer.pods_project.targets.each do |target|
  125. target.build_configurations.each do |build_configuration|
  126. build_configuration.build_settings['WARNING_CFLAGS'] = ['$(inherited)',
  127. '-Werror=incompatible-pointer-types',
  128. '-Werror=protocol',
  129. '-Werror=incomplete-implementation',
  130. '-Werror=objc-literal-conversion',
  131. '-Werror=objc-property-synthesis',
  132. '-Werror=objc-protocol-property-synthesis']
  133. end
  134. end
  135. end
  136. def configure_testable_build(installer)
  137. installer.pods_project.targets.each do |target|
  138. target.build_configurations.each do |build_configuration|
  139. next unless ["Testable Release", "Debug", "Profiling"].include?(build_configuration.name)
  140. build_configuration.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
  141. build_configuration.build_settings['OTHER_CFLAGS'] ||= '$(inherited)'
  142. build_configuration.build_settings['OTHER_CFLAGS'] << ' -DTESTABLE_BUILD'
  143. build_configuration.build_settings['OTHER_SWIFT_FLAGS'] ||= '$(inherited)'
  144. build_configuration.build_settings['OTHER_SWIFT_FLAGS'] << ' -DTESTABLE_BUILD'
  145. if target.name.end_with? "PureLayout"
  146. # Avoid overwriting the PURELAYOUT_APP_EXTENSIONS.
  147. else
  148. build_configuration.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= '$(inherited)'
  149. build_configuration.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << ' TESTABLE_BUILD=1'
  150. end
  151. build_configuration.build_settings['ENABLE_TESTABILITY'] = 'YES'
  152. end
  153. end
  154. end
  155. # Xcode 13 dropped support for some older iOS versions. We only need them
  156. # to support our project's minimum version, so let's bump each Pod's min
  157. # version to our min to suppress these warnings.
  158. def promote_minimum_supported_version(installer)
  159. project_min_version = current_target_definition.platform.deployment_target
  160. installer.pods_project.targets.each do |target|
  161. target.build_configurations.each do |build_configuration|
  162. target_version_string = build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
  163. target_version = Version.create(target_version_string)
  164. if target_version < project_min_version
  165. build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = project_min_version.version
  166. end
  167. end
  168. end
  169. end
  170. def disable_bitcode(installer)
  171. installer.pods_project.targets.each do |target|
  172. target.build_configurations.each do |config|
  173. config.build_settings['ENABLE_BITCODE'] = 'NO'
  174. end
  175. end
  176. end
  177. def disable_armv7(installer)
  178. installer.pods_project.targets.each do |target|
  179. target.build_configurations.each do |config|
  180. config.build_settings['EXCLUDED_ARCHS'] = 'armv7'
  181. end
  182. end
  183. end
  184. def strip_valid_archs(installer)
  185. Dir.glob('Pods/Target Support Files/**/*.xcconfig') do |xcconfig_path|
  186. xcconfig = File.read(xcconfig_path)
  187. xcconfig_mod = xcconfig.gsub('VALID_ARCHS[sdk=iphoneos*] = arm64', '')
  188. xcconfig_mod = xcconfig_mod.gsub('VALID_ARCHS[sdk=iphonesimulator*] = x86_64 arm64', '')
  189. xcconfig_mod = xcconfig_mod.gsub('VALID_ARCHS[sdk=iphonesimulator*] = x86_64', '')
  190. File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
  191. end
  192. end
  193. #update_framework_scripts updates Pod-Signal-frameworks.sh to fix a bug in the .XCFramework->.framework
  194. #conversation process, by ensuring symlinks are properly respected in the XCFramework.
  195. #See https://github.com/CocoaPods/CocoaPods/issues/7587
  196. def update_frameworks_script(installer)
  197. fw_script = File.read('Pods/Target Support Files/Pods-Signal/Pods-Signal-frameworks.sh')
  198. fw_script_mod = fw_script.gsub(' lipo -remove "$arch" -output "$binary" "$binary"
  199. ', ' realBinary="${binary}"
  200. if [ -L "${realBinary}" ]; then
  201. echo "Symlinked..."
  202. dirname="$(dirname "${realBinary}")"
  203. realBinary="${dirname}/$(readlink "${realBinary}")"
  204. fi
  205. lipo -remove "${arch}" -output "${realBinary}" "${realBinary}" || exit 1')
  206. File.open('Pods/Target Support Files/Pods-Signal/Pods-Signal-frameworks.sh', "w") { |file| file << fw_script_mod }
  207. end
  208. # Disable warnings on any Pod not currently being modified
  209. def disable_non_development_pod_warnings(installer)
  210. non_development_targets = installer.pod_targets.select do |target|
  211. !installer.development_pod_targets.include?(target)
  212. end
  213. installer.pods_project.targets.each do |target|
  214. target.build_configurations.each do |build_configuration|
  215. # Only suppress warnings for the debug configuration
  216. # If we're building for release, continue to display warnings for all projects
  217. next if build_configuration.name != "Debug"
  218. next unless non_development_targets.any? do |non_dev_target|
  219. target.name.include?(non_dev_target.name)
  220. end
  221. build_configuration.build_settings['GCC_WARN_INHIBIT_ALL_WARNINGS'] = 'YES'
  222. build_configuration.build_settings['OTHER_SWIFT_FLAGS'] ||= '$(inherited)'
  223. build_configuration.build_settings['OTHER_SWIFT_FLAGS'] << ' -suppress-warnings'
  224. end
  225. end
  226. end
  227. def copy_acknowledgements
  228. targets = [
  229. 'Signal',
  230. 'SignalMessaging',
  231. 'SignalNSE',
  232. 'SignalPerformanceTests',
  233. 'SignalServiceKit',
  234. 'SignalServiceKitTests',
  235. 'SignalShareExtension',
  236. 'SignalTests',
  237. 'SignalUI',
  238. 'SignalUITests'
  239. ]
  240. acknowledgements_files = targets.map do |target|
  241. "Pods/Target Support Files/Pods-#{target}/Pods-#{target}-Acknowledgements.plist"
  242. end
  243. def get_specifier_groups(acknowledgements_files)
  244. acknowledgements_files.map do |file|
  245. extract_cmd = ['plutil', '-extract', 'PreferenceSpecifiers', 'json', '-o', '-', file]
  246. io = IO.popen(extract_cmd, unsetenv_others: true, exception: true)
  247. result = JSON.parse(io.read)
  248. io.close
  249. status = $?
  250. raise status unless status.exitstatus == 0
  251. result
  252. end
  253. end
  254. def get_acknowledgements_specifiers(group)
  255. group[1...-1]
  256. end
  257. def write_output_file(specifiers)
  258. output_file = 'Signal/Settings.bundle/Acknowledgements.plist'
  259. output_json = JSON.dump(specifiers)
  260. system('plutil', '-create', 'xml1', output_file, exception: true)
  261. system('plutil', '-insert', 'PreferenceSpecifiers', '-json', output_json, '-append', output_file, exception: true)
  262. end
  263. specifier_groups = get_specifier_groups(acknowledgements_files)
  264. header_specifier = specifier_groups.first.first
  265. footer_specifier = specifier_groups.first.last
  266. all_acknowledgements_specifiers = specifier_groups.flat_map {|g| get_acknowledgements_specifiers(g)}
  267. cleaned_acknowledgements_specifiers = all_acknowledgements_specifiers
  268. .uniq {|s| s["Title"]}
  269. .sort_by {|s| s["Title"].downcase}
  270. final_specifiers = [header_specifier] + cleaned_acknowledgements_specifiers + [footer_specifier]
  271. write_output_file(final_specifiers)
  272. end