From 6355470633d28849eee6312a43457cf33f7d4d28 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Wed, 31 Jul 2024 10:22:18 -0700 Subject: [PATCH] [iOS][macOS] Eliminate use of bitcode_strip Our executables are no longer built with bitcode enabled and thus `bitcode_strip -r SOURCE -o DEST` is just copying the file in question to the output location. Use of Bitcode was eliminated in Flutter in 2022. See linked issue for details. This is a reland of https://github.com/flutter/engine/pull/54240 which was reverted in https://github.com/flutter/engine/pull/54250 The the previous version was reverted because Python's `shutil.copyfile` doesn't set the unix permissions of the source file on the destination file. However, when overwriting an existing destination file, it preserves any permissions on that file. One can imagine how this might be problematic if you test the script by running before and after the change with the same output directory. `shutil.copy2` attempts to preserve source file metadata when writing the copy. Issue: https://github.com/flutter/flutter/issues/107884 --- sky/tools/create_full_ios_framework.py | 2 +- sky/tools/create_macos_gen_snapshots.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sky/tools/create_full_ios_framework.py b/sky/tools/create_full_ios_framework.py index 7c1ae0f0a9f4e..0572adc98a644 100644 --- a/sky/tools/create_full_ios_framework.py +++ b/sky/tools/create_full_ios_framework.py @@ -243,7 +243,7 @@ def _generate_gen_snapshot(gen_snapshot_path, destination): print('Cannot find gen_snapshot at %s' % gen_snapshot_path) sys.exit(1) - subprocess.check_call(['xcrun', 'bitcode_strip', '-r', gen_snapshot_path, '-o', destination]) + shutil.copy2(gen_snapshot_path, destination) if __name__ == '__main__': diff --git a/sky/tools/create_macos_gen_snapshots.py b/sky/tools/create_macos_gen_snapshots.py index eae0f70aac693..a9b3af67e882e 100755 --- a/sky/tools/create_macos_gen_snapshots.py +++ b/sky/tools/create_macos_gen_snapshots.py @@ -5,6 +5,7 @@ # found in the LICENSE file. import argparse +import shutil import subprocess import sys import os @@ -69,7 +70,7 @@ def generate_gen_snapshot(gen_snapshot_path, destination): print('Cannot find gen_snapshot at %s' % gen_snapshot_path) sys.exit(1) - subprocess.check_call(['xcrun', 'bitcode_strip', '-r', gen_snapshot_path, '-o', destination]) + shutil.copy2(gen_snapshot_path, destination) if __name__ == '__main__':