@@ -11,15 +11,14 @@ use clap::{Arg, ArgAction, ArgMatches, Command};
1111use indicatif:: ProgressStyle ;
1212use itertools:: Itertools as _;
1313use log:: { debug, info, warn} ;
14- use sha1_smol:: Digest ;
1514use symbolic:: common:: ByteView ;
1615use zip:: write:: SimpleFileOptions ;
1716use zip:: { DateTime , ZipWriter } ;
1817
1918use crate :: api:: { Api , AuthenticatedApi , ChunkUploadCapability } ;
2019use crate :: config:: Config ;
2120use crate :: utils:: args:: ArgExt as _;
22- use crate :: utils:: chunks:: { upload_chunks, Chunk , ASSEMBLE_POLL_INTERVAL } ;
21+ use crate :: utils:: chunks:: { upload_chunks, Chunk } ;
2322use crate :: utils:: fs:: get_sha1_checksums;
2423#[ cfg( all( target_os = "macos" , target_arch = "aarch64" ) ) ]
2524use crate :: utils:: fs:: TempDir ;
@@ -143,8 +142,16 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
143142 sha. as_deref ( ) ,
144143 build_configuration,
145144 ) {
146- Ok ( _) => {
147- info ! ( "Successfully uploaded file: {}" , path. display( ) ) ;
145+ Ok ( artifact_id) => {
146+ if let Some ( id) = artifact_id {
147+ info ! (
148+ "Successfully uploaded file: {} (artifact_id: {})" ,
149+ path. display( ) ,
150+ id
151+ ) ;
152+ } else {
153+ info ! ( "Successfully uploaded file: {}" , path. display( ) ) ;
154+ }
148155 uploaded_paths. push ( path. to_path_buf ( ) ) ;
149156 }
150157 Err ( e) => {
@@ -344,7 +351,7 @@ fn upload_file(
344351 project : & str ,
345352 sha : Option < & str > ,
346353 build_configuration : Option < & str > ,
347- ) -> Result < ( ) > {
354+ ) -> Result < Option < String > > {
348355 const SELF_HOSTED_ERROR_HINT : & str = "If you are using a self-hosted Sentry server, \
349356 update to the latest version of Sentry to use the mobile-app upload command.";
350357
@@ -399,61 +406,7 @@ fn upload_file(
399406 } else {
400407 println ! ( "Nothing to upload, all files are on the server" ) ;
401408 }
402-
403- poll_assemble (
404- api,
405- checksum,
406- & checksums,
407- org,
408- project,
409- sha,
410- build_configuration,
411- ) ?;
412- Ok ( ( ) )
413- }
414-
415- fn poll_assemble (
416- api : & AuthenticatedApi ,
417- checksum : Digest ,
418- chunks : & [ Digest ] ,
419- org : & str ,
420- project : & str ,
421- sha : Option < & str > ,
422- build_configuration : Option < & str > ,
423- ) -> Result < ( ) > {
424- debug ! ( "Polling assemble for checksum: {}" , checksum) ;
425-
426- let progress_style = ProgressStyle :: default_spinner ( ) . template ( "{spinner} Processing files..." ) ;
427- let pb = ProgressBar :: new_spinner ( ) ;
428-
429- pb. enable_steady_tick ( 100 ) ;
430- pb. set_style ( progress_style) ;
431-
432- let response = loop {
433- let response =
434- api. assemble_mobile_app ( org, project, checksum, chunks, sha, build_configuration) ?;
435-
436- if response. state . is_finished ( ) {
437- break response;
438- }
439-
440- std:: thread:: sleep ( ASSEMBLE_POLL_INTERVAL ) ;
441- } ;
442-
443- pb. finish_with_duration ( "Processing" ) ;
444-
445- if response. state . is_err ( ) {
446- let message = response. detail . as_deref ( ) . unwrap_or ( "unknown error" ) ;
447- bail ! ( "Failed to process uploaded files: {}" , message) ;
448- }
449-
450- if response. state . is_pending ( ) {
451- info ! ( "File upload complete (processing pending on server)" ) ;
452- } else {
453- info ! ( "File processing complete" ) ;
454- }
455-
456- Ok ( ( ) )
409+ Ok ( response. artifact_id )
457410}
458411
459412#[ cfg( not( windows) ) ]
0 commit comments