Podfile 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # Uncomment this line to define a global platform for your project
  2. # platform :ios, '9.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 packages 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. end
  56. post_install do |installer|
  57. installer.pods_project.targets.each do |target|
  58. target.build_configurations.each do |config|
  59. config.build_settings['ENABLE_BITCODE'] = 'NO'
  60. end
  61. end
  62. end