Fix: normalize arm64 binary path after --arch arm64 build on native M2 host#5147
Fix: normalize arm64 binary path after --arch arm64 build on native M2 host#5147
Conversation
…2 host On Codemagic mac_mini_m2 with Xcode 16.4, xcrun swift build --arch arm64 outputs the binary to .build/release/ (native arch) instead of the expected .build/arm64-apple-macosx/release/. This caused 'Create universal app bundle' to fail with 'ERROR: Missing built binaries'. After the arm64 build, copy the binary (and Sparkle.framework, resource bundle) to the arch-specific path if not already there, so downstream steps find them at the expected location.
Greptile SummaryThis PR adds path normalization logic to handle a Swift toolchain quirk on Codemagic's M2 Mac runners. When building with The fix:
The logic is sound and includes proper validation - the downstream "Create universal app bundle" step already validates both arch-specific binaries exist, so if this normalization fails, the build will fail explicitly rather than producing a broken artifact. Confidence Score: 5/5
Important Files Changed
Last reviewed commit: b79d0bd |
There was a problem hiding this comment.
Code Review
This pull request introduces a workaround in the Codemagic CI pipeline to handle an inconsistency in the build output path for arm64 architecture on native M2 hosts. The change correctly identifies when the build artifacts are in the wrong location and moves them to the expected path, ensuring downstream steps can find them. My feedback focuses on improving the robustness of the shell script to prevent silent failures.
| [ -d "Desktop/.build/release/Sparkle.framework" ] && cp -R "Desktop/.build/release/Sparkle.framework" "Desktop/.build/arm64-apple-macosx/release/" || true | ||
| [ -d "Desktop/.build/release/Omi Computer_Omi Computer.bundle" ] && cp -R "Desktop/.build/release/Omi Computer_Omi Computer.bundle" "Desktop/.build/arm64-apple-macosx/release/" || true |
There was a problem hiding this comment.
The || true construct suppresses exit codes from the cp command. If these assets exist but fail to copy (e.g., due to permissions), this will mask the error and potentially cause more obscure failures in later build steps. It's better to let the script fail immediately if cp encounters an issue. The preceding [ -d ... ] && check already handles the case where the source directory doesn't exist.
[ -d "Desktop/.build/release/Sparkle.framework" ] && cp -R "Desktop/.build/release/Sparkle.framework" "Desktop/.build/arm64-apple-macosx/release/"
[ -d "Desktop/.build/release/Omi Computer_Omi Computer.bundle" ] && cp -R "Desktop/.build/release/Omi Computer_Omi Computer.bundle" "Desktop/.build/arm64-apple-macosx/release/"## Root Cause Diagnostic build confirmed: on Codemagic mac_mini_m2 with Xcode 16.4, `xcrun swift build --arch arm64` outputs to `.build/release/` (native arch path), NOT `.build/arm64-apple-macosx/release/`. Only the x86_64 cross-compilation uses the arch-specific subdirectory. ## Fix Update three path references in "Create universal app bundle": - `ARM64_BINARY`: `.build/release/$BINARY_NAME` - `SPARKLE_FW`: `.build/release/Sparkle.framework` - `SWIFT_BUILD_DIR`: `.build/release` Also removes the failed normalization attempt from PR #5147 (copying didn't persist across the x86_64 build step).
…2 host (BasedHardware#5147) ## Problem On Codemagic mac_mini_m2 with Xcode 16.4, `xcrun swift build --arch arm64` outputs the binary to `.build/release/` (the native arch path) instead of `.build/arm64-apple-macosx/release/`. This caused the "Create universal app bundle" step to fail with `ERROR: Missing built binaries` every time. The `x86_64` cross-compilation correctly outputs to `.build/x86_64-apple-macosx/release/`, so only the arm64 binary was missing. ## Fix After the arm64 build, detect if the binary landed in `release/` instead of `arm64-apple-macosx/release/` and copy it to the expected location. Also copies `Sparkle.framework` and the SPM resource bundle if present. This is the fourth fix attempt in this release pipeline: 1. ✅ Group name: `omi_desktop` → `desktop_secrets` 2. ✅ Build flags: `--triple` → `--arch` 3. ✅ This fix: normalize arm64 output path
…Hardware#5149) ## Root Cause Diagnostic build confirmed: on Codemagic mac_mini_m2 with Xcode 16.4, `xcrun swift build --arch arm64` outputs to `.build/release/` (native arch path), NOT `.build/arm64-apple-macosx/release/`. Only the x86_64 cross-compilation uses the arch-specific subdirectory. ## Fix Update three path references in "Create universal app bundle": - `ARM64_BINARY`: `.build/release/$BINARY_NAME` - `SPARKLE_FW`: `.build/release/Sparkle.framework` - `SWIFT_BUILD_DIR`: `.build/release` Also removes the failed normalization attempt from PR BasedHardware#5147 (copying didn't persist across the x86_64 build step).
Problem
On Codemagic mac_mini_m2 with Xcode 16.4,
xcrun swift build --arch arm64outputs the binary to.build/release/(the native arch path) instead of.build/arm64-apple-macosx/release/. This caused the "Create universal app bundle" step to fail withERROR: Missing built binariesevery time.The
x86_64cross-compilation correctly outputs to.build/x86_64-apple-macosx/release/, so only the arm64 binary was missing.Fix
After the arm64 build, detect if the binary landed in
release/instead ofarm64-apple-macosx/release/and copy it to the expected location. Also copiesSparkle.frameworkand the SPM resource bundle if present.This is the fourth fix attempt in this release pipeline:
omi_desktop→desktop_secrets--triple→--arch