in src/TulsiGenerator/Scripts/bazel_build.py [0:0]
def _InstallDSYMBundles(self, output_dir, outputs_data):
"""Copies any generated dSYM bundles to the given directory."""
dsym_to_process = set()
primary_output_data = outputs_data[0]
if primary_output_data['has_dsym']:
# Declares the Xcode-generated name of our main target's dSYM.
# This environment variable is always set, for any possible Xcode output
# that could generate a dSYM bundle.
#
# Note that this may differ from the Bazel name as Tulsi may modify the
# Xcode `BUNDLE_NAME`, so we need to make sure we use Bazel as the source
# of truth for Bazel's dSYM name, but copy it over to where Xcode expects.
xcode_target_dsym = os.environ.get('DWARF_DSYM_FILE_NAME')
if xcode_target_dsym:
dsym_path = primary_output_data.get('dsym_path')
if dsym_path:
dsym_to_process.add((dsym_path, xcode_target_dsym))
else:
_PrintXcodeWarning('Unable to resolve dSYM paths for main bundle %s' %
primary_output_data)
# Collect additional dSYM bundles generated by the dependencies of this
# build such as extensions or frameworks. Note that a main target may not
# have dSYMs while subtargets (like an xctest) still can have them.
child_dsyms = set()
for data in outputs_data:
for bundle_info in data.get('embedded_bundles', []):
if not bundle_info['has_dsym']:
continue
dsym_path = bundle_info.get('dsym_path')
if dsym_path:
child_dsyms.add((dsym_path, os.path.basename(dsym_path)))
else:
_PrintXcodeWarning(
'Unable to resolve dSYM paths for embedded bundle %s'
% bundle_info)
dsym_to_process.update(child_dsyms)
if not dsym_to_process:
return 0, None
# Start the timer now that we know we have dSYM bundles to install.
timer = Timer('Installing dSYM bundles', 'installing_dsym').Start()
dsyms_found = []
for input_dsym_full_path, xcode_dsym_name in dsym_to_process:
output_full_path = os.path.join(output_dir, xcode_dsym_name)
exit_code, path = self._InstallBundle(input_dsym_full_path,
output_full_path)
if exit_code:
_PrintXcodeWarning('Failed to install dSYM to "%s" (%s)'
% (input_dsym_full_path, exit_code))
elif path is None:
_PrintXcodeWarning('Did not find a dSYM bundle at %s'
% input_dsym_full_path)
else:
dsyms_found.append(path)
timer.End()
return 0, dsyms_found