Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixes

- Accept ProGuard mapping files without line information instead of rejecting them ([#3192](https://github.com/getsentry/sentry-cli/pull/3192)).
- Improve error message when uploading `.xcarchive` or `.ipa` files on non-Apple Silicon Macs ([#3211](https://github.com/getsentry/sentry-cli/pull/3211)).

### Experimental Feature 🧑‍🔬 (internal-only)

Expand Down
15 changes: 15 additions & 0 deletions src/commands/build/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,20 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
return Err(anyhow!("Path does not exist: {}", path.display()));
}

// On non-Apple Silicon, reject xcarchive/IPA early before trying to
// open the path as a file (xcarchive is a directory, so ByteView::open
// would fail with a confusing I/O error).
#[cfg(not(all(target_os = "macos", target_arch = "aarch64")))]
{
let ext = path.extension().and_then(|e| e.to_str()).unwrap_or("");
if ext.eq_ignore_ascii_case("xcarchive") || ext.eq_ignore_ascii_case("ipa") {
return Err(anyhow!(
"Uploading XCArchive and IPA files requires an Apple Silicon Mac: {}",
path.display()
));
}
}

let byteview = ByteView::open(path)?;
debug!("Loaded file with {} bytes", byteview.len());

Expand Down Expand Up @@ -542,6 +556,7 @@ fn validate_is_supported_build(path: &Path, bytes: &[u8]) -> Result<()> {
}

debug!("File format validation failed");

#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
let format_list = "APK, AAB, XCArchive, or IPA";
#[cfg(not(all(target_os = "macos", target_arch = "aarch64")))]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
```
$ sentry-cli build upload tests/integration/_fixtures/build/ipa.ipa
? failed
error: Uploading XCArchive and IPA files requires an Apple Silicon Mac: tests/integration/_fixtures/build/ipa.ipa

Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output.
Please attach the full debug log to all bug reports.

```
8 changes: 8 additions & 0 deletions tests/integration/build/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ fn command_build_upload_no_path() {
TestManager::new().register_trycmd_test("build/build-upload-no-path.trycmd");
}

#[cfg(not(all(target_os = "macos", target_arch = "aarch64")))]
#[test]
fn command_build_upload_ipa_not_arm64() {
TestManager::new()
.register_trycmd_test("build/build-upload-ipa-not-arm64.trycmd")
.with_default_token();
}

#[test]
fn command_build_upload_invalid_aab() {
TestManager::new()
Expand Down
Loading