diff --git a/xcodeproj/internal/bazel_integration_files/copy_dsyms.sh b/xcodeproj/internal/bazel_integration_files/copy_dsyms.sh index bae55b36f..ea589c0eb 100644 --- a/xcodeproj/internal/bazel_integration_files/copy_dsyms.sh +++ b/xcodeproj/internal/bazel_integration_files/copy_dsyms.sh @@ -3,9 +3,14 @@ set -euo pipefail function patch_dsym() { - readonly dsym_name="$1" - readonly binary_name="${dsym_name%%.*}" - readonly binary_path="${dsym_name}/Contents/Resources/DWARF/${binary_name}" + local dsym_name="$1" + + shopt -s extglob + local binary_name="${dsym_name%.dSYM}" + binary_name="${binary_name%@(.app|.appex|.bundle|.dext|.kext|.framework|.pluginkit|.systemextension|.xctest|.xpc)}" + shopt +s extglob + + local binary_path="${dsym_name}/Contents/Resources/DWARF/${binary_name}" if [[ ! -f "$binary_path" ]]; then echo "dSYM DWARF ${binary_path} does not exist." \ @@ -13,8 +18,8 @@ function patch_dsym() { return 1 fi + local dwarf_uuid dwarf_uuid=$(dwarfdump --uuid "${binary_path}" | cut -d ' ' -f 2) - readonly dwarf_uuid if [[ -z "${dwarf_uuid// /}" ]]; then echo "Failed to get dSYM uuid." \ "Skip dSYM patch." @@ -44,6 +49,14 @@ EOF if [[ -n "${BAZEL_OUTPUTS_DSYM:-}" ]]; then cd "${BAZEL_OUT%/*}" + if [[ $(sw_vers -productVersion | cut -d '.' -f 1-2) == "15.4" ]]; then + # 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. + # shellcheck disable=SC2046 + chmod -R +w $(xargs -n1 <<< "$BAZEL_OUTPUTS_DSYM") + fi + # shellcheck disable=SC2046 rsync \ --copy-links \ diff --git a/xcodeproj/internal/bazel_integration_files/copy_outputs.sh b/xcodeproj/internal/bazel_integration_files/copy_outputs.sh index e847cf0e2..1603b6f9a 100755 --- a/xcodeproj/internal/bazel_integration_files/copy_outputs.sh +++ b/xcodeproj/internal/bazel_integration_files/copy_outputs.sh @@ -30,6 +30,13 @@ if [[ "$ACTION" != indexbuild ]]; then # rpaths to work ln -sfh "$PWD/$BAZEL_OUTPUTS_PRODUCT_BASENAME" "$TARGET_BUILD_DIR/$PRODUCT_NAME" else + if [[ $(sw_vers -productVersion | cut -d '.' -f 1-2) == "15.4" ]]; then + # 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. + chmod -R +w "$BAZEL_OUTPUTS_PRODUCT_BASENAME" + fi + # Product is a bundle rsync \ --copy-links \ diff --git a/xcodeproj/internal/templates/incremental_installer.sh b/xcodeproj/internal/templates/incremental_installer.sh index 2746d7d28..64f30ccb1 100644 --- a/xcodeproj/internal/templates/incremental_installer.sh +++ b/xcodeproj/internal/templates/incremental_installer.sh @@ -74,6 +74,13 @@ dest_dir="$(dirname "${dest}")" # Copy over `xcschemes` readonly dest_xcschemes="$dest/xcshareddata/xcschemes" +if [[ $(sw_vers -productVersion | cut -d '.' -f 1-2) == "15.4" ]]; then + # 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. + chmod -R +w "$src_xcschemes" +fi + mkdir -p "$dest_xcschemes" rsync \ --archive \ diff --git a/xcodeproj/internal/templates/legacy_installer.sh b/xcodeproj/internal/templates/legacy_installer.sh index fd2f96d0f..01bd05a5f 100644 --- a/xcodeproj/internal/templates/legacy_installer.sh +++ b/xcodeproj/internal/templates/legacy_installer.sh @@ -136,6 +136,13 @@ fi # Sync over the project, changing the permissions to be writable +if [[ $(sw_vers -productVersion | cut -d '.' -f 1-2) == "15.4" ]]; then + # 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. + chmod -R +w "$src" +fi + # Don't touch project.xcworkspace as that will make Xcode prompt rsync \ --archive \