Skip to content

Commit

Permalink
feat(xcode): All uploads in foreground
Browse files Browse the repository at this point in the history
Perform all uploads from Xcode in the foreground. The new behavior is equivalent to the old `--force-foreground` behavior.

Since uploads are now always executed in the foreground, (soft) deprecate the `--force-foreground` option by hiding it in the command help text. The `--force-foreground` option no longer has any effect, but passing it will continue to be possible at least until the next major release to keep the API backwards compatible.

Background functionality is completely removed from Sentry-CLI with this change.

Closes #2166
Fixes #2148
  • Loading branch information
szokeasaurusrex committed Sep 27, 2024
1 parent 2795780 commit 063f40b
Show file tree
Hide file tree
Showing 7 changed files with 186 additions and 441 deletions.
28 changes: 7 additions & 21 deletions src/commands/debug_files/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::utils::args::ArgExt;
use crate::utils::dif::{DifType, ObjectDifFeatures};
use crate::utils::dif_upload::{DifFormat, DifUpload};
use crate::utils::system::QuietExit;
use crate::utils::xcode::{InfoPlist, MayDetach};
use crate::utils::xcode::InfoPlist;

static DERIVED_DATA_FOLDER: &str = "Library/Developer/Xcode/DerivedData";

Expand Down Expand Up @@ -152,15 +152,12 @@ pub fn make_command(command: Command) -> Command {
)
.arg(
Arg::new("force_foreground")
.hide(true)
.long("force-foreground")
.action(ArgAction::SetTrue)
.help(
"Wait for the process to finish.{n}\
By default, the upload process will detach and continue in the \
background when triggered from Xcode. When an error happens, \
a dialog is shown. If this parameter is passed Xcode will wait \
for the process to finish before the build finishes and output \
will be shown in the Xcode build output.",
"DEPRECATED: Foreground uploads are now the default behavior.{n}\
This flag has no effect and will be removed in a future version.",
),
)
.arg(
Expand Down Expand Up @@ -306,22 +303,11 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
return Ok(());
}

MayDetach::wrap("Debug symbol upload", |handle| {
upload_debug_symbols(matches, upload, handle)
})
upload_debug_symbols(matches, upload)
}

/// Executes the upload of debug symbols, possibly detaching the process.
fn upload_debug_symbols(
matches: &ArgMatches,
mut upload: DifUpload,
handle: &mut MayDetach,
) -> Result<(), Error> {
// Optionally detach if run from Xcode
if !matches.get_flag("force_foreground") {
handle.may_detach()?;
}

/// Executes the upload of debug symbols.
fn upload_debug_symbols(matches: &ArgMatches, mut upload: DifUpload) -> Result<(), Error> {
// Execute the upload
let (uploaded, has_processing_errors) = upload.upload()?;

Expand Down
Loading

0 comments on commit 063f40b

Please sign in to comment.