diff --git a/src/api.rs b/src/api.rs index 2355d3d7d6..5a5d9602c4 100644 --- a/src/api.rs +++ b/src/api.rs @@ -39,14 +39,12 @@ use uuid::Uuid; use crate::config::{Auth, Config}; use crate::constants::{ARCH, EXT, PLATFORM, RELEASE_REGISTRY_LATEST_URL, VERSION}; -use crate::utils::android::AndroidManifest; use crate::utils::file_upload::UploadContext; use crate::utils::http::{self, is_absolute_url, parse_link_header}; use crate::utils::progress::ProgressBar; use crate::utils::retry::{get_default_backoff, DurationAsMilliseconds}; use crate::utils::sourcemaps::get_sourcemap_reference_from_headers; use crate::utils::ui::{capitalize_string, make_byte_progress_bar}; -use crate::utils::xcode::InfoPlist; // Based on https://docs.rs/percent-encoding/1.0.1/src/percent_encoding/lib.rs.html#104 // WHATWG Spec: https://url.spec.whatwg.org/#percent-encoded-bytes @@ -1356,50 +1354,6 @@ impl Api { } } - /// Associate apple debug symbols with a build - pub fn associate_apple_dsyms( - &self, - org: &str, - project: &str, - info_plist: &InfoPlist, - checksums: Vec, - ) -> ApiResult> { - self.associate_dsyms( - org, - project, - &AssociateDsyms { - platform: "apple".to_string(), - checksums, - name: info_plist.name().to_string(), - app_id: info_plist.bundle_id().to_string(), - version: info_plist.version().to_string(), - build: Some(info_plist.build().to_string()), - }, - ) - } - - /// Associate proguard mappings with an android app - pub fn associate_android_proguard_mappings( - &self, - org: &str, - project: &str, - manifest: &AndroidManifest, - checksums: Vec, - ) -> ApiResult> { - self.associate_dsyms( - org, - project, - &AssociateDsyms { - platform: "android".to_string(), - checksums, - name: manifest.name(), - app_id: manifest.package().to_string(), - version: manifest.version_name().to_string(), - build: Some(manifest.version_code().to_string()), - }, - ) - } - pub fn associate_proguard_mappings( &self, org: &str, @@ -1430,39 +1384,6 @@ impl Api { } } - /// Associate arbitrary debug symbols with a build - pub fn associate_dsyms( - &self, - org: &str, - project: &str, - data: &AssociateDsyms, - ) -> ApiResult> { - // in case we have no checksums to send up the server does not actually - // let us associate anything. This generally makes sense but means that - // from the client side we need to deal with this separately. In this - // case we just pretend we did a request that did nothing. - if data.checksums.is_empty() { - return Ok(Some(AssociateDsymsResponse { - associated_dsyms: vec![], - })); - } - - let path = format!( - "/projects/{}/{}/files/dsyms/associate/", - PathArg(org), - PathArg(project) - ); - let resp = self - .request(Method::Post, &path)? - .with_json_body(data)? - .send()?; - if resp.status() == 404 { - Ok(None) - } else { - resp.convert() - } - } - /// Triggers reprocessing for a project pub fn trigger_reprocessing(&self, org: &str, project: &str) -> ApiResult { let path = format!( @@ -2486,17 +2407,6 @@ impl DebugInfoFile { } } -#[derive(Debug, Serialize)] -pub struct AssociateDsyms { - pub platform: String, - pub checksums: Vec, - pub name: String, - #[serde(rename = "appId")] - pub app_id: String, - pub version: String, - pub build: Option, -} - #[derive(Debug, Serialize)] pub struct AssociateProguard { pub release_name: String, @@ -2585,12 +2495,6 @@ impl IssueFilter { } } -#[derive(Deserialize)] -pub struct AssociateDsymsResponse { - #[serde(rename = "associatedDsymFiles")] - pub associated_dsyms: Vec, -} - #[derive(Deserialize, Debug)] pub struct Organization { pub id: String, diff --git a/src/commands/debug_files/upload.rs b/src/commands/debug_files/upload.rs index 3e93f3d170..3539d54b6e 100644 --- a/src/commands/debug_files/upload.rs +++ b/src/commands/debug_files/upload.rs @@ -16,7 +16,6 @@ use crate::constants::DEFAULT_MAX_WAIT; use crate::utils::args::ArgExt; use crate::utils::dif::{DifType, ObjectDifFeatures}; use crate::utils::dif_upload::{DifFormat, DifUpload}; -use crate::utils::progress::{ProgressBar, ProgressStyle}; use crate::utils::system::QuietExit; use crate::utils::xcode::{InfoPlist, MayDetach}; @@ -304,7 +303,8 @@ pub fn execute(matches: &ArgMatches) -> Result<()> { } // Try to resolve the Info.plist either by path or from Xcode - let info_plist = match matches.get_one::("info_plist") { + // TODO: maybe remove this completely? + let _info_plist = match matches.get_one::("info_plist") { Some(path) => Some(InfoPlist::from_path(path)?), None => InfoPlist::discover_from_env()?, }; @@ -324,35 +324,6 @@ pub fn execute(matches: &ArgMatches) -> Result<()> { let (uploaded, has_processing_errors) = upload.upload()?; let api = Api::current(); - // Associate the dSYMs with the Info.plist data, if available - if let Some(ref info_plist) = info_plist { - let progress_style = ProgressStyle::default_spinner() - .template("{spinner} Associating dSYMs with {msg}..."); - - let pb = ProgressBar::new_spinner(); - pb.enable_steady_tick(100); - pb.set_style(progress_style); - pb.set_message(&info_plist.to_string()); - - let checksums = uploaded.iter().map(|dif| dif.checksum.clone()).collect(); - let response = api.associate_apple_dsyms(&org, &project, info_plist, checksums)?; - pb.finish_and_clear(); - - if let Some(association) = response { - if association.associated_dsyms.is_empty() { - println!("{} No new debug symbols to associate.", style(">").dim()); - } else { - println!( - "{} Associated {} debug symbols with the build.", - style(">").dim(), - style(association.associated_dsyms.len()).yellow() - ); - } - } else { - info!("Server does not support dSYM associations. Ignoring."); - } - } - // Trigger reprocessing only if requested by user if matches.get_flag("no_reprocessing") { println!("{} skipped reprocessing", style(">").dim()); diff --git a/src/commands/upload_proguard.rs b/src/commands/upload_proguard.rs index 8eb5b2d132..759c75c995 100644 --- a/src/commands/upload_proguard.rs +++ b/src/commands/upload_proguard.rs @@ -14,7 +14,7 @@ use uuid::Uuid; use crate::api::Api; use crate::api::AssociateProguard; use crate::config::Config; -use crate::utils::android::{dump_proguard_uuids_as_properties, AndroidManifest}; +use crate::utils::android::dump_proguard_uuids_as_properties; use crate::utils::args::ArgExt; use crate::utils::fs::{get_sha1_checksum, TempFile}; use crate::utils::system::QuietExit; @@ -106,6 +106,7 @@ pub fn make_command(command: Command) -> Command { .long("android-manifest") .value_name("PATH") .conflicts_with("app_id") + .hide(true) .help("Read version and version code from an Android manifest file."), ) .arg( @@ -152,12 +153,6 @@ pub fn execute(matches: &ArgMatches) -> Result<()> { let mut mappings = vec![]; let mut all_checksums = vec![]; - let android_manifest = if let Some(path) = matches.get_one::("android_manifest") { - Some(AndroidManifest::from_path(path)?) - } else { - None - }; - let forced_uuid = matches.get_one::("uuid"); if forced_uuid.is_some() && paths.len() != 1 { bail!( @@ -261,12 +256,8 @@ pub fn execute(matches: &ArgMatches) -> Result<()> { } } - // update the uuids - if let Some(android_manifest) = android_manifest { - api.associate_android_proguard_mappings(&org, &project, &android_manifest, all_checksums)?; - // if values are given associate - } else if let Some(app_id) = matches.get_one::("app_id") { + if let Some(app_id) = matches.get_one::("app_id") { let version = matches.get_one::("version").unwrap().to_owned(); let build: Option = matches.get_one::("version_code").cloned(); diff --git a/src/utils/android.rs b/src/utils/android.rs index b180a4679b..1553ae5d12 100644 --- a/src/utils/android.rs +++ b/src/utils/android.rs @@ -1,78 +1,12 @@ use std::collections::HashMap; -use std::fmt; use std::fs; use std::io; use std::path::Path; use anyhow::{format_err, Result}; -use elementtree::Element; use itertools::Itertools; use uuid::Uuid; -pub struct AndroidManifest { - root: Element, -} - -const ANDROID_NS: &str = "http://schemas.android.com/apk/res/android"; - -impl AndroidManifest { - pub fn from_path>(path: P) -> Result { - let f = fs::File::open(path.as_ref())?; - let root = Element::from_reader(f)?; - Ok(AndroidManifest { root }) - } - - /// Returns the package ID - pub fn package(&self) -> &str { - self.root.get_attr("package").unwrap_or("unknown") - } - - /// Returns a name - pub fn name(&self) -> String { - // fallback name is the package reformatted - self.root - .get_attr("package") - .unwrap_or("unknown") - .rsplit('.') - .next() - .unwrap() - .chars() - .enumerate() - .map(|(idx, c)| { - if idx == 0 { - c.to_uppercase().to_string() - } else { - c.to_lowercase().to_string() - } - }) - .collect() - } - - /// Returns the internal version code for this manifest - pub fn version_code(&self) -> &str { - self.root - .get_attr((ANDROID_NS, "versionCode")) - .unwrap_or("0") - } - - /// Returns the human readable version number of the manifest - pub fn version_name(&self) -> &str { - self.root - .get_attr((ANDROID_NS, "versionName")) - .unwrap_or("0.0") - } -} - -impl fmt::Debug for AndroidManifest { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("AndroidManifest") - .field("package", &self.package()) - .field("version_code", &self.version_code()) - .field("version_name", &self.version_name()) - .finish() - } -} - pub fn dump_proguard_uuids_as_properties>(p: P, uuids: &[Uuid]) -> Result<()> { let mut props = match fs::File::open(p.as_ref()) { Ok(f) => java_properties::read(f).unwrap_or_else(|_| HashMap::new()), diff --git a/tests/integration/_cases/upload_proguard/upload_proguard-help.trycmd b/tests/integration/_cases/upload_proguard/upload_proguard-help.trycmd index bf71945376..cc34b1f034 100644 --- a/tests/integration/_cases/upload_proguard/upload_proguard-help.trycmd +++ b/tests/integration/_cases/upload_proguard/upload_proguard-help.trycmd @@ -37,7 +37,6 @@ Options: upload (this also automatically disables reprocessing). This is useful if you just want to verify the mapping files and write the proguard UUIDs into a properties file. - --android-manifest Read version and version code from an Android manifest file. --write-properties Write the UUIDs for the processed mapping files into the given properties file. --require-one Requires at least one file to upload or the command will error.