|
1 | 1 | # Uncomment this line to define a global platform for your project |
2 | | -# platform :ios, '11.3' |
| 2 | +platform :ios, '11.3' |
3 | 3 |
|
4 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. |
5 | 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' |
@@ -27,15 +27,45 @@ require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelpe |
27 | 27 |
|
28 | 28 | flutter_ios_podfile_setup |
29 | 29 |
|
| 30 | +def install_plugin_pods(application_path = nil, relative_symlink_dir, platform) |
| 31 | + # defined_in_file is set by CocoaPods and is a Pathname to the Podfile. |
| 32 | + application_path ||= File.dirname(defined_in_file.realpath) if self.respond_to?(:defined_in_file) |
| 33 | + raise 'Could not find application path' unless application_path |
| 34 | + |
| 35 | + # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock |
| 36 | + # referring to absolute paths on developers' machines. |
| 37 | + |
| 38 | + symlink_dir = File.expand_path(relative_symlink_dir, application_path) |
| 39 | + system('rm', '-rf', symlink_dir) # Avoid the complication of dependencies like FileUtils. |
| 40 | + |
| 41 | + symlink_plugins_dir = File.expand_path('plugins', symlink_dir) |
| 42 | + system('mkdir', '-p', symlink_plugins_dir) |
| 43 | + |
| 44 | + plugins_file = File.join(application_path, '..', '.flutter-plugins-dependencies') |
| 45 | + plugin_pods = flutter_parse_plugins_file(plugins_file, platform) |
| 46 | + plugin_pods.each do |plugin_hash| |
| 47 | + plugin_name = plugin_hash['name'] |
| 48 | + plugin_path = plugin_hash['path'] |
| 49 | + if (plugin_name && plugin_path) |
| 50 | + specPath = "#{plugin_path}/#{platform}/#{plugin_name}.podspec" |
| 51 | + pod plugin_name, :path => specPath |
| 52 | + end |
| 53 | + end |
| 54 | +end |
| 55 | + |
30 | 56 | target 'Runner' do |
31 | 57 | use_frameworks! |
32 | 58 | use_modular_headers! |
33 | 59 |
|
34 | | - flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) |
| 60 | + flutter_install_ios_engine_pod(File.dirname(File.realpath(__FILE__))) |
| 61 | + install_plugin_pods(File.dirname(File.realpath(__FILE__)), '.symlinks', 'ios') |
35 | 62 | end |
36 | 63 |
|
37 | 64 | post_install do |installer| |
38 | 65 | installer.pods_project.targets.each do |target| |
39 | 66 | flutter_additional_ios_build_settings(target) |
| 67 | + target.build_configurations.each do |config| |
| 68 | + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.3' |
| 69 | + end |
40 | 70 | end |
41 | 71 | end |
0 commit comments