Podfile 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. platform :osx, '10.14'
  2. # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
  3. ENV['COCOAPODS_DISABLE_STATS'] = 'true'
  4. project 'Runner', {
  5. 'Debug' => :debug,
  6. 'Profile' => :release,
  7. 'Release' => :release,
  8. }
  9. def flutter_root
  10. generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
  11. unless File.exist?(generated_xcode_build_settings_path)
  12. raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
  13. end
  14. File.foreach(generated_xcode_build_settings_path) do |line|
  15. matches = line.match(/FLUTTER_ROOT\=(.*)/)
  16. return matches[1].strip if matches
  17. end
  18. raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
  19. end
  20. require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
  21. flutter_macos_podfile_setup
  22. def build_specify_archs_only
  23. if ENV.has_key?('BUILD_ACTIVE_ARCHS_ONLY')
  24. xcodeproj_path = File.dirname(__FILE__) + '/Runner.xcodeproj'
  25. project = Xcodeproj::Project.open(xcodeproj_path)
  26. project.targets.each do |target|
  27. if target.name == 'Runner'
  28. target.build_configurations.each do |config|
  29. config.build_settings['ONLY_ACTIVE_ARCH'] = ENV['BUILD_ACTIVE_ARCHS_ONLY']
  30. end
  31. end
  32. end
  33. project.save()
  34. end
  35. if ENV.has_key?('BUILD_ARCHS')
  36. xcodeproj_path = File.dirname(__FILE__) + '/Runner.xcodeproj'
  37. project = Xcodeproj::Project.open(xcodeproj_path)
  38. project.targets.each do |target|
  39. if target.name == 'Runner'
  40. target.build_configurations.each do |config|
  41. config.build_settings['ARCHS'] = ENV['BUILD_ARCHS']
  42. end
  43. end
  44. end
  45. project.save()
  46. end
  47. end
  48. build_specify_archs_only()
  49. target 'Runner' do
  50. use_frameworks!
  51. use_modular_headers!
  52. flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
  53. end
  54. post_install do |installer|
  55. installer.pods_project.targets.each do |target|
  56. flutter_additional_macos_build_settings(target)
  57. end
  58. installer.aggregate_targets.each do |target|
  59. target.xcconfigs.each do |variant, xcconfig|
  60. xcconfig_path = target.client_root + target.xcconfig_relative_path(variant)
  61. IO.write(xcconfig_path, IO.read(xcconfig_path).gsub("DT_TOOLCHAIN_DIR", "TOOLCHAIN_DIR"))
  62. end
  63. end
  64. installer.pods_project.targets.each do |target|
  65. target.build_configurations.each do |config|
  66. if config.base_configuration_reference.is_a? Xcodeproj::Project::Object::PBXFileReference
  67. xcconfig_path = config.base_configuration_reference.real_path
  68. IO.write(xcconfig_path, IO.read(xcconfig_path).gsub("DT_TOOLCHAIN_DIR", "TOOLCHAIN_DIR"))
  69. end
  70. end
  71. end
  72. end