Podfile 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
  2. platform :ios, '15.5'
  3. # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
  4. ENV['COCOAPODS_DISABLE_STATS'] = 'true'
  5. project 'Runner', {
  6. 'Debug' => :debug,
  7. 'Profile' => :release,
  8. 'Release' => :release,
  9. }
  10. def flutter_root
  11. generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  12. unless File.exist?(generated_xcode_build_settings_path)
  13. raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  14. end
  15. File.foreach(generated_xcode_build_settings_path) do |line|
  16. matches = line.match(/FLUTTER_ROOT\=(.*)/)
  17. return matches[1].strip if matches
  18. end
  19. raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
  20. end
  21. require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
  22. flutter_ios_podfile_setup
  23. target 'Runner' do
  24. use_modular_headers!
  25. flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
  26. target 'RunnerTests' do
  27. inherit! :search_paths
  28. end
  29. end
  30. post_install do |installer|
  31. installer.pods_project.build_configurations.each do |config|
  32. config.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
  33. end
  34. installer.pods_project.targets.each do |target|
  35. flutter_additional_ios_build_settings(target)
  36. target.build_configurations.each do |config|
  37. config.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
  38. if config.name == 'Release'
  39. config.build_settings['GCC_OPTIMIZATION_LEVEL'] = 's'
  40. config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-O'
  41. config.build_settings['SWIFT_COMPILATION_MODE'] = 'wholemodule'
  42. end
  43. end
  44. end
  45. end