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
12 changes: 8 additions & 4 deletions src/commands/mobile_app/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,19 @@ use crate::utils::fs::get_sha1_checksums;
use crate::utils::fs::TempDir;
use crate::utils::fs::TempFile;
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
use crate::utils::mobile_app::{handle_asset_catalogs, ipa_to_xcarchive, is_ipa_file};
use crate::utils::mobile_app::{is_aab_file, is_apk_file, is_apple_app, is_zip_file};
use crate::utils::mobile_app::{
handle_asset_catalogs, ipa_to_xcarchive, is_apple_app, is_ipa_file,
};
use crate::utils::mobile_app::{is_aab_file, is_apk_file, is_zip_file};
use crate::utils::progress::ProgressBar;
use crate::utils::vcs;

pub fn make_command(command: Command) -> Command {
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
const HELP_TEXT: &str = "The path to the mobile app files to upload. Supported files include Apk, Aab, XCArchive, and IPA.";
#[cfg(not(all(target_os = "macos", target_arch = "aarch64")))]
const HELP_TEXT: &str = "The path to the mobile app files to upload. Supported files include Apk, Aab, and XCArchive.";
const HELP_TEXT: &str =
"The path to the mobile app files to upload. Supported files include Apk, and Aab.";
command
.about("[EXPERIMENTAL] Upload mobile app files to a project.")
.org_arg()
Expand Down Expand Up @@ -201,6 +204,7 @@ fn handle_file(path: &Path, byteview: &ByteView) -> Result<TempFile> {
fn validate_is_mobile_app(path: &Path, bytes: &[u8]) -> Result<()> {
debug!("Validating mobile app format for: {}", path.display());

#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
if is_apple_app(path) {
debug!("Detected XCArchive directory");
return Ok(());
Expand Down Expand Up @@ -234,7 +238,7 @@ fn validate_is_mobile_app(path: &Path, bytes: &[u8]) -> Result<()> {
#[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")))]
let format_list = "APK, AAB, or XCArchive";
let format_list = "APK, or AAB";

Err(anyhow!(
"File is not a recognized mobile app format ({format_list}): {}",
Expand Down
4 changes: 2 additions & 2 deletions src/utils/mobile_app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ mod validation;

#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
pub use self::apple::{handle_asset_catalogs, ipa_to_xcarchive};
pub use self::validation::{is_aab_file, is_apk_file, is_zip_file};
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
pub use self::validation::is_ipa_file;
pub use self::validation::{is_aab_file, is_apk_file, is_apple_app, is_zip_file};
pub use self::validation::{is_apple_app, is_ipa_file};
3 changes: 3 additions & 0 deletions src/utils/mobile_app/validation.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
use std::path::Path;

use anyhow::Result;
Expand Down Expand Up @@ -51,6 +52,7 @@ pub fn is_ipa_file(bytes: &[u8]) -> Result<bool> {
Ok(is_ipa)
}

#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
pub fn is_xcarchive_directory<P>(path: P) -> bool
where
P: AsRef<Path>,
Expand All @@ -65,6 +67,7 @@ where
}

/// A path is an Apple app if it points to an xarchive directory
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
pub fn is_apple_app(path: &Path) -> bool {
path.is_dir() && is_xcarchive_directory(path)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ $ sentry-cli mobile-app upload --help
Usage: sentry-cli[EXE] mobile-app upload [OPTIONS] <PATH>...

Arguments:
<PATH>... The path to the mobile app files to upload. Supported files include Apk, Aab, and
XCArchive.
<PATH>... The path to the mobile app files to upload. Supported files include Apk, and Aab.

Options:
-o, --org <ORG>
Expand Down