Skip to content

Commit 997b89b

Browse files
committed
Keep dSYM bundles when creating universal macOS binaries
1 parent ed537a4 commit 997b89b

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

rust_build_utils/darwin_build_utils.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,21 +95,33 @@ def lipo(
9595
packages: rutils.PackageList,
9696
):
9797
archs = GLOBAL_CONFIG[target_os]["archs"]
98+
universal_binary_dist_path = get_universal_library_distribution_directory(
99+
project, target_os, debug
100+
)
98101

99102
for _, bins in packages.items():
100103
for _, binary in bins.items():
101104
create_fat_binary(
102105
project,
103-
get_universal_library_distribution_directory(project, target_os, debug)
104-
/ binary,
106+
universal_binary_dist_path / binary,
105107
target_os,
106108
archs.keys(),
107109
binary,
108110
debug,
109111
)
110112

111113
for arch in archs:
112-
shutil.rmtree(project.get_distribution_path(target_os, arch, "", debug))
114+
dist_path = project.get_distribution_path(target_os, arch, "", debug)
115+
116+
for _, bins in packages.items():
117+
for _, binary in bins.items():
118+
dsym_dir = f"{dist_path}/{binary}.dSYM"
119+
if os.path.isdir(dsym_dir):
120+
dst_dir = f"{universal_binary_dist_path}/{binary}.dSYM/{arch}"
121+
os.makedirs(dst_dir, exist_ok=True)
122+
shutil.copytree(dsym_dir, dst_dir, dirs_exist_ok=True)
123+
124+
shutil.rmtree(dist_path)
113125

114126

115127
def create_fat_binary(

0 commit comments

Comments
 (0)