Podfile 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. # Uncomment this line to define a global platform for your project
  2. platform :ios, '10.0'
  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 parse_KV_file(file, separator='=')
  11. file_abs_path = File.expand_path(file)
  12. if !File.exists? file_abs_path
  13. return [];
  14. end
  15. pods_ary = []
  16. skip_line_start_symbols = ["#", "/"]
  17. File.foreach(file_abs_path) { |line|
  18. next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
  19. plugin = line.split(pattern=separator)
  20. if plugin.length == 2
  21. podname = plugin[0].strip()
  22. path = plugin[1].strip()
  23. podpath = File.expand_path("#{path}", file_abs_path)
  24. pods_ary.push({:name => podname, :path => podpath});
  25. else
  26. puts "Invalid plugin specification: #{line}"
  27. end
  28. }
  29. return pods_ary
  30. end
  31. target 'Runner' do
  32. # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  33. # referring to absolute paths on developers' machines.
  34. system('rm -rf .symlinks')
  35. system('mkdir -p .symlinks/plugins')
  36. # Flutter Pods
  37. generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
  38. if generated_xcode_build_settings.empty?
  39. puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
  40. end
  41. generated_xcode_build_settings.map { |p|
  42. if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
  43. symlink = File.join('.symlinks', 'flutter')
  44. File.symlink(File.dirname(p[:path]), symlink)
  45. pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
  46. end
  47. }
  48. # Plugin Pods
  49. plugin_pods = parse_KV_file('../.flutter-plugins')
  50. plugin_pods.map { |p|
  51. symlink = File.join('.symlinks', 'plugins', p[:name])
  52. File.symlink(p[:path], symlink)
  53. pod p[:name], :path => File.join(symlink, 'ios')
  54. }
  55. pod 'Logan', :path => '../../../Logan-opensource/'
  56. end
  57. target 'flutter_logan_exampleTests' do
  58. pod 'Kiwi'
  59. end
  60. # Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
  61. install! 'cocoapods', :disable_input_output_paths => true
  62. post_install do |installer|
  63. installer.pods_project.targets.each do |target|
  64. target.build_configurations.each do |config|
  65. config.build_settings['ENABLE_BITCODE'] = 'NO'
  66. end
  67. end
  68. end