fix(macos): generate matching WebRTC framework dSYM (#68)

Co-authored-by: Haitao Pan <manbuzhe2009@qq.com>
This commit is contained in:
Haitao Pan 2026-06-30 13:24:04 +08:00 committed by GitHub
parent 1666cbabe7
commit d130ea31e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,8 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
# Generate the dSYM that App Store validation expects for the vendored # Generate dSYMs that App Store validation expects for embedded frameworks.
# objective_c native-asset framework after Xcode/CocoaPods embed it. # Some prebuilt dependencies, including WebRTC, do not ship a dSYM even though
# their Mach-O binaries contain UUIDs that App Store Connect requires.
if [[ "${CONFIGURATION:-}" != "Release" && "${CONFIGURATION:-}" != "Profile" ]]; then if [[ "${CONFIGURATION:-}" != "Release" && "${CONFIGURATION:-}" != "Profile" ]]; then
exit 0 exit 0
fi fi
@ -22,6 +23,22 @@ fi
mkdir -p "${DWARF_DSYM_FOLDER_PATH}" mkdir -p "${DWARF_DSYM_FOLDER_PATH}"
dsym_matches_binary() {
local binary_path="$1"
local dsym_path="$2"
local binary_uuids dsym_uuids uuid
[[ -d "${dsym_path}" ]] || return 1
binary_uuids="$(xcrun dwarfdump --uuid "${binary_path}" 2>/dev/null || true)"
dsym_uuids="$(xcrun dwarfdump --uuid "${dsym_path}" 2>/dev/null || true)"
[[ -n "${binary_uuids}" && -n "${dsym_uuids}" ]] || return 1
while read -r uuid; do
[[ -z "${uuid}" ]] || grep -Fq "${uuid}" <<<"${dsym_uuids}" || return 1
done < <(awk '/^UUID:/ { print $2 }' <<<"${binary_uuids}")
}
for framework_path in "${frameworks_dir}"/*.framework; do for framework_path in "${frameworks_dir}"/*.framework; do
[[ -d "${framework_path}" ]] || continue [[ -d "${framework_path}" ]] || continue
@ -29,10 +46,8 @@ for framework_path in "${frameworks_dir}"/*.framework; do
binary_path="${framework_path}/${framework_name}" binary_path="${framework_path}/${framework_name}"
[[ -f "${binary_path}" ]] || continue [[ -f "${binary_path}" ]] || continue
[[ "${framework_name}" == "objective_c" ]] || continue
dsym_path="${DWARF_DSYM_FOLDER_PATH}/${framework_name}.framework.dSYM" dsym_path="${DWARF_DSYM_FOLDER_PATH}/${framework_name}.framework.dSYM"
if [[ -d "${dsym_path}" ]]; then if dsym_matches_binary "${binary_path}" "${dsym_path}"; then
continue continue
fi fi
@ -40,17 +55,10 @@ for framework_path in "${frameworks_dir}"/*.framework; do
continue continue
fi fi
echo "Generating missing dSYM for ${framework_name}.framework" echo "Generating missing or mismatched dSYM for ${framework_name}.framework"
rm -rf "${dsym_path}"
if ! xcrun dsymutil "${binary_path}" -o "${dsym_path}" >/dev/null 2>&1; then if ! xcrun dsymutil "${binary_path}" -o "${dsym_path}" >/dev/null 2>&1; then
echo "warning: Failed to generate dSYM for ${framework_name}.framework" >&2 echo "warning: Failed to generate dSYM for ${framework_name}.framework" >&2
rm -rf "${dsym_path}" || true rm -rf "${dsym_path}" || true
fi fi
done done
# Workaround for App Store Connect bug where it expects the DWARF file for App.framework to be named "A"
# because the binary is located at App.framework/Versions/A/App.
app_dwarf_dir="${DWARF_DSYM_FOLDER_PATH}/App.framework.dSYM/Contents/Resources/DWARF"
if [[ -d "${app_dwarf_dir}" && -f "${app_dwarf_dir}/App" && ! -f "${app_dwarf_dir}/A" ]]; then
echo "Applying workaround: Copying App DWARF file to A for App Store Connect validation"
cp "${app_dwarf_dir}/App" "${app_dwarf_dir}/A"
fi