14
14
# target 'Runner' do
15
15
# ...
16
16
# end
17
- def flutter_ios_podfile_setup
18
- end
17
+ def flutter_ios_podfile_setup ; end
19
18
20
19
# Same as flutter_ios_podfile_setup for macOS.
21
- def flutter_macos_podfile_setup
22
- end
20
+ def flutter_macos_podfile_setup ; end
23
21
24
22
# Add iOS build settings to pod targets.
25
23
#
@@ -60,13 +58,12 @@ def flutter_additional_ios_build_settings(target)
60
58
# Profile can't be derived from the CocoaPods build configuration. Use release framework (for linking only).
61
59
configuration_engine_dir = build_configuration . type == :debug ? debug_framework_dir : release_framework_dir
62
60
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
65
63
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
67
65
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.
70
67
end
71
68
end
72
69
build_configuration . build_settings [ 'OTHER_LDFLAGS' ] = '$(inherited) -framework Flutter'
@@ -158,7 +155,7 @@ def flutter_install_all_macos_pods(macos_application_path = nil)
158
155
# Optional, defaults to the Podfile directory.
159
156
def flutter_install_ios_engine_pod ( ios_application_path = nil )
160
157
# 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 )
162
159
raise 'Could not find iOS application path' unless ios_application_path
163
160
164
161
podspec_directory = File . join ( ios_application_path , 'Flutter' )
@@ -167,7 +164,7 @@ def flutter_install_ios_engine_pod(ios_application_path = nil)
167
164
# Generate a fake podspec to represent the Flutter framework.
168
165
# This is only necessary because plugin podspecs contain `s.dependency 'Flutter'`, and if this Podfile
169
166
# 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 |
171
168
podspec . write <<~EOF
172
169
#
173
170
# 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)
188
185
s.vendored_frameworks = 'path/to/nothing'
189
186
end
190
187
EOF
191
- }
188
+ end
192
189
193
190
# 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 )
195
192
end
196
193
197
194
# Same as flutter_install_ios_engine_pod for macOS.
198
195
def flutter_install_macos_engine_pod ( mac_application_path = nil )
199
196
# 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 )
201
198
raise 'Could not find macOS application path' unless mac_application_path
202
199
203
200
copied_podspec_path = File . expand_path ( 'FlutterMacOS.podspec' , File . join ( mac_application_path , 'Flutter' , 'ephemeral' ) )
204
201
205
202
# Generate a fake podspec to represent the FlutterMacOS framework.
206
203
# This is only necessary because plugin podspecs contain `s.dependency 'FlutterMacOS'`, and if this Podfile
207
204
# 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 |
209
206
podspec . write <<~EOF
210
207
#
211
208
# 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)
226
223
s.vendored_frameworks = 'path/to/nothing'
227
224
end
228
225
EOF
229
- }
226
+ end
230
227
231
228
# 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' )
233
230
end
234
231
235
232
# Install Flutter plugin pods.
@@ -238,7 +235,7 @@ def flutter_install_macos_engine_pod(mac_application_path = nil)
238
235
# Optional, defaults to the Podfile directory.
239
236
def flutter_install_plugin_pods ( application_path = nil , relative_symlink_dir , platform )
240
237
# 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 )
242
239
raise 'Could not find application path' unless application_path
243
240
244
241
# 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
256
253
plugin_name = plugin_hash [ 'name' ]
257
254
plugin_path = plugin_hash [ 'path' ]
258
255
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 )
262
259
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 )
265
262
266
- pod plugin_name , :path => File . join ( relative , platform )
267
- end
263
+ pod plugin_name , path : File . join ( relative , platform )
268
264
end
269
265
end
270
266
271
267
# .flutter-plugins-dependencies format documented at
272
268
# https://flutter.dev/go/plugins-list-migration
273
269
def flutter_parse_plugins_file ( file , platform )
274
270
file_path = File . expand_path ( file )
275
- return [ ] unless File . exists ? file_path
271
+ return [ ] unless File . exist ? file_path
276
272
277
273
dependencies_file = File . read ( file )
278
274
dependencies_hash = JSON . parse ( dependencies_file )
0 commit comments