Podfile 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # Using a CDN with CocoaPods 1.7.2 or later can save a lot of time on pod installation, but it's experimental rather than the default.
  2. # source 'https://cdn.cocoapods.org/'
  3. # Uncomment this line to define a global platform for your project
  4. # platform :ios, '9.0'
  5. # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
  6. ENV['COCOAPODS_DISABLE_STATS'] = 'true'
  7. project 'Runner', {
  8. 'Debug' => :debug,
  9. 'Profile' => :release,
  10. 'Release' => :release,
  11. }
  12. pod 'Firebase/Analytics'
  13. def parse_KV_file(file, separator='=')
  14. file_abs_path = File.expand_path(file)
  15. if !File.exists? file_abs_path
  16. return [];
  17. end
  18. pods_ary = []
  19. skip_line_start_symbols = ["#", "/"]
  20. File.foreach(file_abs_path) { |line|
  21. next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
  22. plugin = line.split(pattern=separator)
  23. if plugin.length == 2
  24. podname = plugin[0].strip()
  25. path = plugin[1].strip()
  26. podpath = File.expand_path("#{path}", file_abs_path)
  27. pods_ary.push({:name => podname, :path => podpath});
  28. else
  29. puts "Invalid plugin specification: #{line}"
  30. end
  31. }
  32. return pods_ary
  33. end
  34. target 'Runner' do
  35. # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  36. # referring to absolute paths on developers' machines.
  37. system('rm -rf .symlinks')
  38. system('mkdir -p .symlinks/plugins')
  39. # Flutter Pods
  40. generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
  41. if generated_xcode_build_settings.empty?
  42. puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
  43. end
  44. generated_xcode_build_settings.map { |p|
  45. if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
  46. symlink = File.join('.symlinks', 'flutter')
  47. File.symlink(File.dirname(p[:path]), symlink)
  48. pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
  49. end
  50. }
  51. # Plugin Pods
  52. plugin_pods = parse_KV_file('../.flutter-plugins')
  53. plugin_pods.map { |p|
  54. symlink = File.join('.symlinks', 'plugins', p[:name])
  55. File.symlink(p[:path], symlink)
  56. pod p[:name], :path => File.join(symlink, 'ios')
  57. }
  58. end
  59. # Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
  60. install! 'cocoapods', :disable_input_output_paths => true
  61. post_install do |installer|
  62. installer.pods_project.targets.each do |target|
  63. target.build_configurations.each do |config|
  64. config.build_settings['ENABLE_BITCODE'] = 'NO'
  65. end
  66. end
  67. end