Skip to content

Commit bbe5153

Browse files
committed
Fix rsync on macOS 15.4
15.4's `rsync` has a bug that requires the src to have write permissions. We normally shouldn't do this as it modifies the Bazel output base, so we limit this to only macOS 15.4 (as it’s fixed in 15.5). Also fixes a slight bug in the `patch_dsym` function. Signed-off-by: Brentley Jones <github@brentleyjones.com>
1 parent e14dc73 commit bbe5153

File tree

4 files changed

+38
-4
lines changed

4 files changed

+38
-4
lines changed

xcodeproj/internal/bazel_integration_files/copy_dsyms.sh

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,23 @@
33
set -euo pipefail
44

55
function patch_dsym() {
6-
readonly dsym_name="$1"
7-
readonly binary_name="${dsym_name%%.*}"
8-
readonly binary_path="${dsym_name}/Contents/Resources/DWARF/${binary_name}"
6+
local dsym_name="$1"
7+
8+
shopt -s extglob
9+
local binary_name="${dsym_name%.dSYM}"
10+
binary_name="${binary_name%@(.app|.appex|.bundle|.dext|.kext|.framework|.pluginkit|.systemextension|.xctest|.xpc)}"
11+
shopt +s extglob
12+
13+
local binary_path="${dsym_name}/Contents/Resources/DWARF/${binary_name}"
914

1015
if [[ ! -f "$binary_path" ]]; then
1116
echo "dSYM DWARF ${binary_path} does not exist." \
1217
"Skip dSYM patch."
1318
return 1
1419
fi
1520

21+
local dwarf_uuid
1622
dwarf_uuid=$(dwarfdump --uuid "${binary_path}" | cut -d ' ' -f 2)
17-
readonly dwarf_uuid
1823
if [[ -z "${dwarf_uuid// /}" ]]; then
1924
echo "Failed to get dSYM uuid." \
2025
"Skip dSYM patch."
@@ -44,6 +49,14 @@ EOF
4449
if [[ -n "${BAZEL_OUTPUTS_DSYM:-}" ]]; then
4550
cd "${BAZEL_OUT%/*}"
4651

52+
if [[ $(sw_vers -productVersion | cut -d '.' -f 1-2) == "15.4" ]]; then
53+
# 15.4's `rsync` has a bug that requires the src to have write permissions.
54+
# We normally shouldn't do this as it modifies the bazel output base, so we
55+
# limit this to only macOS 15.4.
56+
# shellcheck disable=SC2046
57+
chmod -R +w $(xargs -n1 <<< "$BAZEL_OUTPUTS_DSYM")
58+
fi
59+
4760
# shellcheck disable=SC2046
4861
rsync \
4962
--copy-links \

xcodeproj/internal/bazel_integration_files/copy_outputs.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ if [[ "$ACTION" != indexbuild ]]; then
3030
# rpaths to work
3131
ln -sfh "$PWD/$BAZEL_OUTPUTS_PRODUCT_BASENAME" "$TARGET_BUILD_DIR/$PRODUCT_NAME"
3232
else
33+
if [[ $(sw_vers -productVersion | cut -d '.' -f 1-2) == "15.4" ]]; then
34+
# 15.4's `rsync` has a bug that requires the src to have write
35+
# permissions. We normally shouldn't do this as it modifies the bazel
36+
# output base, so we limit this to only macOS 15.4.
37+
chmod -R +w "$BAZEL_OUTPUTS_PRODUCT_BASENAME"
38+
fi
39+
3340
# Product is a bundle
3441
rsync \
3542
--copy-links \

xcodeproj/internal/templates/incremental_installer.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ dest_dir="$(dirname "${dest}")"
7474
# Copy over `xcschemes`
7575
readonly dest_xcschemes="$dest/xcshareddata/xcschemes"
7676

77+
if [[ $(sw_vers -productVersion | cut -d '.' -f 1-2) == "15.4" ]]; then
78+
# 15.4's `rsync` has a bug that requires the src to have write permissions.
79+
# We normally shouldn't do this as it modifies the bazel output base, so we
80+
# limit this to only macOS 15.4.
81+
chmod -R +w "$src_xcschemes"
82+
fi
83+
7784
mkdir -p "$dest_xcschemes"
7885
rsync \
7986
--archive \

xcodeproj/internal/templates/legacy_installer.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@ fi
127127

128128
# Sync over the project, changing the permissions to be writable
129129

130+
if [[ $(sw_vers -productVersion | cut -d '.' -f 1-2) == "15.4" ]]; then
131+
# 15.4's `rsync` has a bug that requires the src to have write permissions.
132+
# We normally shouldn't do this as it modifies the bazel output base, so we
133+
# limit this to only macOS 15.4.
134+
chmod -R +w "$src"
135+
fi
136+
130137
# Don't touch project.xcworkspace as that will make Xcode prompt
131138
rsync \
132139
--archive \

0 commit comments

Comments
 (0)