Skip to content
Closed
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
4 changes: 4 additions & 0 deletions src/api/data_types/chunking/upload/capability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ pub enum ChunkUploadCapability {
/// Upload of preprod artifacts
PreprodArtifacts,

/// Upload of ProGuard mappings
Proguard,

/// Any other unsupported capability (ignored)
Unknown,
}
Expand All @@ -53,6 +56,7 @@ impl<'de> Deserialize<'de> for ChunkUploadCapability {
"bcsymbolmaps" => ChunkUploadCapability::BcSymbolmap,
"il2cpp" => ChunkUploadCapability::Il2Cpp,
"preprod_artifacts" => ChunkUploadCapability::PreprodArtifacts,
"proguard" => ChunkUploadCapability::Proguard,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The server already returns this since getsentry/sentry@e0b7ff2

_ => ChunkUploadCapability::Unknown,
})
}
Expand Down
37 changes: 14 additions & 23 deletions src/commands/upload_proguard.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::env;
use std::io;

use anyhow::{bail, Error, Result};
Expand All @@ -10,6 +9,7 @@ use uuid::Uuid;

use crate::api::Api;
use crate::api::AssociateProguard;
use crate::api::ChunkUploadCapability;
use crate::config::Config;
use crate::utils::android::dump_proguard_uuids_as_properties;
use crate::utils::args::ArgExt as _;
Expand All @@ -19,8 +19,6 @@ use crate::utils::proguard::ProguardMapping;
use crate::utils::system::QuietExit;
use crate::utils::ui::{copy_with_progress, make_byte_progress_bar};

const CHUNK_UPLOAD_ENV_VAR: &str = "SENTRY_EXPERIMENTAL_PROGUARD_CHUNK_UPLOAD";

pub fn make_command(command: Command) -> Command {
command
.about("Upload ProGuard mapping files to a project.")
Expand Down Expand Up @@ -187,29 +185,22 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
let authenticated_api;
let (org, project);

if env::var(CHUNK_UPLOAD_ENV_VAR) == Ok("1".into()) {
log::warn!(
"EXPERIMENTAL FEATURE: Uploading proguard mappings using chunked uploading. \
Some functionality may be unavailable when using chunked uploading. Please unset \
the {CHUNK_UPLOAD_ENV_VAR} variable if you encounter any \
problems."
);
let chunk_upload_options = if matches.get_flag("no_upload") {
None
} else {
let authenticated_api = api.authenticated()?;
let org = config.get_org(matches)?;
authenticated_api
.get_chunk_upload_options(&org)
.ok()
.flatten()
};

if let Some(chunk_upload_options) =
chunk_upload_options.filter(|options| options.supports(ChunkUploadCapability::Proguard))
{
authenticated_api = api.authenticated()?;
(org, project) = config.get_org_and_project(matches)?;

let chunk_upload_options = authenticated_api
.get_chunk_upload_options(&org)
.map_err(|e| anyhow::anyhow!(e))
.and_then(|options| {
options.ok_or_else(|| {
anyhow::anyhow!(
"server does not support chunked uploading. unset \
{CHUNK_UPLOAD_ENV_VAR} to continue."
)
})
})?;

proguard::chunk_upload(&mappings, chunk_upload_options, &org, &project)?;
} else {
if mappings.is_empty() && matches.get_flag("require_one") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"concurrency": 8,
"hashAlgorithm": "sha1",
"compression": ["gzip"],
"accept": ["debug_files", "release_files", "pdbs", "portablepdbs", "sources", "bcsymbolmaps"]
"accept": ["debug_files", "release_files", "pdbs", "portablepdbs", "sources", "bcsymbolmaps", "proguard"]
}
1 change: 0 additions & 1 deletion tests/integration/upload_proguard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ fn chunk_upload_already_there() {
"tests/integration/_fixtures/upload_proguard/mapping.txt",
])
.with_default_token()
.env("SENTRY_EXPERIMENTAL_PROGUARD_CHUNK_UPLOAD", "1")
.run_and_assert(AssertCommand::Success)
}

Expand Down