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