Skip to content

Commit ea97170

Browse files
authored
fix: Remove apple uploads from intel (#2645)
Adding a test runner for intel macOS, also fixes the issue with intel macOS and the mobile app command by disabling the iOS features on intel
1 parent 57efbaa commit ea97170

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

src/commands/mobile_app/upload.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ use crate::config::Config;
2121
use crate::utils::args::ArgExt as _;
2222
use crate::utils::chunks::{upload_chunks, Chunk, ASSEMBLE_POLL_INTERVAL};
2323
use crate::utils::fs::get_sha1_checksums;
24-
#[cfg(target_os = "macos")]
24+
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
2525
use crate::utils::fs::TempDir;
2626
use crate::utils::fs::TempFile;
27-
#[cfg(target_os = "macos")]
27+
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
2828
use crate::utils::mobile_app::{handle_asset_catalogs, ipa_to_xcarchive, is_ipa_file};
2929
use crate::utils::mobile_app::{is_aab_file, is_apk_file, is_apple_app, is_zip_file};
3030
use crate::utils::progress::ProgressBar;
3131
use crate::utils::vcs;
3232

3333
pub fn make_command(command: Command) -> Command {
34-
#[cfg(target_os = "macos")]
34+
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
3535
const HELP_TEXT: &str = "The path to the mobile app files to upload. Supported files include Apk, Aab, XCArchive, and IPA.";
36-
#[cfg(not(target_os = "macos"))]
36+
#[cfg(not(all(target_os = "macos", target_arch = "aarch64")))]
3737
const HELP_TEXT: &str = "The path to the mobile app files to upload. Supported files include Apk, Aab, and XCArchive.";
3838
command
3939
.about("[EXPERIMENTAL] Upload mobile app files to a project.")
@@ -92,7 +92,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
9292
let byteview = ByteView::open(path)?;
9393
debug!("Loaded file with {} bytes", byteview.len());
9494

95-
#[cfg(target_os = "macos")]
95+
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
9696
if is_apple_app(path) {
9797
handle_asset_catalogs(path);
9898
}
@@ -181,7 +181,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
181181

182182
fn handle_file(path: &Path, byteview: &ByteView) -> Result<TempFile> {
183183
// Handle IPA files by converting them to XCArchive
184-
#[cfg(target_os = "macos")]
184+
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
185185
if is_zip_file(byteview) && is_ipa_file(byteview)? {
186186
debug!("Converting IPA file to XCArchive structure");
187187
let temp_dir = TempDir::create()?;
@@ -208,9 +208,9 @@ fn validate_is_mobile_app(path: &Path, bytes: &[u8]) -> Result<()> {
208208

209209
// Check if the file is a zip file (then AAB, APK, or IPA)
210210
if is_zip_file(bytes) {
211-
#[cfg(target_os = "macos")]
211+
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
212212
debug!("File is a zip, checking for AAB/APK/IPA format");
213-
#[cfg(not(target_os = "macos"))]
213+
#[cfg(not(all(target_os = "macos", target_arch = "aarch64")))]
214214
debug!("File is a zip, checking for AAB/APK format");
215215

216216
if is_aab_file(bytes)? {
@@ -223,17 +223,17 @@ fn validate_is_mobile_app(path: &Path, bytes: &[u8]) -> Result<()> {
223223
return Ok(());
224224
}
225225

226-
#[cfg(target_os = "macos")]
226+
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
227227
if is_ipa_file(bytes)? {
228228
debug!("Detected IPA file");
229229
return Ok(());
230230
}
231231
}
232232

233233
debug!("File format validation failed");
234-
#[cfg(target_os = "macos")]
234+
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
235235
let format_list = "APK, AAB, XCArchive, or IPA";
236-
#[cfg(not(target_os = "macos"))]
236+
#[cfg(not(all(target_os = "macos", target_arch = "aarch64")))]
237237
let format_list = "APK, AAB, or XCArchive";
238238

239239
Err(anyhow!(

src/utils/mobile_app/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#![cfg(feature = "unstable-mobile-app")]
22

3-
#[cfg(target_os = "macos")]
3+
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
44
mod apple;
55
mod validation;
66

7-
#[cfg(target_os = "macos")]
7+
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
88
pub use self::apple::{handle_asset_catalogs, ipa_to_xcarchive};
9-
#[cfg(target_os = "macos")]
9+
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
1010
pub use self::validation::is_ipa_file;
1111
pub use self::validation::{is_aab_file, is_apk_file, is_apple_app, is_zip_file};

src/utils/mobile_app/validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub fn is_aab_file(bytes: &[u8]) -> Result<bool> {
3737
Ok(has_bundle_config && has_base_manifest)
3838
}
3939

40-
#[cfg(target_os = "macos")]
40+
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
4141
pub fn is_ipa_file(bytes: &[u8]) -> Result<bool> {
4242
let cursor = std::io::Cursor::new(bytes);
4343
let archive = zip::ZipArchive::new(cursor)?;

tests/integration/mobile_app/upload.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ use std::sync::atomic::{AtomicBool, Ordering};
44
use std::sync::LazyLock;
55
use std::{fs, str};
66

7-
#[cfg(target_os = "macos")]
7+
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
88
#[test]
99
fn command_mobile_app_upload_help() {
1010
TestManager::new().register_trycmd_test("mobile_app/mobile_app-upload-help-macos.trycmd");
1111
}
1212

13-
#[cfg(not(target_os = "macos"))]
13+
#[cfg(not(all(target_os = "macos", target_arch = "aarch64")))]
1414
#[test]
1515
fn command_mobile_app_upload_help() {
1616
TestManager::new().register_trycmd_test("mobile_app/mobile_app-upload-help-not-macos.trycmd");
@@ -181,7 +181,7 @@ fn command_mobile_app_upload_apk_chunked() {
181181
}
182182

183183
#[test]
184-
#[cfg(target_os = "macos")]
184+
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
185185
/// This test simulates a full chunk upload for an IPA file (with only one chunk).
186186
/// It verifies that the Sentry CLI makes the expected API calls to the chunk upload endpoint
187187
/// and that the data sent to the chunk upload endpoint is exactly as expected.

0 commit comments

Comments
 (0)