diff --git a/crates/binstalk/src/fetchers.rs b/crates/binstalk/src/fetchers.rs index 00d782ad..0b53b346 100644 --- a/crates/binstalk/src/fetchers.rs +++ b/crates/binstalk/src/fetchers.rs @@ -44,6 +44,10 @@ pub trait Fetcher: Send + Sync { /// fatal conditions only. fn find(self: Arc) -> AutoAbortJoinHandle>; + /// Report to upstream that cargo-binstall tries to use this fetcher. + /// Currently it is only overriden by [`quickinstall::QuickInstall`]. + fn report_to_upstream(self: Arc) {} + /// Return the package format fn pkg_fmt(&self) -> PkgFmt; diff --git a/crates/binstalk/src/fetchers/quickinstall.rs b/crates/binstalk/src/fetchers/quickinstall.rs index 959e61d2..7a3d4b86 100644 --- a/crates/binstalk/src/fetchers/quickinstall.rs +++ b/crates/binstalk/src/fetchers/quickinstall.rs @@ -63,18 +63,8 @@ impl super::Fetcher for QuickInstall { fn find(self: Arc) -> AutoAbortJoinHandle> { AutoAbortJoinHandle::spawn(async move { - if cfg!(debug_assertions) { - debug!("Not sending quickinstall report in debug mode"); - } else { - let this = self.clone(); - tokio::spawn(async move { - if let Err(err) = this.report().await { - warn!( - "Failed to send quickinstall report for package {}: {err}", - this.package - ) - } - }); + if self.target_data.target == "universal-apple-darwin" { + return Ok(false); } does_url_exist( @@ -86,6 +76,28 @@ impl super::Fetcher for QuickInstall { }) } + fn report_to_upstream(self: Arc) { + if cfg!(debug_assertions) { + debug!("Not sending quickinstall report in debug mode"); + } else if self.target_data.target == "universal-apple-darwin" { + debug!( + r#"Not sending quickinstall report for universal-apple-darwin +quickinstall does not support our homebrew target +universal-apple-darwin, it only supports targets supported by +rust officially."#, + ); + } else { + tokio::spawn(async move { + if let Err(err) = self.report().await { + warn!( + "Failed to send quickinstall report for package {}: {err}", + self.package + ) + } + }); + } + } + async fn fetch_and_extract(&self, dst: &Path) -> Result { let url = &self.package_url; debug!("Downloading package from: '{url}'"); diff --git a/crates/binstalk/src/ops/resolve.rs b/crates/binstalk/src/ops/resolve.rs index 8255be87..fe9f42f8 100644 --- a/crates/binstalk/src/ops/resolve.rs +++ b/crates/binstalk/src/ops/resolve.rs @@ -118,6 +118,7 @@ async fn resolve_inner( ); for (fetcher, handle) in handles { + fetcher.clone().report_to_upstream(); match handle.flattened_join().await { Ok(true) => { // Generate temporary binary path