build: use xz compression

This commit is contained in:
Keeley Hammond
2025-11-11 20:53:39 -08:00
parent 7da0b4b351
commit c6fe59999a
2 changed files with 8 additions and 3 deletions

View File

@@ -66,11 +66,15 @@ def download(text, url, path):
return path
def make_zip(zip_file_path, files, dirs):
def make_zip(zip_file_path, files, dirs, use_xz=False):
safe_unlink(zip_file_path)
if sys.platform == 'darwin':
allfiles = files + dirs
execute(['zip', '-r', '-y', '-9', zip_file_path] + allfiles)
if use_xz:
# Use xz compression for better compression ratio (vs deflate)
execute(['zip', '-r', '-y', '-9', '-Z', 'xz', zip_file_path] + allfiles)
else:
execute(['zip', '-r', '-y', '-9', zip_file_path] + allfiles)
else:
with zipfile.ZipFile(zip_file_path, "w",
zipfile.ZIP_DEFLATED,

View File

@@ -36,7 +36,8 @@ def main():
dsyms.remove(dsym)
dsym_zip_file = os.path.join(args.build_dir, dsym_name)
print('Making dsym zip: ' + dsym_zip_file)
make_zip(dsym_zip_file, licenses, dsyms)
# Use xz compression to reduce file size and stay under GitHub's 2GB limit
make_zip(dsym_zip_file, licenses, dsyms, use_xz=True)
dsym_snapshot_name = 'dsym-snapshot.zip'
dsym_snapshot_zip_file = os.path.join(args.build_dir, dsym_snapshot_name)
print('Making dsym snapshot zip: ' + dsym_snapshot_zip_file)