Skip to content

Commit 7f5cb5d

Browse files
rbro112runningcode
andauthored
chore(mobile-app): Rename mobile-app subcommand to build (#2719)
Per discussion with team, now that we support size/pre-production analysis of app builds beyond mobile app, we'd like to rename the `mobile-app` subcommand to `build`. --------- Co-authored-by: Nelson Osacky <[email protected]>
1 parent 29151e5 commit 7f5cb5d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+119
-125
lines changed

.cursor/rules/rust-development.mdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ cargo fmt
5050
## Swift/Apple Integration
5151

5252
- Swift code in `apple-catalog-parsing/` is used for parsing xarchive files
53-
- Used by the `mobile-app upload` command for iOS app processing
53+
- Used by the `build upload` command for iOS app processing
5454
- Built as a separate crate with FFI bindings to Rust
5555
- Only compiled on macOS targets
5656
- Tests run via `swift-test.yml` workflow in CI
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use sha1_smol::Digest;
44
use super::ChunkedFileState;
55

66
#[derive(Debug, Serialize)]
7-
pub struct ChunkedMobileAppRequest<'a> {
7+
pub struct ChunkedBuildRequest<'a> {
88
pub checksum: Digest,
99
pub chunks: &'a [Digest],
1010
#[serde(skip_serializing_if = "Option::is_none")]
@@ -30,7 +30,7 @@ pub struct ChunkedMobileAppRequest<'a> {
3030

3131
#[derive(Debug, Deserialize)]
3232
#[serde(rename_all = "camelCase")]
33-
pub struct AssembleMobileAppResponse {
33+
pub struct AssembleBuildResponse {
3434
pub state: ChunkedFileState,
3535
pub missing_chunks: Vec<Digest>,
3636
pub detail: Option<String>,

src/api/data_types/chunking/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
//! from the server.
33
44
mod artifact;
5+
mod build;
56
mod compression;
67
mod dif;
78
mod file_state;
89
mod hash_algorithm;
9-
mod mobile_app;
1010
mod upload;
1111

1212
pub use self::artifact::{AssembleArtifactsResponse, ChunkedArtifactRequest};
13+
pub use self::build::{AssembleBuildResponse, ChunkedBuildRequest};
1314
pub use self::compression::ChunkCompression;
1415
pub use self::dif::{AssembleDifsRequest, AssembleDifsResponse, ChunkedDifRequest};
1516
pub use self::file_state::ChunkedFileState;
1617
pub use self::hash_algorithm::ChunkHashAlgorithm;
17-
pub use self::mobile_app::{AssembleMobileAppResponse, ChunkedMobileAppRequest};
1818
pub use self::upload::{ChunkServerOptions, ChunkUploadCapability};

src/api/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,23 +1030,23 @@ impl<'a> AuthenticatedApi<'a> {
10301030
.convert_rnf(ApiErrorKind::ReleaseNotFound)
10311031
}
10321032

1033-
pub fn assemble_mobile_app(
1033+
pub fn assemble_build(
10341034
&self,
10351035
org: &str,
10361036
project: &str,
10371037
checksum: Digest,
10381038
chunks: &[Digest],
10391039
build_configuration: Option<&str>,
10401040
vcs_info: &VcsInfo<'_>,
1041-
) -> ApiResult<AssembleMobileAppResponse> {
1041+
) -> ApiResult<AssembleBuildResponse> {
10421042
let url = format!(
10431043
"/projects/{}/{}/files/preprodartifacts/assemble/",
10441044
PathArg(org),
10451045
PathArg(project)
10461046
);
10471047

10481048
self.request(Method::Post, &url)?
1049-
.with_json_body(&ChunkedMobileAppRequest {
1049+
.with_json_body(&ChunkedBuildRequest {
10501050
checksum,
10511051
chunks,
10521052
build_configuration,
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ macro_rules! each_subcommand {
1414
pub fn make_command(mut command: Command) -> Command {
1515
macro_rules! add_subcommand {
1616
($name:ident) => {{
17-
command = command.subcommand(crate::commands::mobile_app::$name::make_command(
17+
command = command.subcommand(crate::commands::build::$name::make_command(
1818
Command::new(stringify!($name).replace('_', "-")),
1919
));
2020
}};
2121
}
2222

2323
command = command
24-
.about("[EXPERIMENTAL] Manage mobile apps.")
24+
.about("[EXPERIMENTAL] Manage builds.")
2525
.subcommand_required(true)
2626
.arg_required_else_help(true)
2727
.org_arg()
@@ -34,7 +34,7 @@ pub fn make_command(mut command: Command) -> Command {
3434

3535
pub fn execute(matches: &ArgMatches) -> Result<()> {
3636
log::warn!(
37-
"EXPERIMENTAL: The mobile-app subcommand is experimental. \
37+
"EXPERIMENTAL: The build subcommand is experimental. \
3838
The command is subject to breaking changes and may be removed \
3939
without notice in any release."
4040
);
@@ -44,7 +44,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
4444
if let Some(sub_matches) =
4545
matches.subcommand_matches(&stringify!($name).replace('_', "-"))
4646
{
47-
return crate::commands::mobile_app::$name::execute(&sub_matches);
47+
return crate::commands::build::$name::execute(&sub_matches);
4848
}
4949
}};
5050
}
Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,27 @@ use zip::{DateTime, ZipWriter};
1313
use crate::api::{Api, AuthenticatedApi, ChunkUploadCapability, ChunkedFileState, VcsInfo};
1414
use crate::config::Config;
1515
use crate::utils::args::ArgExt as _;
16+
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
17+
use crate::utils::build::{handle_asset_catalogs, ipa_to_xcarchive, is_apple_app, is_ipa_file};
18+
use crate::utils::build::{is_aab_file, is_apk_file, is_zip_file, normalize_directory};
1619
use crate::utils::chunks::{upload_chunks, Chunk};
1720
use crate::utils::fs::get_sha1_checksums;
1821
use crate::utils::fs::TempDir;
1922
use crate::utils::fs::TempFile;
20-
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
21-
use crate::utils::mobile_app::{
22-
handle_asset_catalogs, ipa_to_xcarchive, is_apple_app, is_ipa_file,
23-
};
24-
use crate::utils::mobile_app::{is_aab_file, is_apk_file, is_zip_file, normalize_directory};
2523
use crate::utils::progress::ProgressBar;
2624
use crate::utils::vcs::{
2725
self, get_provider_from_remote, get_repo_from_remote, git_repo_remote_url,
2826
};
2927

3028
pub fn make_command(command: Command) -> Command {
3129
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
32-
const HELP_TEXT: &str = "The path to the mobile app files to upload. Supported files include Apk, Aab, XCArchive, and IPA.";
30+
const HELP_TEXT: &str =
31+
"The path to the build to upload. Supported files include Apk, Aab, XCArchive, and IPA.";
3332
#[cfg(not(all(target_os = "macos", target_arch = "aarch64")))]
3433
const HELP_TEXT: &str =
35-
"The path to the mobile app files to upload. Supported files include Apk, and Aab.";
34+
"The path to the build to upload. Supported files include Apk, and Aab.";
3635
command
37-
.about("[EXPERIMENTAL] Upload mobile app files to a project.")
36+
.about("[EXPERIMENTAL] Upload builds to a project.")
3837
.org_arg()
3938
.project_arg(false)
4039
.arg(
@@ -149,10 +148,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
149148
let api = Api::current();
150149
let authenticated_api = api.authenticated()?;
151150

152-
debug!(
153-
"Starting mobile app upload for {} paths",
154-
path_strings.len()
155-
);
151+
debug!("Starting upload for {} paths", path_strings.len());
156152

157153
let mut normalized_zips = vec![];
158154
for path_string in path_strings {
@@ -166,7 +162,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
166162
let byteview = ByteView::open(path)?;
167163
debug!("Loaded file with {} bytes", byteview.len());
168164

169-
validate_is_mobile_app(path, &byteview)?;
165+
validate_is_supported_build(path, &byteview)?;
170166

171167
let normalized_zip = if path.is_file() {
172168
debug!("Normalizing file: {}", path.display());
@@ -285,8 +281,8 @@ fn handle_file(path: &Path, byteview: &ByteView) -> Result<TempFile> {
285281
})
286282
}
287283

288-
fn validate_is_mobile_app(path: &Path, bytes: &[u8]) -> Result<()> {
289-
debug!("Validating mobile app format for: {}", path.display());
284+
fn validate_is_supported_build(path: &Path, bytes: &[u8]) -> Result<()> {
285+
debug!("Validating build format for: {}", path.display());
290286

291287
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
292288
if is_apple_app(path) {
@@ -325,7 +321,7 @@ fn validate_is_mobile_app(path: &Path, bytes: &[u8]) -> Result<()> {
325321
let format_list = "APK, or AAB";
326322

327323
Err(anyhow!(
328-
"File is not a recognized mobile app format ({format_list}): {}",
324+
"File is not a recognized supported build format ({format_list}): {}",
329325
path.display()
330326
))
331327
}
@@ -379,7 +375,7 @@ fn upload_file(
379375
vcs_info: &VcsInfo<'_>,
380376
) -> Result<String> {
381377
const SELF_HOSTED_ERROR_HINT: &str = "If you are using a self-hosted Sentry server, \
382-
update to the latest version of Sentry to use the mobile-app upload command.";
378+
update to the latest version of Sentry to use the build upload command.";
383379

384380
debug!(
385381
"Uploading file to organization: {}, project: {}, build_configuration: {}, vcs_info: {:?}",
@@ -392,7 +388,7 @@ fn upload_file(
392388
let chunk_upload_options = api.get_chunk_upload_options(org)?.ok_or_else(|| {
393389
anyhow!(
394390
"The Sentry server lacks chunked uploading support, which \
395-
is required for mobile app uploads. {SELF_HOSTED_ERROR_HINT}"
391+
is required for build uploads. {SELF_HOSTED_ERROR_HINT}"
396392
)
397393
})?;
398394

@@ -433,7 +429,7 @@ fn upload_file(
433429
// n. state=error, artifact_url unset
434430

435431
let result = loop {
436-
let response = api.assemble_mobile_app(
432+
let response = api.assemble_build(
437433
org,
438434
project,
439435
checksum,
@@ -497,7 +493,7 @@ mod tests {
497493
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
498494
fn test_xcarchive_upload_includes_parsed_assets() -> Result<()> {
499495
// Test that XCArchive uploads include parsed asset catalogs
500-
let xcarchive_path = Path::new("tests/integration/_fixtures/mobile_app/archive.xcarchive");
496+
let xcarchive_path = Path::new("tests/integration/_fixtures/build/archive.xcarchive");
501497

502498
// Process the XCArchive directory
503499
let result = handle_directory(xcarchive_path)?;
@@ -529,7 +525,7 @@ mod tests {
529525
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
530526
fn test_ipa_upload_includes_parsed_assets() -> Result<()> {
531527
// Test that IPA uploads handle missing asset catalogs gracefully
532-
let ipa_path = Path::new("tests/integration/_fixtures/mobile_app/ipa_with_asset.ipa");
528+
let ipa_path = Path::new("tests/integration/_fixtures/build/ipa_with_asset.ipa");
533529
let byteview = ByteView::open(ipa_path)?;
534530

535531
// Process the IPA file - this should work even without asset catalogs

src/commands/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use crate::utils::update::run_sentrycli_update_nagger;
2020
use crate::utils::value_parsers::auth_token_parser;
2121

2222
mod bash_hook;
23+
mod build;
2324
mod dart_symbol_map;
2425
mod debug_files;
2526
mod deploys;
@@ -30,7 +31,6 @@ mod info;
3031
mod issues;
3132
mod login;
3233
mod logs;
33-
mod mobile_app;
3434
mod monitors;
3535
mod organizations;
3636
mod projects;
@@ -52,6 +52,7 @@ mod upload_proguard;
5252
macro_rules! each_subcommand {
5353
($mac:ident) => {
5454
$mac!(bash_hook);
55+
$mac!(build);
5556
$mac!(debug_files);
5657
$mac!(deploys);
5758
$mac!(events);
@@ -60,7 +61,6 @@ macro_rules! each_subcommand {
6061
$mac!(issues);
6162
$mac!(login);
6263
$mac!(logs);
63-
$mac!(mobile_app);
6464
$mac!(monitors);
6565
$mac!(organizations);
6666
$mac!(projects);

0 commit comments

Comments
 (0)