Podfile 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. def parse_KV_file(file, separator='=')
  6. file_abs_path = File.expand_path(file)
  7. if !File.exists? file_abs_path
  8. return [];
  9. end
  10. pods_ary = []
  11. skip_line_start_symbols = ["#", "/"]
  12. File.foreach(file_abs_path) { |line|
  13. next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
  14. plugin = line.split(pattern=separator)
  15. if plugin.length == 2
  16. podname = plugin[0].strip()
  17. path = plugin[1].strip()
  18. podpath = File.expand_path("#{path}", file_abs_path)
  19. pods_ary.push({:name => podname, :path => podpath});
  20. else
  21. puts "Invalid plugin specification: #{line}"
  22. end
  23. }
  24. return pods_ary
  25. end
  26. target 'Runner' do
  27. # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  28. # referring to absolute paths on developers' machines.
  29. system('rm -rf Pods/.symlinks')
  30. system('mkdir -p Pods/.symlinks/flutter')
  31. system('mkdir -p Pods/.symlinks/plugins')
  32. # Flutter Pods
  33. generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
  34. if generated_xcode_build_settings.empty?
  35. puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
  36. end
  37. generated_xcode_build_settings.map { |p|
  38. if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
  39. symlink = File.join('Pods', '.symlinks', 'flutter', File.basename(p[:path]))
  40. File.symlink(p[:path], symlink)
  41. pod 'Flutter', :path => symlink
  42. end
  43. }
  44. # Plugin Pods
  45. plugin_pods = parse_KV_file('../.flutter-plugins')
  46. plugin_pods.map { |p|
  47. symlink = File.join('Pods', '.symlinks', 'plugins', File.basename(p[:path]))
  48. File.symlink(p[:path], symlink)
  49. pod p[:name], :path => File.join(symlink, 'ios')
  50. }
  51. end
  52. post_install do |installer|
  53. installer.pods_project.targets.each do |target|
  54. target.build_configurations.each do |config|
  55. config.build_settings['ENABLE_BITCODE'] = 'NO'
  56. end
  57. end
  58. end