@@ -144,11 +144,20 @@ def create_framework( # pylint: disable=too-many-arguments
144144 print ('Cannot find iOS simulator dylib at %s' % simulator_x64_dylib )
145145 return 1
146146
147+ # Compute dsym output paths, if enabled.
148+ framework_dsym = None
149+ simulator_dsym = None
150+ if args .dsym :
151+ framework_dsym = os .path .splitext (framework )[0 ] + '.dSYM'
152+ simulator_dsym = os .path .splitext (simulator_framework )[0 ] + '.dSYM'
153+
154+ # Emit the framework for physical devices.
147155 shutil .rmtree (framework , True )
148156 shutil .copytree (arm64_framework , framework )
149157 framework_binary = os .path .join (framework , 'Flutter' )
150- process_framework (args , dst , framework , framework_binary )
158+ process_framework (args , dst , framework_binary , framework_dsym )
151159
160+ # Emit the framework for simulators.
152161 if args .simulator_arm64_out_dir is not None :
153162 shutil .rmtree (simulator_framework , True )
154163 shutil .copytree (simulator_arm64_framework , simulator_framework )
@@ -160,22 +169,23 @@ def create_framework( # pylint: disable=too-many-arguments
160169 'lipo' , simulator_x64_dylib , simulator_arm64_dylib , '-create' , '-output' ,
161170 simulator_framework_binary
162171 ])
163- process_framework (args , dst , simulator_framework , simulator_framework_binary )
172+ process_framework (args , dst , simulator_framework_binary , simulator_dsym )
164173 else :
165174 simulator_framework = simulator_x64_framework
166175
167176 # Create XCFramework from the arm-only fat framework and the arm64/x64
168177 # simulator frameworks, or just the x64 simulator framework if only that one
169178 # exists.
170179 xcframeworks = [simulator_framework , framework ]
171- create_xcframework (location = dst , name = 'Flutter' , frameworks = xcframeworks )
180+ dsyms = [simulator_dsym , framework_dsym ] if args .dsym else None
181+ create_xcframework (location = dst , name = 'Flutter' , frameworks = xcframeworks , dsyms = dsyms )
172182
173- # Add the x64 simulator into the fat framework
183+ # Add the x64 simulator into the fat framework.
174184 subprocess .check_call ([
175185 'lipo' , arm64_dylib , simulator_x64_dylib , '-create' , '-output' , framework_binary
176186 ])
177187
178- process_framework (args , dst , framework , framework_binary )
188+ process_framework (args , dst , framework_binary , framework_dsym )
179189 return 0
180190
181191
@@ -216,16 +226,14 @@ def zip_archive(dst):
216226 subprocess .check_call (['zip' , '-r' , 'extension_safe_Flutter.dSYM.zip' , 'Flutter.dSYM' ], cwd = dst )
217227
218228
219- def process_framework (args , dst , framework , framework_binary ):
220- if args .dsym :
221- dsym_out = os .path .splitext (framework )[0 ] + '.dSYM'
222- subprocess .check_call ([DSYMUTIL , '-o' , dsym_out , framework_binary ])
229+ def process_framework (args , dst , framework_binary , dsym ):
230+ if dsym :
231+ subprocess .check_call ([DSYMUTIL , '-o' , dsym , framework_binary ])
223232
224233 if args .strip :
225234 # copy unstripped
226235 unstripped_out = os .path .join (dst , 'Flutter.unstripped' )
227236 shutil .copyfile (framework_binary , unstripped_out )
228-
229237 subprocess .check_call (['strip' , '-x' , '-S' , framework_binary ])
230238
231239
0 commit comments