Skip to content

Commit

Permalink
Fix create macos framework. (flutter#36163)
Browse files Browse the repository at this point in the history
  • Loading branch information
godofredoc authored Sep 16, 2022
1 parent 0e08c29 commit 70cf481
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions sky/tools/create_macos_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,40 @@ def main():

shutil.rmtree(fat_framework, True)
shutil.copytree(arm64_framework, fat_framework, symlinks=True)
regenerate_symlinks(fat_framework)

fat_framework_binary = os.path.join(
fat_framework, 'Versions', 'A', 'FlutterMacOS'
)

# Create the arm64/x64 fat framework.
result = subprocess.run([
subprocess.check_call([
'lipo', arm64_dylib, x64_dylib, '-create', '-output', fat_framework_binary
])
if result.returncode != 0:
print(
'Error processing command with stdout[%s] and stderr[%s]' %
(result.stdout, result.stderr)
)
return 1
process_framework(dst, args, fat_framework, fat_framework_binary)


def regenerate_symlinks(fat_framework):
"""Regenerates the symlinks structure.
Recipes V2 upload artifacts in CAS before integration and CAS follows symlinks.
This logic regenerates the symlinks in the expected structure.
"""
if os.path.islink(os.path.join(fat_framework, 'FlutterMacOS')):
return
os.remove(os.path.join(fat_framework, 'FlutterMacOS'))
shutil.rmtree(os.path.join(fat_framework, 'Headers'), True)
shutil.rmtree(os.path.join(fat_framework, 'Modules'), True)
shutil.rmtree(os.path.join(fat_framework, 'Resources'), True)
current_version_path = os.path.join(fat_framework, 'Versions', 'Current')
shutil.rmtree(current_version_path, True)
os.symlink('A', current_version_path)
os.symlink('FlutterMacOS', os.path.join(fat_framework, 'FlutterMacOS'))
os.symlink('Headers', os.path.join(fat_framework, 'Headers'))
os.symlink('Modules', os.path.join(fat_framework, 'Modules'))
os.symlink('Resources', os.path.join(fat_framework, 'Resources'))


def process_framework(dst, args, fat_framework, fat_framework_binary):
if args.dsym:
dsym_out = os.path.splitext(fat_framework)[0] + '.dSYM'
Expand Down

0 comments on commit 70cf481

Please sign in to comment.