1414# target 'Runner' do
1515# ...
1616# end
17- def flutter_ios_podfile_setup
18- end
17+ def flutter_ios_podfile_setup ; end
1918
2019# Same as flutter_ios_podfile_setup for macOS.
21- def flutter_macos_podfile_setup
22- end
20+ def flutter_macos_podfile_setup ; end
2321
2422# Add iOS build settings to pod targets.
2523#
@@ -60,13 +58,12 @@ def flutter_additional_ios_build_settings(target)
6058 # Profile can't be derived from the CocoaPods build configuration. Use release framework (for linking only).
6159 configuration_engine_dir = build_configuration . type == :debug ? debug_framework_dir : release_framework_dir
6260 Dir . new ( configuration_engine_dir ) . each_child do |xcframework_file |
63- next if xcframework_file . start_with? ( "." ) # Hidden file, possibly on external disk.
64- if xcframework_file . end_with? ( " -simulator" ) # ios-arm64_x86_64-simulator
61+ next if xcframework_file . start_with? ( '.' ) # Hidden file, possibly on external disk.
62+ if xcframework_file . end_with? ( ' -simulator' ) # ios-arm64_x86_64-simulator
6563 build_configuration . build_settings [ 'FRAMEWORK_SEARCH_PATHS[sdk=iphonesimulator*]' ] = "\" #{ configuration_engine_dir } /#{ xcframework_file } \" $(inherited)"
66- elsif xcframework_file . start_with? ( " ios-" ) # ios-arm64
64+ elsif xcframework_file . start_with? ( ' ios-' ) # ios-arm64
6765 build_configuration . build_settings [ 'FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*]' ] = "\" #{ configuration_engine_dir } /#{ xcframework_file } \" $(inherited)"
68- else
69- # Info.plist or another platform.
66+ # else Info.plist or another platform.
7067 end
7168 end
7269 build_configuration . build_settings [ 'OTHER_LDFLAGS' ] = '$(inherited) -framework Flutter'
@@ -158,7 +155,7 @@ def flutter_install_all_macos_pods(macos_application_path = nil)
158155# Optional, defaults to the Podfile directory.
159156def flutter_install_ios_engine_pod ( ios_application_path = nil )
160157 # defined_in_file is set by CocoaPods and is a Pathname to the Podfile.
161- ios_application_path ||= File . dirname ( defined_in_file . realpath ) if self . respond_to? ( :defined_in_file )
158+ ios_application_path ||= File . dirname ( defined_in_file . realpath ) if respond_to? ( :defined_in_file )
162159 raise 'Could not find iOS application path' unless ios_application_path
163160
164161 podspec_directory = File . join ( ios_application_path , 'Flutter' )
@@ -167,7 +164,7 @@ def flutter_install_ios_engine_pod(ios_application_path = nil)
167164 # Generate a fake podspec to represent the Flutter framework.
168165 # This is only necessary because plugin podspecs contain `s.dependency 'Flutter'`, and if this Podfile
169166 # does not add a `pod 'Flutter'` CocoaPods will try to download it from the CocoaPods trunk.
170- File . open ( copied_podspec_path , 'w' ) { |podspec |
167+ File . open ( copied_podspec_path , 'w' ) do |podspec |
171168 podspec . write <<~EOF
172169 #
173170 # NOTE: This podspec is NOT to be published. It is only used as a local source!
@@ -188,24 +185,24 @@ def flutter_install_ios_engine_pod(ios_application_path = nil)
188185 s.vendored_frameworks = 'path/to/nothing'
189186 end
190187 EOF
191- }
188+ end
192189
193190 # Keep pod path relative so it can be checked into Podfile.lock.
194- pod 'Flutter' , : path => flutter_relative_path_from_podfile ( podspec_directory )
191+ pod 'Flutter' , path : flutter_relative_path_from_podfile ( podspec_directory )
195192end
196193
197194# Same as flutter_install_ios_engine_pod for macOS.
198195def flutter_install_macos_engine_pod ( mac_application_path = nil )
199196 # defined_in_file is set by CocoaPods and is a Pathname to the Podfile.
200- mac_application_path ||= File . dirname ( defined_in_file . realpath ) if self . respond_to? ( :defined_in_file )
197+ mac_application_path ||= File . dirname ( defined_in_file . realpath ) if respond_to? ( :defined_in_file )
201198 raise 'Could not find macOS application path' unless mac_application_path
202199
203200 copied_podspec_path = File . expand_path ( 'FlutterMacOS.podspec' , File . join ( mac_application_path , 'Flutter' , 'ephemeral' ) )
204201
205202 # Generate a fake podspec to represent the FlutterMacOS framework.
206203 # This is only necessary because plugin podspecs contain `s.dependency 'FlutterMacOS'`, and if this Podfile
207204 # does not add a `pod 'FlutterMacOS'` CocoaPods will try to download it from the CocoaPods trunk.
208- File . open ( copied_podspec_path , 'w' ) { |podspec |
205+ File . open ( copied_podspec_path , 'w' ) do |podspec |
209206 podspec . write <<~EOF
210207 #
211208 # NOTE: This podspec is NOT to be published. It is only used as a local source!
@@ -226,10 +223,10 @@ def flutter_install_macos_engine_pod(mac_application_path = nil)
226223 s.vendored_frameworks = 'path/to/nothing'
227224 end
228225 EOF
229- }
226+ end
230227
231228 # Keep pod path relative so it can be checked into Podfile.lock.
232- pod 'FlutterMacOS' , : path => File . join ( 'Flutter' , 'ephemeral' )
229+ pod 'FlutterMacOS' , path : File . join ( 'Flutter' , 'ephemeral' )
233230end
234231
235232# Install Flutter plugin pods.
@@ -238,7 +235,7 @@ def flutter_install_macos_engine_pod(mac_application_path = nil)
238235# Optional, defaults to the Podfile directory.
239236def flutter_install_plugin_pods ( application_path = nil , relative_symlink_dir , platform )
240237 # defined_in_file is set by CocoaPods and is a Pathname to the Podfile.
241- application_path ||= File . dirname ( defined_in_file . realpath ) if self . respond_to? ( :defined_in_file )
238+ application_path ||= File . dirname ( defined_in_file . realpath ) if respond_to? ( :defined_in_file )
242239 raise 'Could not find application path' unless application_path
243240
244241 # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
@@ -256,23 +253,22 @@ def flutter_install_plugin_pods(application_path = nil, relative_symlink_dir, pl
256253 plugin_name = plugin_hash [ 'name' ]
257254 plugin_path = plugin_hash [ 'path' ]
258255 has_native_build = plugin_hash . fetch ( 'native_build' , true )
259- if ( plugin_name && plugin_path && has_native_build )
260- symlink = File . join ( symlink_plugins_dir , plugin_name )
261- File . symlink ( plugin_path , symlink )
256+ next unless plugin_name && plugin_path && has_native_build
257+ symlink = File . join ( symlink_plugins_dir , plugin_name )
258+ File . symlink ( plugin_path , symlink )
262259
263- # Keep pod path relative so it can be checked into Podfile.lock.
264- relative = flutter_relative_path_from_podfile ( symlink )
260+ # Keep pod path relative so it can be checked into Podfile.lock.
261+ relative = flutter_relative_path_from_podfile ( symlink )
265262
266- pod plugin_name , :path => File . join ( relative , platform )
267- end
263+ pod plugin_name , path : File . join ( relative , platform )
268264 end
269265end
270266
271267# .flutter-plugins-dependencies format documented at
272268# https://flutter.dev/go/plugins-list-migration
273269def flutter_parse_plugins_file ( file , platform )
274270 file_path = File . expand_path ( file )
275- return [ ] unless File . exists ? file_path
271+ return [ ] unless File . exist ? file_path
276272
277273 dependencies_file = File . read ( file )
278274 dependencies_hash = JSON . parse ( dependencies_file )
0 commit comments